You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Boot 2.4 before, the order is achieved by ConfigFileApplicationListener$PropertySourceOrderingPostProcessor, but Spring Boot 2.4 after, I cannot find a BeanFactoryPostProcessor to do that.
The text was updated successfully, but these errors were encountered:
However, this happens before Framework's ConfigurationClassParser processes the @PropertySource annotation and calls addLast to add the resulting property source. As a result, the property source created via @PropertySource has lower precedence than defaultProperties.
wilkinsona
changed the title
DefaultProperties(SpringApplication.setDefaultProperties()) lost order with @PropertySource
Default properties configured on SpringApplication have higher precedence than properties configured with @PropertySource
May 17, 2022
Uh oh!
There was an error while loading. Please reload this page.
The Externalized Configuration section of the reference documentation say that order of default properties (
SpringApplication.setDefaultProperties()
) is lower with@PropertySource
, but my test is inconsistent.My Spring Boot is 2.6.7.
My Test 1
api.properties
api.name=api
My Result 1
api.name=default
api.properties may be not loaded in My Test 1,so I print PropertySources of Environment in console.
My Test 2
My Result 2
My Thought
Spring Boot 2.4 before, the order is achieved by
ConfigFileApplicationListener$PropertySourceOrderingPostProcessor
, but Spring Boot 2.4 after, I cannot find aBeanFactoryPostProcessor
to do that.The text was updated successfully, but these errors were encountered: