I run a Spring Boot application as a .jar file which partly takes its properties from application.yml residing inside the jar while the other part of properties is being provided from another application.yml residing outside the jar. Some of the properties from the outside overwrite the properties from the inside. In order to test whether the properties were overwritten properly I would like to see the currently active ones. Is that achieveable at all out of the box? Or is the only solution to extend my application by property output logic?
Asked
Active
Viewed 1.6k times
2 Answers
13
If you add Spring Boot Actuator to your dependencies, you can view a lot of configuration and other info at actuator endpoints. You can view properties at /configprops
endpoint.

jny
- 8,007
- 3
- 37
- 56
-
Hmm, but the /env and /configprops do not display the current values of the properties. For example /env responds with the values from inside the jar. The outside overwriting parameters are not visible by accessing this endpoint. – Ewgenij Sokolovski Apr 04 '17 at 10:39
-
1Are you sure, that outside parameters are being picked up. For me, `/env` shows properties in the external properties file. – jny Apr 04 '17 at 18:35
-
1@jny unfortunately `/configprops` doesn't show my custom properties but only spring-boot native ones – Roman Sinyakov Dec 15 '17 at 11:59
-
@dhroove No I don't so far – Roman Sinyakov Mar 20 '18 at 10:58
4
At least as of spring boot 2.0 actuator/env
will return the list of all properties per propertySources
in order of their precedence, ie. if a property is redefined in >1 sources then the 1st occurrence reading from the top is the one that is active.
For a single property actuator/env/<property-name>
will return the effective value and in which source it's defined
{
"property": {
"source": "applicationConfig: [file:../application-tom.properties]",
"value": "DEBUG"
},
...
}
Note: I dont know if this would reflect any changes that might happen when programmatically modifying the spring context. But that is smth. one should not do anyhow.

elonderin
- 509
- 4
- 12
-
1note that you have to enable the above actuator endpoints - they are no longer enabled by default https://stackoverflow.com/questions/51829253/actuator-exposing-endpoints-not-working – hello_earth Jun 03 '20 at 09:33