Ale*_*kin 3 eclipse configuration autocomplete spring-boot
我为我的 spring-boot 项目创建了一个带有配置属性的简单类。一切都像一个魅力(spring-boot 捕获选项),除了 Eclipse 不将新属性识别为application.yml中的有效选项并将其突出显示为未知这一事实之外。
这是课程:
@Component
@ConfigurationProperties(prefix="server")
public class ServerProperties {
private Integer delay;
private DataAdapter dataAdapter = new DataAdapter();
// setters and getters were cut out for the sake of readability
public static class DataAdapter {
private String baseUrl;
private String targetCode;
// setters and getters
}
}
Run Code Online (Sandbox Code Playgroud)
自动补全不适用于以下属性:
我按照Spring.io 参考中的建议将 Spring Boot 配置处理器的依赖项添加到pom.xml中,但它没有按预期工作。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
Run Code Online (Sandbox Code Playgroud)
尝试切换到application.properties但自动完成功能仍然不起作用。
Spring Boot 配置处理器在编译期间充当注释处理器。
需要为 Eclipse 项目启用注释处理并注册处理器:
归档时间: |
|
查看次数: |
5147 次 |
最近记录: |