1.美图
2.概述
Spring Boot支持多种外部配置方式
这些方式优先级如下:
https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-external-config
命令行参数
- 来来java:comp/env的JNDI属性
- Java系统属性( System.getProperties() )
- 操作系统环境变量
- RandomValuePropertySource配置的random. *属性值
- jar包外部的
application-{profile}.properties
或application.yml(带spring.profile)配置文件 - jar包内部的
application-{profile}.properties
或application.yml(带spring.profile)配置文件 - jar包外部的
application.properties
或application.yml(不带spring.profile)配置文件 - jar包内部的
application.properties
或application.yml(不带spring.profile)配置文件 - @Configuration注解类 上的@PropertySource
- 通过SpringApplication.setDefaultProperties指定的默认属性