使用@EnableConfigurationProperties注解
作用:让使用@ConfigurationProperties 注解的类生效。
说明:
如果一个配置类只配置@ConfigurationProperties注解,而没有使用@Component,那么在IOC容器中是获取不到properties 配置文件转化的bean。说白了 @EnableConfigurationProperties 相当于把使用 @ConfigurationProperties 的类进行了一次注入。
作者:咪雅先森
链接:https://www.jianshu.com/p/7f54da1cb2eb
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
============================================================
@ConfigurationProperties了解:https://www.cnblogs.com/dream-flying/articles/12952124.html

浙公网安备 33010602011771号