How to set Spring profile from system variable?

前端 未结 7 1558
无人共我
无人共我 2020-12-07 18:12

I have a Spring project which uses another project. Each project has its own spring profile initialize from java code using applicationContext.xml and *.p

7条回答
  •  生来不讨喜
    2020-12-07 18:43

    My solution is to set the environment variable as spring.profiles.active=development. So that all applications running in that machine will refer the variable and start the application. The order in which spring loads a properties as follows

    application.properties
    system properties
    environment variable
    

提交回复
热议问题