下文讲述一次 SpringBoot启动报错 Failed to determine a suitable driver class
今天配置文件中的本地数据库调整为云服务器的数据库地址时,重新启动出现以下错误, Description: Failed to configure a DataSource: no embedded datasource could be configured. Reason: Failed to determine a suitable driver class Action: 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).那么该如何处理此异常,下文将笔者的处理步骤分享如下:
步骤2
检查配置文件是否正确配置文件名字是不是application-xxx.yml
application.yml是否激活指向XXX.yml
步骤2
application.properties中的数据库相关配置是否有误 驱动也要检查spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://【ip】:【端口】/【数据库名】?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false spring.datasource.username=*** spring.datasource.password=***
步骤3
pom.xml文件中是否有依赖冲突如引入了两个mysql驱动
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。