问题:项目中没有使用db相关的东西,但是在应用启动时报错:Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]
原因:
pom.xml 中配置了和数据库相关的,Spring Boot启动默认会加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration类, DataSourceAutoConfiguration类使用了@Configuration注解向spring注入了dataSource bean。因为工程中没有关于dataSource相关的配置信息,当Spring创建dataSource bean因缺少相关的信息就会报错。
解决办法:
pom中去掉数据库相关的引用,或者在@SpringBootApplication中排除其注入
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
原文链接:https://blog.csdn.net/dingli3213/article/details/79137372
- instantiate DataSource Failed apache tomcatinstantiate datasource failed apache hikaridatasource instantiate failed hikari instantiate specified interface failed datasource properties primary failed failed description springboot datasource 漏洞apache tomcat 29885 apache tomcat nginx iis 脚本 漏洞apache tomcat instantiate instantiated