問題
如何在Spring的配置檔案中配置外部的配置檔案,比如jdbcConfig.properties等?
解決
1 <!--讀取配置檔案-->
2 <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
3 <property name="locations">
4 <list>
5 <value>classpath:jdbcConfig.properties</value>
6 <!--要是有多個配置檔案,隻需在這裡繼續添加即可 -->
7 </list>
8 </property>
9 </bean>
注意:jdbcConfig.properties放在resources中
使用的話,${}就可以。