配置文件

将 Spring 里的复杂的 xml 文件替代了

约定大于配置 CoC(Convention over Configuration) 。只需要配置不同配置的部分就好

单个注入 @Value

注入属性值:

Alt text

yaml配置文件一样

批量注入 @ConfigurationProperties

@Component 交给IOC容器

@ConfigurationProperties(prefix="aliyun.oss") 注入配置,前缀

Alt text

读取配置文件

在SpringBoot中已封装

@Value