spring读取properties和xml配置文件的方法

来源:互联网 发布:js实现用户名密码验证 编辑:程序博客网 时间:2024/06/11 09:55

spring 的配置文件中加载数据库的属性文件
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
 <property name="location">
  <value>classpath:jdbc.properties</value>
 </property>
</bean>


配置 Hibernate的缓存文件
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
 <property name="configLocation">
  <value>classpath:ehcache.xml</value>
 </property>
</bean>

 

原创粉丝点击