@EnableConfigurationProperties
时间: 2023-10-21 16:36:46 浏览: 73
@EnableConfigurationProperties is a Spring annotation that is used to enable the automatic binding of external properties to a bean's properties. It is commonly used in Spring Boot applications to simplify the configuration of properties by allowing them to be defined in an external configuration file, such as application.properties or application.yml.
When applied to a configuration class, @EnableConfigurationProperties tells Spring to create and inject beans that are annotated with @ConfigurationProperties. These beans are automatically configured with values from the external configuration files, allowing developers to easily access and use these properties within their application.
This annotation is typically placed on the main application class or a configuration class, and it is often used in conjunction with other annotations such as @Configuration and @Component.
阅读全文