In our project we created a starter which contains most general stuff, like database, feign clients and so on. Now we want to configure this starter with different properties per stage. Currently we created a file "application-commons.yaml" in our starter and include this "profile" at spring.profiles.active, but this does not really scale well if we create more starters, or more applications. We would have to keep in mind to add all the profiles to all the services.

With this PR we are able to implement an AdditionalProfileLoader, which returns the name of the starters "profile", and then add the class to the spring.factories: org.springframework.core.io.support.AdditionalProfileLoader=com.example.AdditionalCommonProfile

This PR relates to https://github.com/spring-projects/spring-boot/pull/25033 which adds the ability to load additional files like commons.yaml, commons-local.yaml and so on.

Comment From: pivotal-issuemaster

@kevinraddatz Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-issuemaster

@kevinraddatz Thank you for signing the Contributor License Agreement!

Comment From: philwebb

I think this change is too invasive for Spring Framework which should not really be aware of Spring Boot concerns. We already have code in Spring Boot to apply profiles to the Environment. I think it makes more sense for any additional profile logic to but put there.