项目启动时报错,如下:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-04-25 18:05:24.483 ERROR   
            7880 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

The bean 'dataSource', defined in class path resource [com/inspur/tinyframework/datasource/config/DruidDatasourceConfiguration.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

Disconnected from the target VM, address: '127.0.0.1:54719', transport: 'socket'

Process finished with exit code 1

根据错误信息 可以看出

在这里插入图片描述

解决办法

在配置文件中添加配置
spring.main.allow-bean-definition-overriding=true
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐