-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Short circuit @Value injection when using a source already covered by ConfigurationPropertySourcesPropertySource #28687
Comments
I think we may have fixed this already with #17400 (commit 6ad100e) which was added to Spring Boot 2.5. @ShijunDeng Can you check that you're using Spring Boot 2.5 or above? If you're finding an issue with that version could you please please provide a sample that shows the problem. |
New similar problem with
|
@philwebb ,hi,How is it going ? |
I need to dig a bit more, but I suspect this resolver is being used which doesn't support the short-circuiting. |
spring-boot/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySource.java
Line 33 in aaad772
In Springboot application,ConfigurationPropertySourcesPropertySource is added to the environment and as first element, the ConfigurationPropertySourcesPropertySource acts as a facade over the existing property sources.
When handling
@Value
annotation, org.springframework.core.env.PropertySourcesPropertyResolver#getProperty will be called.If the property is found then ConfigurationPropertySourcesPropertySource will return the result. otherwise, PropertySourcesPropertyResolver continues to check all subsequent sources. This is a little inefficient for any source that has already been check via ConfigurationPropertySourcesPropertySource.
The text was updated successfully, but these errors were encountered: