maven profiles or spring profiles?

后端 未结 5 1413
野趣味
野趣味 2020-12-23 10:14

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

5条回答
  •  盖世英雄少女心
    2020-12-23 10:31

    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.

提交回复
热议问题