Not registered via @EnableConfigurationProperties, marked as Spring component, or scanned via @ConfigurationPropertiesScan
今天编写配置类时,发现@ConfigurationProperties(prefix = "spring.task.execution")
注解显示报红。
1.添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
2.加上@Component
注解,将组件(配置元数据类)添加到spring容器中;
解决问题