Spring Boot启动报错:internalTransactionalEventListenerFactory could not be registered

Spring Boot启动时,报错:

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'org.springframework.transaction.config.internalTransactionalEventListenerFactory', defined in null, could not be registered. A bean with that name has already been defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

 

原因:

启动类中的@EnableTransactionManagement与xml配置文件中的重复

 

解决方式:

1. 保留其中一个

2. 在Spring Boot配置文件中添加

spring:
  main:
    allow-bean-definition-overriding: true

 

 

转载于:https://my.oschina.net/liyan2013/blog/3074891

你可能感兴趣的:(java)