【发布时间】:2015-03-06 16:18:36
【问题描述】:
我有这个 mapper-config.xml。Game 类有 DAO 和 BLM:
<bean id="DAOGame" class="it.certimeter.nagima.dao.game.DAOGame">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<bean id="BLMGameTarget" class="it.certimeter.nagima.blm.game.BLMGame">
<property name="daoGame" ref="DAOGame" />
</bean>
以及用于事务的 bean:
<bean class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" id="BLMGame">
<property name="proxyInterfaces">
<list>
<value>it.certimeter.nagima.blm.game.IBLMGame</value>
</list>
</property>
<property name="transactionManager">
<ref bean="transactionManager"/>
</property>
<property name="target">
<ref bean="BLMGameTarget"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="saveGame">PROPAGATION_REQUIRED, -it.fondsai.jeffs.core.exception.service.appl.JeffsServiceApplException</prop>
</props>
</property>
<!-- <property name="anonymousAccess" value="true"/> -->
</bean>
但是我有这个错误: 嵌套异常是 org.springframework.beans.factory.NoUniqueBeanDefinitionException:没有定义类型 [it.certmeter.nagima.blm.game.IBLMGame] 的合格 bean:预期的单个匹配 bean 但找到了 2:BLMGameTarget,BLMGame
我哪里错了??
【问题讨论】:
-
您有两个 bean 实现了 IBLMGame 接口,而当将 bean 连接在一起时,spring 不知道该选择哪个:docs.spring.io/spring/docs/current/javadoc-api/org/…
标签: java spring spring-mvc transactions mybatis