使用@ConfigurationProperties注解 提示 “Spring Boot Configuration Annotation Processor not found in classpath ”

解决方案:

在 pom.xml 添加依赖

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

添加后,提示就没有了,假设你添加 spring-boot-configuration-processor 依赖 出现了这个提示

因为依赖没放版本这个选项,所以它默认是最新的版本,把版本降低一下,依赖就可以下载了。

        <!-- 配置文件自动映射 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <version>2.1.6.RELEASE</version>
            <optional>true</optional>
        </dependency>

最后记得 Build 一下项目。

猜你喜欢

转载自www.cnblogs.com/oukele/p/11390382.html
今日推荐