1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Maven中的profile和spring boot中的profile进行结合

Maven中的profile和spring boot中的profile进行结合

时间:2019-05-15 18:32:13

相关推荐

Maven中的profile和spring boot中的profile进行结合

独角兽企业重金招聘Python工程师标准>>>

有一些应用,采用了spring boot和spring boot profile。然后想把maven 中的profile和spring boot中的profile 进行一个集成。比如我在idea中修改mvn的profile,就可以修改整个项目的spring boot中的profile。

<profiles><!-- 默认激活 dev 开发环境 --><!-- 线上使用 mvn 打包添加 -Pproduction 变量 --><profile><!-- 本地开发环境 --><id>development</id><properties><profiles.active>development</profiles.active><properties.version>2.0-SNAPSHOT</properties.version></properties></profile><profile><!-- 本地开发环境 --><id>test</id><properties><profiles.active>test</profiles.active><properties.version>test-SNAPSHOT</properties.version></properties><activation><activeByDefault>true</activeByDefault></activation></profile><profile><!-- 生产环境 --><id>production</id><properties><profiles.active>production</profiles.active><properties.version>production-SNAPSHOT</properties.version></properties></profile></profiles>

在yml中使用

spring:profiles:active: @profilesActive@

还有一个很关键的地方需要注意,这样才能替换

<resources><resource><directory>src/main/resources</directory></resource><resource><directory>${basedir}/src/main/resources</directory><filtering>true</filtering><includes><include>**/application.yml</include><include>**/application.yaml</include><include>**/application.properties</include></includes></resource></resources>

Spring boot 使用profile完成不同环境的maven打包功能

springboot maven 多环境配置

Spring Boot Profile 与Maven Profile 集成实践

[Spring Boot 系列] 集成maven和Spring boot的profile功能

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。