spring配置文件中配置sessionFactory时,属性configLocations的作用(spring整合hibernate)

例:

  1. <bean name="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  2. <!-- 使用hibernate.cfg.xml配置文件 -->
  3. <property name="configLocations">
  4. <value>classpath:hibernate.cfg.xml</value>
  5. </property>
  6. ....
  7. </bean>

其中属性configLocations表示去哪里找hibernate的配置文件hibernate.cfg.xml,如果没有这个属性,hibernate.cfg.xml会被忽视掉

 

posted @ 2018-10-25 16:49  炼钢工人  阅读(755)  评论(0编辑  收藏  举报