-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Description
I am trying to upgrade my project from spring boot 2.7.x to 3.1.x and noticed an issue with the a config file being loaded twice.
When looking at the properties resolved using the /actuator/env
endpoint, I noticed that the application.properties file is being read twice.
This is the relevant portion of /actuator/env response.
{
"name": "applicationConfig: [classpath:/application.properties]",
"properties": {
...
}
},
{
"name": "configserver:ssh://config-server-host/application.properties",
"properties": {
...
}
},
{
"name": "Config resource 'class path resource [application.properties]' via location 'optional:classpath:/'",
"properties": {
...
}
}
Normally I would expect the properties defined in the file deployed on cloud config server to take precedence but since the application.properties is showing up first in the list with the source as applicationConfig
, those values are taking effect.
This seems to be new in 3.1. In the /actuator/env
response when using Spring boot 2.7.x, I see only two entries with configserver
one being the first one.
Why is the application.properties on my classpath being loaded twice? Once as applicationConfig and later as config resource?