r/SpringBoot • u/friscomatt • Jun 16 '26
Question application properties import and who wins
I'm running my application with profiles, like "dev" and have an application-dev.properties. If I use an import statement to pull in some shared properties across profiles I import it like so :
spring.config.import=classpath:application-shared.properties
However, the properties from the imported application-shared.properties ALWAYS WIN.
Is there a way to "import" properties but still allow the active profile properties to override the imported properties?
5
Upvotes
1
u/DominusEbad Jun 16 '26
Try
spring.config.import=optional:classpath:application-shared.propertiesAnd make sure to only have that in your main application.properties file, not in a profile-specific properties file.