4.SpringBoot[Spring Boot Configuration Annotation Processor not found in classpath]解决方案

问题描述

使用Spring Boot开发的过程中,写读取Properties配置文件的配置类时提示Spring Boot configuration annotation processor not found in classpath,如下图所示

在这里插入图片描述

问题分析

  • 出现spring boot Configuration Annotation Proessor not found in classpath的提示是在用了@ConfigurationProperties这个注解时,所以问题出现在ConfigurationProperties注解

  • 根据提示的not found in classpath,查询此注解的使用关于怎么指定classpath,进而查询location,spring boot1.5以上版本@ConfigurationProperties取消location注解

解决方案

官方解决方案,Maven引入依赖

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

おすすめ

転載: blog.csdn.net/weixin_43980975/article/details/115307998