Mintondedie 2022-01-21 10:55 采纳率: 100%
浏览 674
已结题

配置文件transactionmanager标红 错误信息: Cannot resolve bean 'transactionManager'


<?xml version="1.0" encoding="UTF-8"?>
<!--suppress SpringFacetInspection -->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd
 http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
 http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">


    <context:property-placeholder location="database.properties"></context:property-placeholder>
        <bean id="dataSourse" class="com.alibaba.druid.pool.DruidDataSource">
            <property name="driverClassName" value="${driverCLiass}"></property>
            <property name="url" value="${url}"></property>
            <property name="username" value="${user}"></property>
            <property name="password" value="${password}"></property>
        </bean>

        <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
            <property name="dataSource" ref="dataSourse"></property>
        </bean>

        <context:component-scan base-package="com.fan4"></context:component-scan>
        <context:component-scan base-package="com.fan5"></context:component-scan>
        <tx:annotation-driven transaction-manager="transactionManager"></tx:annotation-driven>
</beans>

img

  • 写回答

1条回答 默认 最新

  • IT不码农 2022-01-21 11:12
    关注

    xml配置文件里缺少 transactionManager定义呀

     <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    
            <property name="dataSource" ref="dataSource"></property>
        </bean>
    
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 1月29日
  • 已采纳回答 1月21日
  • 创建了问题 1月21日

悬赏问题

  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”