Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I have defined a trivial SpringBoot Hibernate app, copy-pasted from sample code found in a random site on the Internet. The hopefully relevant portions of my
spring.xml
look like this:
<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" />
Why do I get this error?
The bean
'org.springframework.transaction.config.internalTransactionAdvisor',
defined in class path resource
[org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class],
could not be registered. A bean with that name has already been
defined in null and overriding is disabled.
Other things I have already tried
Using org.springframework.jdbc.datasource.DataSourceTransactionManager
- same error
Using org.springframework.orm.jpa.JpaTransactionManager
- same error
Removing the transactionManager
bean - ok my SpringBoot app works but now all my JUnit tests break
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.