springboot run启动时指定spring.profiles.active的示例分析(springboot,开发技术)

时间:2024-05-07 03:58:09 作者 : 石家庄SEO 分类 : 开发技术
  • TAG :

    springboot+run%E5%90%AF%E5%8A%A8%E6%97%B6%E6%8C%87%E5%AE%9Aspring.profiles.active%E7%9A%84%E7%A4%BA%E4%BE%8B%E5%88%86%E6%9E%90

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。

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

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

本文:springboot run启动时指定spring.profiles.active的示例分析的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:Linux常用的命令有哪些下一篇:

6 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18