spring boot1.5以上版本@ConfigurationProperties取消location注解后的替代方案

  1. @EnableConfigurationProperties取消激活自定义的配置类
  2. 在配置类中采用@Component的方式注册为组件,而后使用@PropertySource来指定自定义的资源目录
    @Component
    @ConfigurationProperties(prefix = "author")
    @PropertySource("classpath:author.properties")
    public class AuthorSetting {}
相关文章
相关标签/搜索