IDEA使用注解@ConfigurationProperties时报错解决

使用注解@ConfigurationProperties报错

使用@ConfigurationProperties注解,以前用的挺好没出现问题,换了IDEA的版本使用,发现报错了,具体报错如下:

Spring Boot Configuration Annotation Processor not found in classpath

解决方式:
添加依赖
在这里插入图片描述

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-configuration-processor</artifactId>
	<optional>true</optional>
</dependency>

导入依赖之后,发现依然报错:
在这里插入图片描述

解决方式:
在这里插入图片描述

在配置类上,加上注解@EnableConfigurationProperties(CorsProperties.class)即可!
各位有问题留言,我会尽力为大家解决。