@ConfigurationProperties使用

要想使用该注解自动生成bean,有两种方式

1.

@EnableConfigurationProperties注解应用到你的@Configuration时, 任何被@ConfigurationProperties注解的beans将自动被Environment属性配置
EnableConfigurationProperties里面填写被ConfigurationProperties修饰的类。
 
2.
@ConfigurationProperties与@component联合使用
 
 

posted @ 2021-04-07 14:05  愿-世界-和平  阅读(74)  评论(0)    收藏  举报