标签:world config source ati boot bsp url bean value
方式一:
@Component @Data public class PropertyBean { @Value("${datasource.url}") private String url; @Value("${datasource.username}") private String userName; }
方式二:
@Component @Configuration @EnableAutoConfiguration public class PropertyBeanUtil { @Bean @ConfigurationProperties(prefix = "datasource") public PropertyBean propertyBean() { return new PropertyBean(); } }
配置文件:
datasource.username = admin
datasource.url = /hello/world
标签:world config source ati boot bsp url bean value
原文地址:http://www.cnblogs.com/zhaojinxin/p/7567500.html