Spring Tool Suite 中的项目报告“无法加载注释处理器工厂”

问题描述 投票:0回答:3

我在 Spring Tool Suite 中的项目报告无法“为项目 XXX 加载注释处理器工厂‘org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor’”,我的项目运行良好,但我不想看到这个错误。我做了很多搜索,但我找不到任何结果。 非常感谢。

java spring spring-tool-suite
3个回答
36
投票

删除项目根目录下的

.factory
文件


2
投票

需要在项目中添加spring boot配置处理器;使用 Maven 时添加此依赖项:

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

您可以在 spring boot 文档中找到更多信息


0
投票

我正在使用 Eclipse,而不是 Spring Tools Suite,但也许这仍然有用..

Eclipse 将以下内容报告为 APT 问题:

无法加载注释处理器工厂'/path/to/gradle/cache/org.springframework.boot/spring-boot-configuration-processor/2.4.4/12575686ba3820571ea79bfd08d6d27534b97a0e/spring-boot-configuration-processor-2.4.4.jar ' 对于项目 ...

错误消息中注解处理器工厂的版本来自旧版本的 Spring Boot。该项目已迁移。

我打开项目属性

Java Compiler -> Annotation Processing -> Factory Path
并从列表中删除旧的 spring-boot-configuration-processor jar,错误消失了。正确的罐子已经在那里了。

© www.soinside.com 2019 - 2024. All rights reserved.