Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that SpringBoot startup multiple data sources can't find a suitable driver class?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

SpringBoot startup multiple data sources can not find a suitable driver class problem how to solve, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

The problem that the suitable driver class could not be found for starting multiple data sources

I used SpringBoot multiple data sources in my project, but mysql has Druid connection pooling that uses Ali.

Com.baomidou dynamic-datasource-spring-boot-starter 2.5.6 com.alibaba druid-spring-boot-starter 1.1.10 If you put these two jar packages together, you can't find a combined driver to load.

If Druid connection pooling is useful in your configuration file, then method one: remove Druid from the startup class

@ SpringBootApplication (exclude = DruidDataSourceAutoConfigure.class) public class JointApplication {public static void main (String [] args) {SpringApplication.run (JointApplication.class, args);}}

Method two, of course. Delete the dependence of Druid.

Start springboot prompt to drive exception Failed to determine a suitable driver class

Check the database configuration

When two SQL drivers are introduced, it may be that when another module is introduced, both modules reference the same SQL driver.

No profile scanned

Add the following code src/main/java * * / * .properties * * / * .xml to the build tag in pom.xml * * / .yml false src/main/resources * * / * .properties * * / .xml * * / .yml false

If there is a successfully configured project, copy it directly, and there will be no problem.

What is springboot? springboot is a new programming specification, which is designed to simplify the initial construction and development process of new Spring applications. SpringBoot is also a framework that serves the framework, and the scope of services is to simplify configuration files.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report