没有处理器声明这些注释



从java 8升级到java 11,出现以下注释警告。请建议如何解决。

[WARNING] No processor claimed any of these annotations: 
/org.springframework.context.annotation.Primary,
/org.springframework.data.annotation.Id,
/org.springframework.context.annotation.ComponentScan,
/org.springframework.boot.autoconfigure.SpringBootApplication,
/org.springframework.boot.context.properties.ConfigurationProperties,
/org.springframework.data.mongodb.repository.Query,
/com.fasterxml.jackson.annotation.JsonInclude,
/javax.validation.constraints.NotNull,
/org.springframework.context.annotation.ImportResource,
/org.springframework.web.bind.annotation.DeleteMapping,
/org.springframework.web.bind.annotation.PostMapping

javac过滤器有许多非常异常的警告,您无法单独关闭它们。这是其中之一。我建议使用不同的过滤器。

你不能关闭这个特定的警告,你只能关闭所有标记为-processing-Xlint的注释处理器警告,例如

-Xlint:all,-serial,-processing

在Maven:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<showWarnings>true</showWarnings>
<compilerArgs>
<!-- We turn off:
- `serial` because we don't use Java serialization 
(and all it does is stupidly complain about the serialVersionUID)
- `processing` because it complains about every annotation
-->
<arg>-Xlint:all,-serial,-processing</arg>
</compilerArgs>
</configuration>
</plugin>

您可以通过搜索"warn.proc"查看所有将被禁用的警告。在compiler.properties。您可以看到javac --help-lint的所有linter选项。

最新更新