现在开发有线上版本和开发版本,所以多个配置文件是挺有意义的,所以总结了一下,我们现在使用的总结
我查了一下网上都是在yml文件和pom文件中做修改,比如如下pom.xml文件加了如下
<profiles>
<profile>
<id>dev</id>
<activation>
<!--默认激活-->
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
</profile>
</profiles>
我们现在做以下操作,上述内容不需要操作!
我们现在的系统直接在IDE中配置中加,比如在idea中,我们添加如下
即调用的是application-test.yml文件,如果是其他的就写其他的
如果把项目打包放到Linux中启动的话,只需要以下命令即可启动
nohup java admin-web.jar --spring.profiles.active=test
然后查看进程是否已经存在
ps aux | grep -i admin-web.jar
这样就挂起了