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

配置文件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日

悬赏问题

  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择