环境概念
- test 本地开发环境
- sit 测试环境
- pre 预生产环境
- prd 生产环境
设置
application.yml 为默认的配置文件
application-prd.yml 为生产环境配置文件
通过改默认配置文件的读取方式,就可以切换环境,无需改动代码
1 | srping: |
实例:
1 | @Controller |
读取配置文件里面为test的值
application.yml 为默认的配置文件
application-prd.yml 为生产环境配置文件
通过改默认配置文件的读取方式,就可以切换环境,无需改动代码
1 | srping: |
实例:
1 | @Controller |
读取配置文件里面为test的值
原文作者:keacwu
原文链接:http://www.loongten.com/2019/07/29/SpringBoot-profiles/
发表日期:July 29th 2019, 2:41:15 pm
更新日期:July 29th 2019, 2:48:07 pm
版权声明:本文采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可