I work with a SpringBoot application which has a lot of .properties files in several different directories. The directories are listed using:
-Dspring.config.additional-location=
and then within those, there are profiles pointed to by the
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
...
<configuration>
<profiles>
<profile>PROFILE_1</profile>
<profile>PROFILE_2</profile>
<profile>PROFILE_3</profile>
This causes a problem when either a key is repeated in multiple places (which one is being used???), or when multiple properties files have the same name (which one overrides which????).
What I want to do is have my app. output ALL key-value pairs on startup (when a debug flag is set!) from all application.properties or application-XXX.properties files it is reading from.
This doesn’t seem to be as simple as I thought it would be.
I’ve researched this on StackOverflow and elsewhere, but the closest I can find is this:
Is there a way to get list of loaded properties file in SpringBoot application?
I’ve been playing with the code in that question for a while but I can only make it give me the value of any given key, not the list of ALL key-value pairs.
This must have been done before? Or is there a security reason why it is blocked?
3