1.在配置文件中配置PropertyPlaceholderConfigurer
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:com/foo/jdbc.properties"/>
</bean>
然后在需要的地方直接以下方式引用:
<property name="url" value="${jdbc.url}"/>
```
2.在配置文件中加入
beans的命名空间声明如下:
xmlns:context=http://www.springframework.org/schema/context
配置如下:
<context:property-placeholder location="dbconf.properties"/>