How to set Spring profile from system variable?

前端 未结 7 1561
无人共我
无人共我 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:58

    If i run the command line : java -Dspring.profiles.active=development -jar yourApplication.jar from my webapplication directory it states that the path is incorrect. So i just defined the profile in manualy in the application.properties file like this :

    spring.profiles.active=mysql 
    

    or

    spring.profiles.active=postgres
    

    or

    spring.profiles.active=mongodb
    

提交回复
热议问题