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 {

}

 

posted @ 2015-04-24 17:51  samu  阅读(262)  评论(0编辑  收藏  举报