springboot --spring.profiles.active=test 不生效
在springboot项目中,运行jar包时使用 java -jar xxx.jar --spring.profiles.active=test ,但是并没有走bootstrap-test.yml文件。而使用java -jar -Dspring.profiles.active=test xxx.jar 是可以走bootstrap-test.yml文件的。
原因是在启动类里的run方法没有把args参数加上。
public static void main(final String[] args) {
原创
2022-03-03 20:09:29 ·
3621 阅读 ·
0 评论