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 ...
随机推荐
- WPF 精修篇 旋转 RotateTransForm
原文:WPF 精修篇 旋转 RotateTransForm 旋转 RotateTransform Angle 角度 CenterY ,CenterX 中心点位置 和缩小一样 左侧 和右侧 做了对比 ...
- 关于VS C++中项目属性的一些名称的含义
这个属性页(Alt + F7)界面下的$开头的内容的含义 $(Platform), X64或X86类似的. $(SolutionDir),.sln的位置 $(Configuration), Debug ...
- javascript字符串加密解密函数
代码如下: /** * 加密函数 * @param str 待加密字符串 * @returns {string} */ function str_encrypt(str) { var c = Stri ...
- 记一次删除ocr与dbfile的恢复记录
自己造成的一个案例: 场景:ocr磁盘组被我dd掉了,dbfile磁盘组也被我dd掉了.Rac起不来.之前ocr的DATA磁盘组被替换到了ABC磁盘.所幸的是有备份. 重新加载OCR磁盘 [root@ ...
- window配合虚拟机VMware搭建虚拟ubuntu服务器入坑集锦
1.VMware虚拟机和主机进行网络连接设置 https://jingyan.baidu.com/article/adc81513b86621f723bf7383.html 2.解决linux虚拟机与 ...
- youtube-dll工具使用,很好用!!
最近喜欢上youtube-dll这个插件,下载东西真的很好用,墙裂推荐,github地址如下 https://github.com/ytdl-org/youtube-dl 安装 1.Linux 1.1 ...
- 适用于Centos6/7,vsftp自动安装脚本
#!/bin/bash #vsftp install . /etc/rc.d/init.d/functions NUM=`rpm -q centos-release | awk -F '-' '{pr ...
- springboot+thymeleaf 实现图片文件上传及回显
1. 创建一个springboot工程, 在此就不多说了(目录结构). 2. 写一个HTML页面 <!DOCTYPE html> <html lang="en" ...
- c语言基础之getopt()
getopt() #include <unistd.h> int getopt(int argc, char * const argv[], const char *optstring); ...
- Linux shell sed命令使用
Linux处理文本文件的工具: grep 过滤文件内容 sed 编辑文件内容 awk 正则表达式Regex ...