spring cloud启动遇到The bean 'dataSource', defined in BeanDefinition defined in class path resource 问题

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.

问题描述如下:

spring cloud启动遇到The bean 'dataSource', defined in BeanDefinition defined in class path resource 问题_第1张图片

上网找了好几个方法都不好用,最终解决方法如下:

properties配置文件增加spring.main.allow-bean-definition-overriding= true

或yml配置文件如下图:

spring cloud启动遇到The bean 'dataSource', defined in BeanDefinition defined in class path resource 问题_第2张图片

你可能感兴趣的:(spring cloud启动遇到The bean 'dataSource', defined in BeanDefinition defined in class path resource 问题)