【发布时间】:2019-09-03 18:43:01
【问题描述】:
我为我的 spring-boot 项目创建了一个带有配置属性的简单类。除了 Eclipse 不将新属性识别为 application.yml 中的有效选项并将它们突出显示为未知这一事实之外,一切都作为一种魅力(spring-boot 捕获选项)起作用。
这是课程:
@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
}
}
自动完成功能不适用于这些属性:
我按照Spring.io reference 中的建议将 Spring Boot 配置处理器的依赖项添加到 pom.xml 中,但它没有按预期工作。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
尝试切换到 application.properties 但自动补全仍然不起作用。
【问题讨论】:
标签: eclipse spring-boot configuration autocomplete