1.类型安全属性注入

Spring boot基础配置2

2.YAML配置

YAML 配置(*.yml\*.yaml)与 properties

1. YAML 配置是有序的,properties 配置是无序的
2. 自定义的 YAML 目前暂时不支持使用注解直接注入到 Spring Boot 项目中

在Spring Cloud里用的多

Spring boot基础配置2

Spring boot基础配置2

Spring boot基础配置2

3.profile配置

多个配置文件如dev版本、prod版本(测试、使用版本不同)

在默认配置文件加一句spring.profile.active=dev就可以切换

相关文章: