ConfigurationProperties extends
时间: 2023-10-17 10:37:53 浏览: 40
ConfigurationProperties是一个Spring框架中的注解,用于将配置文件中的属性值绑定到Java对象中。它是通过在Java类上加上@ConfigurationProperties注解来实现的。这个注解可以用于类级别和字段级别。
类级别的@ConfigurationProperties注解会将配置文件中的属性值绑定到整个类中的字段上。字段级别的@ConfigurationProperties注解会将配置文件中的属性值绑定到指定的字段上。
@ConfigurationProperties注解可以与@EnableConfigurationProperties注解一同使用,以启用配置属性的绑定。@EnableConfigurationProperties注解可以用在类上,用于告诉Spring框架要对哪些配置属性进行绑定。
引用提到了两个与@ConfigurationProperties相关的类:ConfigurationPropertiesBeanRegistrar和ConfigurationPropertiesBindingPostProcessorRegistrar。其中,ConfigurationPropertiesBeanRegistrar用于将标注了@ConfigurationProperties的类注册为Spring Bean,而ConfigurationPropertiesBindingPostProcessorRegistrar用于实现属性绑定的功能。
引用中提到了@ConfigurationPropertiesBindingPostProcessorRegistrar主要的逻辑是获取标注了@EnableConfigurationProperties的类上的value属性,然后根据value属性的值来决定是否导入ConfigurationPropertiesBeanRegistrar。如果value属性为空,则只导入ConfigurationPropertiesBindingPostProcessorRegistrar,否则同时导入ConfigurationPropertiesBindingPostProcessorRegistrar和ConfigurationPropertiesBeanRegistrar。
引用给出了@EnableConfigurationProperties注解的定义。它是一个用来注册@ConfigurationProperties注解的快捷方式,可以方便地将带有@ConfigurationProperties注解的类注册为Spring Bean。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [springboot之@ConfigurationProperties分析](https://blog.csdn.net/wang0907/article/details/118241369)[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_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [ConfigurationProperties和EnableConfigurationProperties](https://blog.csdn.net/xxssyyyyssxx/article/details/124804098)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)