spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.81k stars 40.6k forks source link

Property files are listed two times when calling */actuator/env #41578

Closed filmor732 closed 2 months ago

filmor732 commented 2 months ago

Hello everyone, I´am using spring boot 3.2.3 and I have a problem when using the spring actuator. When I call the endpoint .../actuator/env there are certain property files that are listed exactly twice but in different variants:

Once with this structure: { “name": ”applicationConfig: [classpath:/bootstrap.properties]”, “properties": { “spring.application.name": { “value": ‘Example’, “origin": ”class path resource [bootstrap.properties] from application.jar - 2:25” } } }

And another time in this structure: { “name“: ‘Config resource ’class path resource [bootstrap.properties]‘ via location ’optional:classpath:/'”, “properties": { “spring.application.name": { “value": ‘Example’, “origin": ”class path resource [bootstrap.properties] from application.jar - 2:25” }}}

I want to remove or hide this one: “name": ”applicationConfig: [classpath:/bootstrap.properties] (first variant) I have read this documentation, but have not found a suitable configuration that can manage this case: https://docs.spring.io/spring-boot/reference/actuator/index.html. Likewise, I have not yet discovered a comparable question here in the community.

I would therefore like to ask for your help and support. Did any of you see this case before and can somebody help me with that issue? Is there perhaps a configuration that I have overlooked?

wilkinsona commented 2 months ago

The env endpoint should provide an accurate reflection of your application's environment. In other words, if bootstrap.properties is listed twice by the env endpoint, I think that means that it has be processed twice. It's this, I think, that should be addressed, rather than trying to hide the problem through some filtering of the endpoint's response.

bootstrap.properties is a Spring Cloud feature so it may be that this should be addressed in Spring Cloud. You mention that it affects "certain property files". Have you seen it affect files other than bootstrap.properties?

If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

filmor732 commented 2 months ago

Thank you for your answer and advice @wilkinsona!

I think that means that it has be processed twice. It's this, I think, that should be addressed, rather than trying to hide the problem through some filtering of the endpoint's response.

Yes, you're right. I was thinking the wrong way round here. I should rather find out why the files are processed twice and whether it is necessary or unnecessary.

You mention that it affects "certain property files". Have you seen it affect files other than bootstrap.properties?

Yes, it affects also the application.properties file.

Okay, I will try to provide an example and keep you up to date.

spring-projects-issues commented 2 months ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues commented 2 months ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.