SpringBoot--Profile
来源:互联网 发布:ubuntu 网络设置 编辑:程序博客网 时间:2024/06/05 05:07
1 针对不同的环境,SpringBoot提供了全局Profile配置,在application.properties中指定当前使用的配置文件。如下例子:
开发环境:
application-dev.properties:
server.port=8080
线上环境:
server.port=80
第一次在application.properties中指定开发环境:
spring.profiles.active=dev
执行结果:
第二次配置生成环境,在application.properties中指定开发环境:
spring.profiles.active=prod
结论:在application.properties中指定当前配置文件,系统会去寻找指定的配置文件:application-dev.properties和application-prod.properties
2 官方文件中提到在配置类的上面添加@Profile注解来指定在application.properties中配置spring.profiles.active的值,
如:
配置类
@Configuration@Profile("production")public class ProductionConfiguration {// ...}
application.properties:
spring.profiles.active=production
阅读全文
0 0
- SpringBoot--Profile
- springboot 多profile配置
- SpringBoot之开启Profile
- Springboot学习记录4------profile
- Gradle中给SpringBoot指定active profile
- springboot 读取maven profile 变量 通配符
- 19-SpringBoot——核心-Profile配置
- SpringBoot学习笔记之profile使用
- springboot + profile(不同环境读取不同配置)
- 第十四章 springboot + profile(不同环境读取不同配置)
- SpringBoot14-springboot核心-外部配置,日志配置,Profile配置
- springboot + profile(不同环境读取不同配置)
- SpringBoot使用profile配置不同环境配置生效
- SpringBoot构建微服务实战 之 Profile决策
- springboot 配合 profile 多环境自动切换配置文件
- profile
- profile
- profile
- eclipse转AS方法2——新目录结构
- 操作符简单剖析
- (十)、Java复习笔记之多线程(1)
- android AES对称加密算法使用实例
- HDU
- SpringBoot--Profile
- spring boot 项目三种启动方式
- 电路实验
- 控制C#中textbox输入文本的格式
- 从零开始学习c++之初识指针和引用
- Java线程学习笔记(一)
- 2017/11/20
- C++PrimerPlus第一章学习随笔
- Oracle监听文件路径