user1048378
user1048378

Reputation: 305

spring boot /env endpoint showing unexpected values

I am using spring boot 1.5.2.RELEASE and using consul to manage environment variables/application properties. I am seeing the following behavior and was wondering if it was by design and if there was any way to change it.

I start up an application w/ e.g the following properties:

arbitrary.property: foo
datasource.url: some-valid-url

when I hit the /env endpoint I see those values and can verify they are what the application is using. I then update the properties in consul to this:

arbitrary.property: bar
datasource.url: another-valid-url

when I query the /env endpoint I see both properties updated in the /env endpoint response. I can verify the arbitrary.property is indeed the "foo" value the app is using. The app however continues to use the original "some-valid-url" value for it's db connection even though the /env endpoint shows "another-valid-url".

We don't really have a use-case to update datasource's dynamically, but I would like the /env endpoint to always display the value(s) being used. Is there some way to ensure that the /env endpoint always display this (besides disabling dynamic property/application-context updates)? is this by design?

Upvotes: 0

Views: 262

Answers (1)

Andy Wilkinson
Andy Wilkinson

Reputation: 116171

This is by design. The env endpoint is intended to show you an up-to-date view of the application's Environment. It has no knowledge of how, if at all, any of those values are being used.

Upvotes: 1

Related Questions