@Data
@Component
@ConfigurationProperties(prefix = "esb.hr")
public class HRProperties {
private String orgUrl;
private String empUrl;
private String orgPageUrl;
private String empPageUrl;
private String pageCountUrl;
}
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
引入依赖,运行项目 会生成一个
spring-configuration-metadata.json 文件 ,这个文件在target 文件夹中,这样在yml 文件中再次输入属性时就会有提示了,如果还没有提示 ,就把这个文件复制到项目中去再试一试