'How to append multiple values under the same property key?

I have multiple projects that expose a Prometheus endpoint, like so:
Application1: management.endpoints.web.exposure.include=info,health,prometheus
Application2: management.endpoints.web.exposure.include=info,metrics,prometheus
Application3: management.endpoints.web.exposure.include=info,refresh,prometheus

Instead of adding this Prometheus config to each application separately, I have extracted this to a separate library and added it as a dependency. The lib's application.properties file only consists management.endpoints.web.exposure.include=prometheus.

Whenvever I start up my applications, all of their config is overwritten with prometheus, instead of the value being added to the back of the list.

Is it possible to append multiple values to the same key instead of it being overwritten?



Solution 1:[1]

Sounds like you need to use profiles feature. Profiles means that you can run the same project with different profiles where each profile can have its own property files and even different bean implementations per profile. Read this article about profiles and see if that will help: Spring Profiles

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Michael Gantman