-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
automatic registration of PSPC when @PropertySource is used [SPR-8539] #13183
Comments
Chris Beams commented After some consideration, resolving this as Won't Fix for the following reasons:
|
Chris Beams commented Note that for completeness of documentation (#3 above), I've added the following to
|
Eugen Paraschiv commented Reading through the notes on this issue, I am somewhat unclear as to why Environment#getProperty is favored. At first glance, it would make more sense not to use the lower level and manual lookup but instead to just wire in properties directly, with |
Chris Beams commented Eugen, The recommendation about using
these values are of course then referenced within the
and then calls to
Hope that helps! |
Eugen Paraschiv commented Yes, most of these make sense - it does require a bit of a shift in the mindset with which you're approaching configuration, which is fine. The only downside of making this choice, in my view, is that you're going against the behaviour that you would expect - meaning that you'd expect this to work out of the box and it won't. There is clearly good reason it doesn't - probably making the reference clear about why this is the way it is, and what the best practice is in this area would also be good. |
Andrey Rubtsov commented For those cases when registering a PSPC is still not so bad idea, can it be done via some |
Chris Beams commented Andrey Rubtsov, feel free to create a new issue for this. We can see if it gets much in the way of interest, votes, etc. There's a fine line between what merits an |
Andrey Rubtsov commented Ok, created #14537. |
Sam Brannen commented FYI: this has effectively been superseded by #18712. |
Josh Long opened SPR-8539 and commented
Can we please register a PropertySourcesPlaceholderConfigurer when
@PropertySource
is used so that everything just "works" in@Configuration
classes? I realize that I could also do a@Bean
public static PropertySourcesPlaceholderConfigurer pspc(){ }, but it is surprising that it doesn't work by default. It's one more place for users to stub their toes when I can't think of any reason not to support it. Thanks for your consideration.Reference URL: http://blog.springsource.com/2011/06/10/spring-3-1-m2-configuration-enhancements/#comment-195857
Issue Links:
@Enable-style
annotation is desired for automatic registration of PropertySourcesPlaceholderConfigurer@Component
class using@Value
cannot access@PropertySource
proeprtiesReferenced from: commits 690d33e
1 votes, 9 watchers
The text was updated successfully, but these errors were encountered: