java的springboot错误记录

文章描述了一位开发者在启动SpringBoot项目时遇到错误,源于数据源配置冲突。尝试解决过程中发现可能因方法名重复和`allow-bean-definition-overriding`设置问题,但未能成功解决。
摘要由CSDN通过智能技术生成

刚开始项目就遇到这个错误,我快疯了

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

猜测是包中的方法名重复,但是输入后出现新的错误,解决失败

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值