关于Spring配置文件有一处不太懂,求教...
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:properties/dataBase.properties</value>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="url">
<value>${database.url}</value>
</property>
<property name="driverClassName">
<value>${database.driver}</value>
</property>
<property name="username">
<value>${database.user}</value>
</property>
<property name="password">
<value>${database.password}</value>
</property>
</bean>
这里的${...}是什么意思?
[解决办法]
你spring的xml里面的<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:properties/dataBase.properties</value>
</property>
</bean>
这里就已经把dataBase.properties配置文件交给spring管理了,${database.xxxxx}这些就是从这里面取到的,更多的看人家spring的开发文档