这篇文章将为大家详细讲解有关使用spring boot实现profiles动态切换,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
具体做法:
1、首先在pom中添加profiles:
<profiles> <profile> <id>dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <spring.profiles.active>dev</spring.profiles.active> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-undertow</artifactId> </dependency> </dependencies> </profile> <profile> <id>prod</id> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-undertow</artifactId> </dependency> </dependencies> <properties> <spring.profiles.active>prod</spring.profiles.active> </properties> </profile> </profiles>
新闻名称:使用springboot实现profiles动态切换-创新互联
URL链接:https://www.cdcxhl.com/article46/dhcoeg.html
成都网站建设公司_创新互联,为您提供品牌网站设计、云服务器、网站维护、商城网站、网站设计公司、营销型网站建设
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联