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
Version: springboot: 3.1 (don't think it is the point)
Let's declare two properties
my:
properties:
with-dashes: 1
withoutDashes: 2
As documented, we can override properties values by sing environment. This part work well.
The problem is with actuator endpoint /actuator/env and /actuator/env/{toMatch}.
When I run my code with following environment variables MY_PROPERTIES_WITHDASHES=666 and MY_PROPERTIES_WITHOUTDASHES=777, on actuator I observe that without dashes, the endpoint /actuaor/env/my.properties.withoutDashes displays all sources of value, even the computed value
The value displayed contains neither the real value used by application (I exposed it with a controller which returns 666as expected) nor the reference of the environment variable.
The reference to the environment variable can be seen by requesting
/actuator/env/my.properties.withdashes (remove the dash)
This behaviour can be quite troublesome, as it may lead to a misunderstanding of the real behaviour of an application. I can try to provide a fix if you confirm the unwilling behaviour.
The env endpoint here is actually working as designed and providing details about what values are returned when you make a call to Environment.getValue or use the @Value annotation.
The "Binding From Environment Variables" section is talking exclusively about @ConfigurationProperties binding, where additional logic is implemented to deal with the various different formats we support.
If you want to find out about what's actually been bound, the configprops endpoint is a better choice.
If you update the sample to expose the configprops endpoint and also set management.endpoint.configprops.show-values to always you can open http://localhost:8080/actuator/configprops/my.properties to see what is actually bound.
Your sample did highlight one problem: we're not currently displaying wrapper types correctly. I've opened #36076 to fix that.
Version: springboot: 3.1 (don't think it is the point)
Let's declare two properties
As documented, we can override properties values by sing environment. This part work well.
The problem is with actuator endpoint
/actuator/env
and/actuator/env/{toMatch}
.When I run my code with following environment variables
MY_PROPERTIES_WITHDASHES=666
andMY_PROPERTIES_WITHOUTDASHES=777
, on actuator I observe that without dashes, the endpoint/actuaor/env/my.properties.withoutDashes
displays all sources of value, even the computed valueHowever, with the dashed property, I have
/actuator/env/my.properties.with-dashes
The value displayed contains neither the real value used by application (I exposed it with a controller which returns
666
as expected) nor the reference of the environment variable.The reference to the environment variable can be seen by requesting
/actuator/env/my.properties.withdashes
(remove the dash)This behaviour can be quite troublesome, as it may lead to a misunderstanding of the real behaviour of an application. I can try to provide a fix if you confirm the unwilling behaviour.
I provided a sample project to display the behaviour.
The text was updated successfully, but these errors were encountered: