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的更多相关文章

  1. springboot启动报错:Cannot determine embedded database driver class for database type NONE.

    package cn.zb.test; import org.springframework.boot.SpringApplication; import org.springframework.bo ...

  2. 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 ...

  3. springboot启动报错Failed to configure a DataSource

    2018-11-21 19:43:12.076 WARN 5392 --- [ main] ConfigServletWebServerApplicationContext : Exception e ...

  4. 【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 ...

  5. spriing boot 启动报错:Cannot determine embedded database driver class for database type NONE

    最近在学习使用spring boot.使用maven创建好工程,只引用需要用到的spring boot相关的jar包,除此之外没有任何的配置. 写了一个最简单的例子,如下所示: package com ...

  6. 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 创建 ...

  7. 新建Spring boot 启动报错 Failed to auto-configure a DataSource

    今天学习springboot,使用idea创建项目.在选择组件时添加了mysq 然后在第一次启动的时候启动报错,错误信息如下: ***************************APPLICATI ...

  8. 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 ...

  9. SpringBoot2 启动报错 Failed to auto-configure a DataSource

    今天Spring Boot 2.0正式版发布,寻思着搭个小demo尝试一下Spring Boot的新特性,使用idea创建项目.在选择组件时添加了mysql.mybatis 然后在第一次启动的时候启动 ...

随机推荐

  1. hiveUDF的使用

    在此自己总结下UDF的用法 1.首先最简单的UDF(普通用java扩充函数的方式,大多数简便函数可以用这个函数来实现,返回单个字段),其加强版UDGF据说对map一类数据类型有更好兼容,实现上略复杂 ...

  2. 2018-8-10-win10-uwp-手把手教你使用-asp-dotnet-core-做-cs-程序

    title author date CreateTime categories win10 uwp 手把手教你使用 asp dotnet core 做 cs 程序 lindexi 2018-08-10 ...

  3. JZOJ P5829 HZOI 20190801 A string 线段树

    JZOJ P5829 A. string 题面:https://www.cnblogs.com/Juve/articles/11286476.html 考场上想起了排序这道题:https://www. ...

  4. Python3.5 安装 & hello world

    1.下载安装python https://www.python.org/downloads/release/python-364/ 2.安装成功运行 python shell 3.或者cmd => ...

  5. TF-IDF了解

    http://en.wikipedia.org/wiki/Tf%E2%80%93idf

  6. shell 启动脚本

    启动脚本是bash启动时自动执行的脚本.用户可以把一些环境变量的设置和alias.umask设置放在启动脚本中,这样每次启动Shell时这些设置都自动生效.思考一下,bash在执行启动脚本时是以for ...

  7. java锁_IO_NIO_AIO_BIO_GC_Jvm

    如何保证线程安全,线程锁有哪些? 同步方法和同步代码块常见的锁:ReentrantLock与synchronized二者区别:             (1) 线程A和B都要获取对象O的锁定,假设A获 ...

  8. 【JOB】Oracle中JOB的创建方法以及一个细节的探究

    在Oracle中可以使用JOB来实现一些任务的自动化执行,类似于UNIX操作系统crontab命令的功能.简单演示一下,供参考. 1.创建表T,包含一个X字段,定义为日期类型,方便后面的定时任务测试. ...

  9. CSP-S 2019 Day 2 T3 树的重心

    CSP-S 2019 Day 2 T3 树的重心 题 给出了一个大小为\(n\)的树,树中结点从 1∼n 编号.小简单的课后作业是求出这棵树单独删去每条边后,分裂出的两个子树的重心编号和之和. \(n ...

  10. springboot框架实现启动项目执行指定代码

    说明: 当有写代码需要在项目启动时执行的时候(即项目启动完成前),可以使用这个方法. 步骤: 创建一个启动类并在类上打上@Component注解 让这个类实现CommandLineRunner接口 重 ...