-
Notifications
You must be signed in to change notification settings - Fork 38.5k
@Enable-style annotation is desired for automatic registration of PropertySourcesPlaceholderConfigurer [SPR-9904] #14537
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
Comments
Chris Beams commented Thanks, Andrii. |
B. K. Oxley (binkley) commented The main argument for me is not aesthetic, it is practical. To move from XML to Java configuration means rewriting beans using |
Wojciech Krak commented It's waste of time, that this doesn't work automatically right now. I lost couple of hours, why after move from xml to javaconfig my |
Mark Pollack commented I agree that we are not following the 'principle of least surprise' here. I also don't agree with argument in the previous JIRA not to use |
Dave Syer commented I agree 100% that injecting an |
Christopher C. Merris commented Adding my vote here. I also wasted an hour and a half expecting Also +1 on env.getProperty feeling like service locator. |
Tomáš Hanus commented I have to agree with reporter. This behaviour is what I am expecting when developing new app under Spring Boot. On the other hand we rather use environment approach (with spring boot) that support external configuration over many resources (chain of configuration resource) and one of them is DB. It is more flexible, but sure, it is about knowledge. Default behaviour should be as simple as possible. |
Sam Brannen commented Juergen Hoeller, I'm thinking this has effectively been superseded by #18712. Thoughts? |
Juergen Hoeller commented Indeed, with the standard placeholder resolution brought by #18712, the main use cases are covered here. Only really the replacement of placeholders in external bean definition values (like XML property definitions) requires an explicit |
Andrey Rubtsov opened SPR-9904 and commented
This issue is a continuation of #13183. Long story short, Environment is advertised to be used in new Spring projects.
However, in those cases when using PSPC is still wanted instead of declaring it as a
@Bean
it would be nice to have@Enable-style
annotation instead for it.The main argument so far is probably that PSPC
@Bean
looks slightly unnatural among app specific beans because it is related to Spring internals rather than carrying application bean semantics.Issue Links:
@Value
("${someProperty}") should work without having to specify a PropertySourcesPlaceholderConfigurer bean.@PropertySource
is used16 votes, 26 watchers
The text was updated successfully, but these errors were encountered: