久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

SpringBoot 多Profile使用與切換方式

瀏覽:3日期:2023-03-18 18:15:47

SpringProfile對不同環境提供不同配置功能的支持,可以通過激活、指定參數等方式快速切換環境。

文件名格式:application-{profile}.properties可以建立多個properties(yaml)文件來不斷的切換

application-dev.properties

server.port=8082

application-prod.properties

server.port=8083

application.properties

server.port=8081spring.profiles.active=dev

SpringBoot 多Profile使用與切換方式

文件名格式:application-{profile}.yaml

server: port: 8082spring: profiles: active: dev---spring: profiles: devserver: port: 8083---spring: profiles: prodserver: port: 8084---spring: profiles: default (未指定時默認使用的配置)server: port: 80激活方式:

yaml中:spring: profiles: active: dev 或properties中:spring.profiles.active=dev運行時:

在打包后運行的時候,添加參數:

java -jar spring-boot.jar --spring.profiles.active=dev;

tomcat 中 catalina.bat(.sh中不用“set”) 添加JAVA_OPS。通過設置active選擇不同配置文件:set JAVA_OPTS='-Dspring.profiles.active=test'

web.xml方式

spring.profiles.active prod標注方式(junit單元測試非常實用)@ActiveProfiles({“dev”})

到此這篇關于SpringBoot 多Profile使用與切換方式的文章就介紹到這了,更多相關SpringBoot 多Profile使用與切換內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Spring
相關文章:
主站蜘蛛池模板: 徐州市| 宣化县| 临夏市| 松溪县| 天祝| 吐鲁番市| 石家庄市| 南安市| 昌乐县| 新郑市| 烟台市| 塔河县| 蛟河市| 布拖县| 菏泽市| 滦平县| 兴业县| 天镇县| 郸城县| 吉木乃县| 廉江市| 平谷区| 信宜市| 山丹县| 大城县| 吕梁市| 望江县| 冷水江市| 教育| 张家口市| 林口县| 黄冈市| 蕉岭县| 新田县| 龙门县| 镇江市| 蛟河市| 元阳县| 江永县| 宁晋县| 革吉县|