Spring Boot 2.7.2

I defined a library with an auto configuration that uses @PropertySource to define some defaults for the actuator endpoints

management.endpoints.web.include=health,info,metrics,prometheus

When the app that depends in that library runs expanded (Intellij play button) the actuator shows metrics and prometheus endpoints, when the app is packed or is executed using spring boot plugin the configuration does not apply and only shows info and health.

When I use an application listener in the library and set up the value using default properties it works, but I do not want to use this method, other libraries or the app could override the defaults and there is only one map for the defaults property in the application context.

It seems there is a problem setting the defaults or the order of execution is quite different when the application runs from a jar file or when the app class path is set up by Intellij.

I tried to add the @PropertySource in an @AutoConfiguration and a @ManagementContextConfiguration, I tried the change the @Order value with no luck at all.

Comment From: snicoll

In general we do not recommend to use @PropertySource, especially when values have an incidence on auto-configuration. I am going to close this as a duplicate of #24688 that has more details.

Comment From: victorherraiz-santander

@snicoll thank you so much for the quick reply, I'll take a look at #24688