spring 加载配置文件

来源:互联网 发布:51铃声馆软件下载 编辑:程序博客网 时间:2024/06/17 20:43
第一种
<context:property-placeholder location="/config/system.properties"/>
只能加载一次
java中引用
@Value("${otherjdbc.driverClassName}")
private String driverClassName;


第二种
java中引用
<!-- 加载系统配置参数 -->
<util:properties id="config" location="classpath:conf/config.properties" />
@Value("#{config['const.pageSize']}")
private int defaultPageSize;
0 0
原创粉丝点击