-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Placeholder resolution for annotation attributes is not active by default [SPR-14140] #18712
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
Juergen Hoeller commented My guess is that you did not declare a This can be rather unintuitive, in particular since |
Juergen Hoeller commented We're registering a default embedded value resolver for the default environment now, in case of none having been registered through post-processors (like This will make it into 4.3 RC2. However, it would be great if you could confirm that a manually added |
Bjorn Harvold commented This is how I'm registering my environment specific content: @Configuration
@PropertySource(value = "classpath:server-local.properties")
public class AppLocalConfig {
} So you are saying this won't work until 4.3RC2? |
Sam Brannen commented
You have always had to manually register a Here is an excerpt from the Javadoc for
In other words, adding the following static bean to one of your @Bean
public static PropertySourcesPlaceholderConfigurer ppc() {
// instantiate, configure and return ppc ...
} |
Juergen Hoeller commented Indeed, even a plain @Bean
public static PropertySourcesPlaceholderConfigurer ppc() {
return new PropertySourcesPlaceholderConfigurer();
} should do the job. The only thing that changes as of 4.3 RC2 is that standard placeholder resolution in annotation attributes will work even without such a placeholder configurer bean in your context. |
Bjorn Harvold commented Hi guys, I added this code to see if it would change anything. I still get the same error. @Configuration
@PropertySource(value = "classpath:server-local.properties")
public class AppLocalConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer ppc() {
return new PropertySourcesPlaceholderConfigurer();
}
} |
Juergen Hoeller commented Hmm, this should actually work against 4.3 RC1 that way... Could you alternatively try against |
Bjorn Harvold commented Hi Juergen, We haven't configured our Maven repo to retrieve external snapshots. I'll put a footnote in my code and test this again with RC2. If it doesn't work in RC2, I'm probably doing something wrong on my end. P.S. I do wonder if you guys ever sleep. The response time on my tickets is phenomenal! |
If someone still wondering why this doesn't work in 2020 with ENV variables (and you still use Spring 4.3.X) check that |
Bjorn Harvold opened SPR-14140 and commented
I created ticket #18525 pre v4.3.RC1.
I updated to 4.3.RC1 today and found that the placeholder still doesn't convert.
The below code fails:
Please advise
Affects: 4.3 RC1
Issue Links:
@Scheduled
)@RequestHeader
name/value does not accept placeholders@PropertySource
is used@Enable-style
annotation is desired for automatic registration of PropertySourcesPlaceholderConfigurerReferenced from: commits 0f0aa46, cb95496
0 votes, 5 watchers
The text was updated successfully, but these errors were encountered: