springboot The bean 'dataSource', defined in BeanDefinition defined in class path resource

今天再启动springboot时报错


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2019-01-11 10:55:38.248 ERROR 12708 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************

APPLICATION FAILED TO START

***************************

Description:

The bean 'dataSource', defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class] and overriding is disabled.

Action:

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

Process finished with exit code 1

一开始以为是引入了mybatis依赖但没有配置datasource导致

但配置了以后一番报错,原来是因为springboot和springcloud版本不一致导致。

spring官方对应查看网址

spring-cloud    
Finchley.M2                     "Spring Boot >=2.0.0.M3 and <2.0.0.M5"
Finchley.M3                     "Spring Boot >=2.0.0.M5 and <=2.0.0.M5"
Finchley.M4                     "Spring Boot >=2.0.0.M6 and <=2.0.0.M6"
Finchley.M5    "Spring Boot >=2.0.0.M7 and <=2.0.0.M7"
Finchley.M6    "Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1"
Finchley.M7    "Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2"
Finchley.M9    "Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE"
Finchley.RC1    "Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE"
Finchley.RC2    "Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE"
Finchley.SR4    "Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT"
Finchley.BUILD-SNAPSHOT    "Spring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3"
Greenwich.M1    "Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE"
Greenwich.SR2    "Spring Boot >=2.1.0.RELEASE and <2.1.9.BUILD-SNAPSHOT"
Greenwich.BUILD-SNAPSHOT    "Spring Boot >=2.1.9.BUILD-SNAPSHOT and <2.2.0.M4"
Hoxton.M2    "Spring Boot >=2.2.0.M4 and <=2.2.0.M5"
Hoxton.BUILD-SNAPSHOT    "Spring Boot >=2.2.0.BUILD-SNAPSHOT"
发布了24 篇原创文章 · 获赞 2 · 访问量 423

猜你喜欢

转载自blog.csdn.net/qq_42107430/article/details/103703228