Autowired properities class
1. Properties类
@ConfigurationProperties(locations = "classpath:build.properties")
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@JsonPropertyOrder(alphabetic = true)
public class BuildProperties {
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
@JsonPropertyOrder(alphabetic = true)
public static class Versions {
private String app;
private String spring;
private String springBoot;
private String hibernate;
private String angularjs;
private String bootstrap;
private String highcharts;
...
}
2. 配置类
@Configuration
@EnableConfigurationProperties(BuildProperties.class)
public class PropertiesConfig {
}