1、springboot项目中配置内容
=@profileActive@
2、创建不同环境下的配置文件
、、
3、pom文件中配置profiles节点
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profileActive>dev</profileActive>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<profileActive>test</profileActive>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<profileActive>prod</profileActive>
</properties>
</profile>
</profiles>
4、通过maven打包命令即可打出不同环境下的程序包
打生产环境包
mvn clean package -P prod -U
打测试环境包
mvn clean package -P test -U
打开发环境包
mvn clean package -P dev -U