<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="WEB-INF/spring/db.properties"></property>
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${driverClassName}" />
<property name="url" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</bean>
属性 location的取值可以是:
- 文件路径:
<property name="location" value="file:C:/test.dat"></property>
- classpath:
<property name="location" value="classpath:test.dat"></property>
- 相对路径:
<property name="location" value="WEB-INF/test.dat"></property>