问答详情
源自:4-1 使用集成测试Service逻辑

没有找到事物管理的bean

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined: No matching PlatformTransactionManager bean found for qualifier 'transactionManager' - neither qualifier match nor bean name match!


at org.springframework.beans.factory.annotation.BeanFactoryAnnotationUtils.qualifiedBeanOfType(BeanFactoryAnnotationUtils.java:107)

这是xml中的配置信息

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:aop="http://www.springframework.org/schema/aop"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
             http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx.xsd">
   <!-- 扫描service下的包 -->
   <context:component-scan base-package="service"/>
   <!-- 数据库连接池 -->
   <bean id="transactionManger" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
       <property name="dataSource" ref="dataSource"/>
   </bean>
   <!-- 事物管理-->
   <tx:annotation-driven transaction-manager="transactionManager"/>

</beans>

提问者:破碎吧3368845 2017-03-10 14:17

个回答

  • 慕无忌5633127
    2017-12-23 18:12:18

    是什么错误


  • 破碎吧3368845
    2017-03-10 14:36:20

    额,已经找到了。上面和下面的manager写的不一样!!!