美文网首页
spring-boot启动时,指定spring.profiles

spring-boot启动时,指定spring.profiles

作者: 白沙forever | 来源:发表于2019-03-26 18:31 被阅读0次

    Maven启动指定Profile通过-P,如mvn spring-boot:run -Ptest,但这是Maven的Profile。

    如果要指定spring-boot的spring.profiles.active,spring-boot 1.x 使用mvn spring-boot:run -Drun.profiles=test,spring-boot 2.x 使用mvn spring-boot:run -Dspring-boot.run.profiles=test。参考资料:https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/maven-plugin/examples/run-profiles.html

    如果使用命令行直接运行jar文件,则使用java -jar -Dspring.profiles.active=test demo-0.0.1-SNAPSHOT.jar

    如果使用开发工具,运行Application.java文件启动,
    则增加参数--spring.profiles.active=test

    相关文章

      网友评论

          本文标题:spring-boot启动时,指定spring.profiles

          本文链接:https://www.haomeiwen.com/subject/yymnvqtx.html