Spring :读取配置文件(.properties、.yam)相关注解
1.美图
2.概述
读取配置文件相关的注解,就是用来帮助我们获取到配置文件.properties、.yam
里面信息的。
读取配置文件相关注解 | 解释 |
---|---|
@EnableConfigurationProperties | 让使用@ConfigurationProperties注解的类生效 |
@ConfigurationProperties | 读取配置文件的信息,并自动封装成实体类 |
@PropertySource | 指定的属性文件(只能加载*.properties文件,不能加载yaml文件)映射到对象 |
@ImportResource | 导入Spring的*.xml配置文件,让xml配置文件里面的内容生效 |