SpringBoot项目启动报错:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
Failed to bind properties under spring.datasource to javax.sql.DataSource

在这里插入图片描述

在做springboot整合druid配置数据源监控的时候,报了这个错,网上查到是由于log4j版本问题:
在springboot1.5的版本中,使用的是spring4.x,而springboot2.x使用的是spring5.x,在spring5.x后,官方弃用了log4j,而建议并使用log4j2,因此要么降低版本使用spring4.x的spring boot版本,要么额外去引入log4j的jar包。

我选用的是加入log4j依赖:

<dependency>
	<groupId>log4j</groupId>
	<artifactId>log4j</artifactId>
	<version>1.2.17</version>
</dependency>

成功启动不报错

参考大佬地址:https://blog.csdn.net/qq_37495786/article/details/82781700

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐