Sping+Hibernate单元测试问题

来源:百度知道 编辑:UC知道 时间:2024/06/01 07:19:04
因为用了数据连接池proxool.xml,我在applicationContext.xml配置文件中的sessionFactory定义中用的类是org.springframework.orm.hibernate3.LocalSessionFactoryBean。
其中对hibernateProperties属性配置的也没问题,但是在进行单元测试的时候发生错误:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.inspur.faultsheet.test.spring.TestSpringXml': Unsatisfied dependency expressed through bean property 'dataSource': Set this property value or disable dependency checking for this bean.

是dateBase的问题,但是问题具体在哪里呐?请Spring高手帮一下,解决后追分答谢!
我分别写了Hibernate.cfg.xml,数据连接池proxool.xml。在applicationContext.xml中只关联了跟proxool.xml相关的内容,没有关联Hibernate,问题是不是出在这里?
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>com\inspur\faultsheet\domain\xml\User.hbm.xml</value>
</list

好象是你的TestSpringXml里面的属性配置和BEAN里面的属性配置不一致吧
该一下试试
<value>com/inspur/faultsheet/domain/xml/User.hbm.xml</value>

这和转义字符有关