1. 程式人生 > >spring-boot:run啟動時,指定spring.profiles.active

spring-boot:run啟動時,指定spring.profiles.active

Maven啟動指定Profile通過-P,如mvn spring-boot:run -Ptest,但這是Maven的Profile。

如果要指定spring-boot的spring.profiles.active,則必須使用mvn spring-boot:run -Drun.profiles=test

如果使用命令列直接執行jar檔案,則使用java -jar -Dspring.profiles.active=test demo-0.0.1-SNAPSHOT.jar

如果使用開發工具,執行Application.java檔案啟動,則增加引數--spring.profiles.active=test