Spring Boot配置加载顺序
来源:互联网 发布:算法基础 pdf 下载 编辑:程序博客网 时间:2024/05/17 17:42
如果加载的配置有重复的,它们的加载顺序是这样的,数字越小的优先级越高,即优先级高的覆盖优先级低的配置。
- Devtools global settings properties on your home directory (~/.spring-boot-devtools.properties when devtools is active).
- @TestPropertySource annotations on your tests.
- @SpringBootTest#properties annotation attribute on your tests.
- Command line arguments.
- Properties from SPRING_APPLICATION_JSON (inline JSON embedded in an environment variable or system property)
- ServletConfig init parameters.
- ServletContext init parameters.
- JNDI attributes from java:comp/env.
- Java System properties (System.getProperties()).
- OS environment variables.
- A RandomValuePropertySource that only has properties in random.*.
- Profile-specific application properties outside of your packaged jar (application-{profile}.properties and YAML variants)
- Profile-specific application properties packaged inside your jar (application-{profile}.properties and YAML variants)
- Application properties outside of your packaged jar (application.properties and YAML variants).
- Application properties packaged inside your jar (application.properties and YAML variants).
- @PropertySource annotations on your @Configuration classes.
- Default properties (specified using SpringApplication.setDefaultProperties).
知道了它们的加载顺序,我们就能知道从哪一步来替换配置。
推荐阅读
分享一套高级视频教程:Dubbo+Zookeeper+ActiveMQ+Redis系列
分享一套分布式架构设计高级视频教程
分享一套Hadoop全套视频教程系列
去BAT面试完的Mysql面试题总结(55道,带完整答案)
阿里高级Java面试题(首发,70道,带详细答案)
2017派卧底去阿里、京东、美团、滴滴带回来的面试题及答案
Spring面试题(70道,史上最全)
通往大神之路,百度Java面试题前200页。
分享Java干货,高并发编程,热门技术教程,微服务及分布式技术,架构设计,区块链技术,人工智能,大数据,Java面试题,以及前沿热门资讯等。
阅读全文
0 0
- Spring Boot 配置加载顺序
- Spring Boot配置加载顺序
- Spring Boot 配置文件加载顺序
- Spring Boot 配置优先级顺序
- Spring Boot 配置优先级顺序
- Spring Boot 配置优先级顺序
- Spring Boot 配置优先级顺序
- Spring Boot 资源加载配置
- 警告 spring boot 加载beans的顺序
- (二)Spring-boot 配置文件加载顺序
- spring boot 使用属性加载顺序
- Spring+SpringMVC配置加载顺序
- spring boot加载自定义配置源
- spring-boot 热加载
- Spring Boot 动态加载
- Spring boot 热加载
- spring boot 热加载
- Spring Boot加载配置文件
- 高级教程分享:Dubbo+Zookeeper+ActiveMQ+Redis等。
- 智能蛇
- jq进行table动态增删上下移动
- 5分钟带你理解一致性Hash算法。
- Spring Boot集成Mybatis双数据源
- Spring Boot配置加载顺序
- 剑指offer-36-数组中的逆序对
- Spring Boot配置随机数
- HashMap 源码解析
- 分布式服务防雪崩熔断器,Hystrix理论+实战。
- GitHub上11月份最热门的Java项目
- Mycat
- 服务高可用:幂等性设计
- leetcode 639. Decode Ways II 动态规划DP