spring boot 启动遇到报错:Failed to configure a DataSource
spring boot 启动遇到报错,具体如下
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).
出错的原因:
在pom.xml中引入了 mybatis-spring-boot-starter,会自动加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration类
DataSourceAutoConfiguration类使用了@Configuration注解向spring注入了DataSource bean
因此如果没有配置DataSource,就会报错
解决的方法:
修改启动类,添加 @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}),阻止spring 自动注入DataSource
package com.abc.robin.backup; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@SpringBootApplication
public class RobinBackupApplication { public static void main(String[] args) {
SpringApplication.run(RobinBackupApplication.class, args);
} }
spring boot 启动遇到报错:Failed to configure a DataSource的更多相关文章
- 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错误——SpringBoot 2.0 报错: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
背景 使用Spring Cloud搭建微服务,服务的注册与发现(Eureka)项目启动时报错,错误如下 *************************** APPLICATION FAILED T ...
- springboot启动报错Failed to configure a DataSource
2018-11-21 19:43:12.076 WARN 5392 --- [ main] ConfigServletWebServerApplicationContext : Exception e ...
- 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 2.0 报错: Failed to configure a DataSource: 'url' attribute is not specified and no embe
问题描述 *************************** APPLICATION FAILED TO START *************************** Description ...
- 记一次Spring boot集成mybatis错误修复过程 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
最近自己写了一份代码签入到github,然后拉下来运行报下面的错误 Error starting ApplicationContext. To display the conditions repor ...
- Spring Boot 2.1.7 启动项目失败,报错: "Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured."
一开始按照网上的很多解决办法是: 启动类头部声明@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class}),但是这样会排除 ...
- Spring Boot启动的报错 Stopping service [Tomcat]
我遇到的问题是项目中使用java_websocket的WebSocketClient,由于性能要求,需要再Controller直接继承WebSocketClient, 在项目启动过程中调试进入spri ...
- spring boot 启动数据库报错(Exception during pool initialization.)
2018-06-27 14:12:28.804 ERROR 14312 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariP ...
随机推荐
- Prometheus监控学习笔记之Prometheus 2.x版本的常用变化
最近用了prometheus 2.0 版本,感觉改变还是有点大,现将改变相关记录如下: 1.prometheus.yml文件配置修改后,要想重新加载,必须在启动的时候添加参数: --web.enabl ...
- 重绘MenuStrip 控件
重绘MenuStrip控件 效果如图: 首先添加 CustomProfessionalRenderer类 用于重绘控件菜单样式 /// <summary> /// 自定义MenuStrip ...
- 轻量级ORM《sqlcommon》第一个版本发布了!!!
一.sqlcommon的特色 1. 轻量级,整个包只有123kb. 2. 性能好,自测... 3. API和功能简单.代码简短.可维护性好基本都能看懂.这个点我认为很重要,你不用为了实现一个需求而四处 ...
- ASP.NET MVC IOC 之 Autofac(三)-webform中应用
在webform中应用autofac,只有global中的写法不一样,其他使用方式都一样 nuget上引用: global中的写法: private void AutoFacRegister() { ...
- Django---CSRF的装饰器,CSRF的流程,JSON数据格式,ajax技术(基于JQ实现)
Django---CSRF的装饰器,CSRF的流程,JSON数据格式,ajax技术(基于JQ实现) 一丶CSRF相关的装饰器 from django.utils.decorators import m ...
- vue单元素/组件的过渡
(1)过渡的类名 v-enter:定义进入过渡的开始状态.在元素被插入之前生效,在元素被插入之后的下一帧移除. v-enter-active:定义进入过渡生效时的状态.在整个进入过渡的阶段中应用,在元 ...
- 无线安全审计工具FruityWifi初体验
FruityWIfi是一款有名的无线安全审计的开源工具,其灵感来自于wifipineapple,目前该工具已经更新到2.4.它能够让用户通过web界面来控制和管理模块,十分方便.FriutyWifi最 ...
- 设计模式 行为型 - 策略模式 Strategy
策略模式(Strategy) 意图 对象有某个行为,但是在 不同的场景 下,该行为有 不同的实现算法. 就好比你去餐馆吃饭,首页你要通过菜单来选择你想吃的菜,根据你点的菜的不同,在厨房中去做不同的菜. ...
- JS数据打印的几种方式
/** * 在页面输出内容! */ document.write("This's Great!"); /** * 控制台打印: */ console.log("This ...
- PHP使用PhpAnalysis进行分词
1.介绍 PHPAnalysis分词程序使用居于unicode的词库,使用反向匹配模式分词,理论上兼容编码更广泛,并且对utf-8编码尤为方便. 下载地址:http://www.phpbone.com ...