@EnableConfigurationProperties失效
时间: 2023-10-12 07:06:37 浏览: 158
@EnableConfigurationProperties注解失效的原因可能是因为缺少@ConfigurationPropertiesScan注解。在使用@EnableConfigurationProperties注解时,需要在应用程序的主类(通常是带有@SpringBootApplication注解的类)上添加@ConfigurationPropertiesScan注解,以便扫描和加载配置类。如果没有添加@ConfigurationPropertiesScan注解,@EnableConfigurationProperties注解将无效,并且配置项无法正确加载。因此,要解决@EnableConfigurationProperties失效的问题,需要在主类上添加@ConfigurationPropertiesScan注解。这样就可以正确调用和加载配置项了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [使用@EnableConfigurationProperties注解,注意配置,避免失效](https://blog.csdn.net/weixin_42792301/article/details/105437035)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [SpringBoot中@EnableConfigurationProperties失效](https://blog.csdn.net/taxusw/article/details/127377649)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文