SpringBoot启动报错Failed to determine a suitable driver class
SpringBoot启动报错如下
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-06 21:27:18.275 ERROR 10968 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :***************************
APPLICATION FAILED TO START
***************************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 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).Process finished with exit code 1
把这个依赖注释掉就好了
原因
应用没有使用到DataSource,但是在pom.xml里引入了mybatis-spring-boot-starter
问题解决办法
有两种:
把mybatis-spring-boot-starter的依赖去掉,这样就不会触发spring boot相关的代码
把spring boot自动初始化DataSource相关的代码禁止掉
禁止的办法有两种:
在启动类的@SpringBootApplication加上
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class })
在application.properties里配置:
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
<div class="art_xg">
您可能感兴趣的文章:
原文地址:https://www.jb51.net/article/160814.htm
SpringBoot启动报错Failed to determine a suitable driver class的更多相关文章
- springboot启动报错:Cannot determine embedded database driver class for database type NONE.
package cn.zb.test; import org.springframework.boot.SpringApplication; import org.springframework.bo ...
- springboot启动报错 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
新建了一个springboot项目报一下错误: Failed to configure a DataSource: 'url' attribute is not specified and no em ...
- springboot启动报错Failed to configure a DataSource
2018-11-21 19:43:12.076 WARN 5392 --- [ main] ConfigServletWebServerApplicationContext : Exception e ...
- 【spring cloud】【spring boot】项目启动报错:Cannot determine embedded database driver class for database type NONE
解决参考文章:https://blog.csdn.net/hengyunabc/article/details/78762097 spring boot启动报错如下: Error starting A ...
- spriing boot 启动报错:Cannot determine embedded database driver class for database type NONE
最近在学习使用spring boot.使用maven创建好工程,只引用需要用到的spring boot相关的jar包,除此之外没有任何的配置. 写了一个最简单的例子,如下所示: package com ...
- springboot项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde
springboot项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde 创建 ...
- 新建Spring boot 启动报错 Failed to auto-configure a DataSource
今天学习springboot,使用idea创建项目.在选择组件时添加了mysq 然后在第一次启动的时候启动报错,错误信息如下: ***************************APPLICATI ...
- springboot 启动报错"No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available"
1.问题 springboot启动报错 "D:\Program Files\Java\jdk-11\bin\java.exe" -XX:TieredStopAtLevel=1 -n ...
- SpringBoot2 启动报错 Failed to auto-configure a DataSource
今天Spring Boot 2.0正式版发布,寻思着搭个小demo尝试一下Spring Boot的新特性,使用idea创建项目.在选择组件时添加了mysql.mybatis 然后在第一次启动的时候启动 ...
随机推荐
- 1、Redis的使用
非关系型数据库分类: 分类 典型代表 典型应用场景 数据类型 优点 缺点 键值 (key-value) Tokyo Cabinet/Tyrant, Redis, Voldemort, Oracle B ...
- 10-2-点击生成10个div
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- python3 新特性
1.格式化字符串f-string user = "Mike" log_message = f'User{user} has logged in' 2.路径管理库Pathlib 3. ...
- sqlserver 如何按年按月创建分区函数
我创建了分区函数如下:create partition function pf_month1(varchar(8))as range left for values ('20120131','2012 ...
- dubbo入门学习(二)-----dubbo hello world
一.dubbo hello world入门示例 1.提出需求 某个电商系统,订单服务需要调用用户服务获取某个用户的所有地址: 我们现在需要创建两个服务模块进行测试: 模块 功能 订单服务web模块 创 ...
- Java TimeUnit使用
TimeUnit是java.util.concurrent包下面的一个类,表示给定单元粒度的时间段. 常用的颗粒度 TimeUnit.DAYS //天 TimeUnit.HOURS //小时 Time ...
- javascript基础:bom
一.BOM 1.概念:Browser Object Model 浏览器对象模型 * 将浏览器的各个组成部分封装成对象 2.组成: * Window:窗口对象 1 ...
- 高斯消元和高斯约旦消元 Gauss(-Jordan) Elimination
高斯消元法,是线性代数中的一个算法,可用来求解线性方程组,并可以求出矩阵的秩,以及求出可逆方阵的逆矩阵. 在讲算法前先介绍些概念 矩阵的初等变换 矩阵的初等变换又分为矩阵的初等行变换和矩阵的初等列变换 ...
- Leetcode492.Construct the Rectangle构造矩形
作为一位web开发者, 懂得怎样去规划一个页面的尺寸是很重要的. 现给定一个具体的矩形页面面积,你的任务是设计一个长度为 L 和宽度为 W 且满足以下要求的矩形的页面.要求: 1. 你设计的矩形页面必 ...
- MAC中已有的虚拟环境在pycharm 中进行调用
首先确定虚拟环境的路径: 打开工作环境配置文件,找到工作目录: 在pycharm中解释器中找到工作目录中对应的虚拟环境进行配置就可以了