首页 > 解决方案 > bean 'org.springframework.transaction.config.internalTransactionAdvisor' 已经注册

问题描述

我已经定义了一个简单的 SpringBoot Hibernate 应用程序,它是从 Internet 上随机站点中找到的示例代码复制粘贴而来的。我希望相关的部分spring.xml看起来像这样:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
... details ommitted ...

<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
... details ommitted ...

<bean id="transactionManager"
    class="org.springframework.orm.hibernate5.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

<tx:annotation-driven transaction-manager="transactionManager" />

为什么我会收到此错误?

无法注册在类路径资源 [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class] 中定义的 bean 'org.springframework.transaction.config.internalTransactionAdvisor'。已在 null 中定义了具有该名称的 bean,并且禁用了覆盖。

我已经尝试过的其他事情

标签: springhibernate

解决方案


推荐阅读