a lot java applications are build with maven. maven has Profiles concept, it is really handy to build release package for different environments. e.g. dev/test/prod
I happened to use properties-maven-plugin to set a system property depending on which maven profile was activated. Then in Spring, I was activating programmatically the profile(s) that I wanted, depending on that system property :
String activeProfile = System.getProperty("myapp.profile");
appContext.getEnvironment().setActiveProfiles(....)
Moreover, when I wanted to link directly the two kinds of profile (maven/spring), I was setting the spring.profiles.active property via the maven plugin.
Thoses practices are possibly wrong in the design but they solved my issues.