刚开始项目就遇到这个错误,我快疯了
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-12-13 17:23:56.966 ERROR 16664 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'dataSource', defined in class path resource [org/apache/shardingsphere/shardingjdbc/spring/boot/SpringBootConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.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
搜素解决方案,暂时无法解决,猜测是application.yml的数据库出现问题
记录一下
server:
port: 8080
spring:
# main:
# allow-bean-definition-overriding: true
application:
name: fuwu_take_out
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/fruit?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
对了,根据搜索加入了
# main:
# allow-bean-definition-overriding: true
猜测是包中的方法名重复,但是输入后出现新的错误,解决失败