Spring :读取配置文件(.properties、.yam)相关注解

1.美图

2.概述

读取配置文件相关的注解,就是用来帮助我们获取到配置文件.properties、.yam里面信息的。

读取配置文件相关注解 解释
@EnableConfigurationProperties 让使用@ConfigurationProperties注解的类生效
@ConfigurationProperties 读取配置文件的信息,并自动封装成实体类
@PropertySource 指定的属性文件(只能加载*.properties文件,不能加载yaml文件)映射到对象
@ImportResource 导入Spring的*.xml配置文件,让xml配置文件里面的内容生效
# 3.@EnableConfigurationProperties 参考:[Spring : @EnableConfigurationProperties注解](https://blog.csdn.net/qq_21383435/article/details/104046543)

4.@ConfigurationProperties

参考:SpringBoot:@ConfigurationProperties注解使用与源码

你可能感兴趣的:(框架-spring,boot)