-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PicocliSpringFactory should not fall back default Factory #1563
Comments
Hi @a1dutch, thank you for raising this! I am not sure yet though. :-) @Option(names = "-x") List list;
@Option(names = "-y") Map map; ... then the factory is used to create objects for the However, all of this is just the background for the current implementation, but that does not solve your use case. |
HI @remkop Thanks for the quick response. In my case i had a Running the command just resulted in NPE errors on the autowired fields. |
@a1dutch so I am guessing that the factory could not find the From my point of view, the
These objects do not all exist in the Spring ApplicationContext, so it is normal and desirable for the That said, I can see your point, you would like to validate that your application and configuration is correct. Idea 1: enhance
|
I am thinking to implement Idea 2 (add |
Hi @remkop, At the minute i am just redeclaring my own Factory like so
i plan to do a little testing using some of those types and converters you mentioned |
FYI, idea number 2 is now implemented and will be available in the next picocli release (4.7.0). Are there any other tasks outstanding, or are you okay to close this ticket? |
You can close, thankyou |
Just upgraded from 3.X to 4.X, using Guice injector as factory, took me a few hours to figure out this BC. I got
|
Hi @ebuildy, please look at the Guice example in the manual: https://picocli.info/#_guice_example |
@a1dutch Thanks for the confirmation! |
woa dont understand how I missed it..... thanks you very much , this is very clear. |
@ebuildy Great, glad to hear that! |
Hi,
Using the picoli-spring-boot-starter the
PicocliSpringFactory
falls back toCommandLine.defaultFactory().create(clazz)
if its not able to create a bean.This can lead to unintended consequences and dependents not being injected or available. In my case the logging was turned off and there was no indication that this had failed
A better approach may be to just throw the caught exeception and fail.
Happy to create a PR with a feature flag (but this probably should be the default behaviour in the next major version)
Cheers
@a1dutch
The text was updated successfully, but these errors were encountered: