本文主要是介绍SpringBoot启动报错Failed to determine a suitable driver class,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
两种解决办法
1.在Application类上加
`
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
package com.example.demo3;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;@SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})public class Demo3Application {public static void main(String[] args) {SpringApplication.run(Demo3Application.class, args);}}
Description:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.Reason: Failed to determine a suitable driver classAction:Consider the following:If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).Process finished with exit code 1
这篇关于SpringBoot启动报错Failed to determine a suitable driver class的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!