Springboot 指定profile配置文件

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

注意:-Dspring.profiles.active=test的位置。

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

发布了20 篇原创文章 · 获赞 1 · 访问量 3976

猜你喜欢

转载自blog.csdn.net/haxyek/article/details/85764607
今日推荐