springboot 配置文件配置为对象

@Bean
public Properties appConstantsProperties() throws IOException {
PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
propertiesFactoryBean.setLocation(new ClassPathResource("/app-constants.properties"));
propertiesFactoryBean.afterPropertiesSet();
return propertiesFactoryBean.getObject();
}
posted @ 2018-12-29 15:32  zfzf1  阅读(692)  评论(0编辑  收藏  举报