首页 新闻 搜索 专区 学院

spring.net nhibernate 多数据库连接问题

0
悬赏园豆:50 [已关闭问题] 关闭于 2010-02-02 08:12

 

SoaFuTestAll.HrmStmtest.Create:
Spring.Objects.Factory.UnsatisfiedDependencyException : Error creating object with name 'HrmStmtest' : Unsatisfied dependency expressed through object property 'DbProvider': There are 2 objects of Type [Spring.Data.Common.IDbProvider] for autowire by type, when there should have been just 1 to be able to autowire property 'DbProvider' of object 'HrmStmtest'.

SoaFuTestAll.HrmStmtest.Create:Spring.Objects.Factory.UnsatisfiedDependencyException : Error creating object with name 'HrmStmtest' : Unsatisfied dependency expressed through object property 'DbProvider': There are 2 objects of Type [Spring.Data.Common.IDbProvider] for autowire by type, when there should have been just 1 to be able to autowire property 'DbProvider' of object 'HrmStmtest'.

单元测试报错,高手看一看。

 

问题补充: 我是有两个Dbprovider,需要连两个数据库 不是单独测试都能通过, <?xml version="1.0" encoding="utf-8" ?> <objects xmlns="http://www.springframework.net" xmlns:tx="http://www.springframework.net/tx" xmlns:aop="http://www.springframework.net/aop" xmlns:db="http://www.springframework.net/database" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/schema/objects/spring-objects.xsd http://www.springframework.net/schema/tx http://www.springframework.net/schema/tx/spring-tx-1.1.xsd http://www.springframework.net/schema/db http://www.springframework.net/schema/db/spring-database.xsd" > <!-- Entity Interceptors --> <!--<object id="entityInterceptor" type="PaperLess.MES.DAL.Interceptor.UtcDateTimeInterceptor, PaperLess.MES.DAL"/> <object id="oagisEntityInterceptor" type="PaperLess.OAGIS.DAL.Interceptor.UtcDateTimeInterceptor, PaperLess.OAGIS.DAL"/>--> <!-- END Entity Interceptors --> <!-- Database Provider Configuration --> <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core"> <property name="ConfigSections" value="databaseSettings" /> </object> <!-- END Database Provider Configuration --> <!-- MES Data Provider Session --> <db:provider id="DbProvider" provider="SqlServer-2.0" connectionString="Data Source=FU;Initial Catalog=Hrm;User ID=sa ;Password=123 ;Trusted_Connection=False;"/> <object id="NHibernateSessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate20"> <property name="DbProvider" ref="DbProvider" /> <property
lihhhh的主页 lihhhh | 初学一级 | 园豆:150
提问于:2010-01-29 16:55
< >
分享
所有回答(1)
0

是不是HrmStmtest对象的DbProvider属性设置不对?

三阶 | 园豆:1436 (小虾三级) | 2010-01-29 20:20
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册