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 然后在第一次启动的时候启动 ...
随机推荐
- python 编码问题:'ascii' codec can't encode characters in position 的解决方案
报错: 'ascii' codec can't encode characters in position 8-50: ordinal not in range(128) Python在安装时,默认的 ...
- JPA、Hibernate、Spring data jpa之间的关系
什么么是JPA? 全称Java Persistence API,可以通过注解或者XML描述[对象-关系表]之间的映射关系,并将实体对象持久化到数据库中. 为我们提供了: 1)ORM映射元数据:JPA支 ...
- 比特镇步行(Walk)【虚点+bfs+dfs】
Online Judge:NOIP2016十连测第一场 T3 Label:虚点,bfs,dfs 题目描述 说明/提示 对于100%数据,\(n<=200000\),\(m<=300000\ ...
- str_replace函数的使用规则和案例详解
str_replace函数的使用规则和案例详解 str_replace函数的简单调用: <?php $str = '苹果很好吃.'; //请将变量$str中的苹果替换成香蕉 $strg = st ...
- xshell添加脚本
##### xshell添加脚本```属性连接 - 用户身份验证 - 登陆脚本 - 添加等待:[usmshell]$发送:open 212 //212是指188那台机器的ID再添加一个等待:passw ...
- UITableViewHeaderFooterView can't change custom background when loading from nib
down voteforite I've created a custom UITableViewHeaderFooterView and successfully load from nib int ...
- ubuntu触摸板失效问题
很早便遇到这个问题,今天忍无可忍才度娘了一发.亲测有效! 用Ubuntu Tweak备份过桌面的配置,因此我尝试恢复桌面设置,果然奇迹发生了,触摸板立刻恢复了正常使用! 没有备份过的相信使用其中的重置 ...
- Shell 工具之 sed
sed编辑器称为流编辑器(stream editor).可以根据输入命令行的命令或者存储在命令文本文件中的命令处理数据.每次从输入读取一行数据,将该数据与所提供的编辑器命令进行匹配,根据命令修改数据流 ...
- 探索SpringBoot中的SpringMVC
spring boot就是一个大框架里面包含了许许多多的东西,其中spring就是最核心的内容之一,当然就包含spring mvc.spring mvc 是只是spring 处理web层请求的一个模块 ...
- VS2005+VTK读入点云文件
使用VTK读入点云文件的基础代码: 头文件: 也许不是全部都用到,为了接下来得工程还是全部都包含进去了 #include "vtkRenderer.h" #include &quo ...