无法确定合适的驱动程序类别 [英] Failed to determine a suitable driver class

查看:330
本文介绍了无法确定合适的驱动程序类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动应用程序时,看到以下错误:

when starting application, seeing below error:

在上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建名称为'blockDataController'的bean时出错:注入资源依赖项失败; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名称为'blockSummaryImpl'的bean时出错:注入资源依赖项失败;嵌套的异常是org.springframework.beans.factory.UnsatisfiedDependencyException:创建文件[D:\ YueNiuProject \ StockMarket \ yueniu-stock-data \ market-data-dao \ target \ classes \ com \中定义的名称为'prodCodeMapper'的bean时出错yueniu \ stock \ market \ data \ mapper \ block \ ProdCodeMapper.class]:通过bean属性'sqlSessionFactory'表示的不满足的依赖关系; 嵌套的异常是org.springframework.beans.factory.UnsatisfiedDependencyException:在类路径资源[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]中创建名称为'sqlSessionFactory'的bean时出错:通过方法'sqlSessionFactory'表示的不满足的依赖关系参数0;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建在类路径资源[org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration $ Hikari.class]中定义的名称为'dataSource'的bean时出错:通过工厂方法实例化Bean失败;嵌套的异常是org.springframework.beans.BeanInstantiationException:无法实例化[com.zaxxer.hikari.HikariDataSource]:工厂方法'dataSource'引发了异常; 嵌套的异常是org.springframework.boot.autoconfigure.jdbc.DataSourceProperties $ DataSourceBeanCreationException:无法确定合适的驱动程序类

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blockDataController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blockSummaryImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'prodCodeMapper' defined in file [D:\YueNiuProject\StockMarket\yueniu-stock-data\market-data-dao\target\classes\com\yueniu\stock\market\data\mapper\block\ProdCodeMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class

推荐答案

与sql数据库的连接,必须在application.properties中配置数据源

the connection with a sql database, you must configure datasource in application.properties

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://..
spring.datasource.username=//..
spring.datasource.password=//..

这篇关于无法确定合适的驱动程序类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆