夢のの*_*のの夢 8 spring intellij-idea annotation-processing spring-boot
在 IntelliJ 上,我得到了一个Spring Boot 配置注释处理器,该处理器未配置为具有 @ConfigurationProperties。下面是我的课:
@Configuration
@ConfigurationProperties(prefix = "abc")
@Data
@RefreshScope
class Config {
String propA;
String propB;
...
}
Run Code Online (Sandbox Code Playgroud)
我不确定是什么原因造成的,当我单击扳手进行设置时,我没有看到任何用于配置元数据文件的选项。
Iva*_*van 10
我遇到了同样的问题IntelliJ IDEA 2020.2和Maven 3.6.2。解决方案是在maven-compiler-plugin设置中显式设置注释处理器。我在这里找到了答案:
完整配置:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>2.4.2</version>
<optional>true</optional>
</dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<annotationProcessorPaths>
<path>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>2.4.2</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我通过将以下依赖项添加到我的 pom 文件中解决了这个问题
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>2.2.6.RELEASE</version>
<optional>true</optional>
</dependency>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6564 次 |
| 最近记录: |