Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
SpringBoot项目编译成功,启动报错
提示信息很明显,通过查看依赖关系,可以找到原因
导致这个问题的原因是因为,在 pom.xml 配置文件中,配置了数据连接技术 spring-boot-starter-jdbc 包 ,在启动配置文件时 ,Spring Boot 的自动装配机制就会去配置文件中找,相关的数据库的连接配置信息,如果找不到则抛出异常信息。
解决方法:
1. 在 SpringBoot 应用程序启动时,排除 jdbc 的自动装配机制
通过注解实现,启动类上添加如下
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
2. 取消项目中spring-boot-starter-jdbc包的引入
适用于临时测试是否能够正常启动,且不需要数据库的情况。
3. 添加数据库配置
示例
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://10.102.34.xx:3222/xxx_vvv?useUnicode=true&characterEncoding=utf-8
spring.datasource.username=xxxx
spring.datasource.password=xxxx@123
spring.datasource.druid.filters=config,stat
spring.datasource.druid.connectionProperties=config.decrypt=false;config.decrypt.key=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCJm+Ptt7DJ0ztn+Pw62ZTa1u1NSi6M+a/zp0LHzd6ybJx+f5CnszeYT0W/2VZVO+JPU+u2DRDxR9dxUGOanfLj0d47ssUgqZZlIxrrEsxMslnyVKkC0GGp8hgbCTAr+qBqdHZoLx2z4iXY5A/5YwdWqpkq3tLg8PVZT0W9IfzgzwIDAQAB
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.initialSize=2
spring.datasource.minIdle=1
spring.datasource.maxActive=20
# \u914d\u7f6e\u83b7\u53d6\u8fde\u63a5\u7b49\u5f85\u8d85\u65f6\u7684\u65f6\u95f4
spring.datasource.maxWait=60000
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 embedded datasource could be configured.
错误信息入下: 2018-06-23 01:48:05.275 INFO 7104 --- [ main] o.apache.catalina.core.StandardService : Stopp ...
- 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 ...
- 记一次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 ...
- SpringBoot使用mybatis,发生:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured
最近,配置项目,使用SpringBoot2.2.1,配置mybatis访问db,配好后,使用自定义的数据源.启动发生: APPLICATION FAILED TO START ************ ...
- 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 ...
- 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 消费者提示需要配置数据源
使用 由于给前端做分页 在启动消费者的时候遇到了这个问题 Failed to configure a DataSource: 'url' attribute is not specified and ...
- 关于“Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.”
Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the c ...
- 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
解决方案: @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) 作用://取消数据库配置 但是 在用到数据库的时候记 ...
- 5. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
解决方案,见 https://www.jianshu.com/p/836d455663da
随机推荐
- (第5篇)避免协作冲突--简单易接入的Zookeeper
摘要: 众所周知,分布式的系统协作服务很难有让人满意的产品.这些协作服务产品很容易陷入一些诸如竞争选择条件或者死锁的陷阱中.那Zookeeper又是怎么解决这个问题的呢? 博主福利 给大家推荐一套ha ...
- 小米note开启调试模式
1.刷机为开发版本. 2.拨电话界面输入 *#*#717717#*#* 开启调试模式. 3.驱动好像会自己安装.
- python全栈开发day15-递归函数、二分查找
1.昨日内容回顾 主要内置函数: map(func,iter1):返回迭代器 filter(func,iter1):返回迭代器 sorted(iter,key=,reverse=):返回列表 reve ...
- mysql_union操作符
MySQL UNION操作符 union操作符合并两个或多个 SELECT 语句的结果集. union:去重 union all:不去重 UNION 结果集中的列名总是等于 UNION 中第一个 S ...
- 基于kubernetes集群部署DashBoard
目录贴:Kubernetes学习系列 在之前一篇文章:Centos7部署Kubernetes集群,中已经搭建了基本的K8s集群,本文将在此基础之上继续搭建K8s DashBoard. 1.yaml文件 ...
- Adobe Acrobat Pro DC破解
下载amtemu 点击 在AMT Emulator界面,下拉选择Adobe Acrobat DC; 然后点击右下角Install安装破解补丁. 点击Install后在弹出窗口中手动找到并选择软件安装目 ...
- java web开发阅读笔记:第一章
学习该书前所用推荐书籍<名师讲坛—java开发实战经典> 一web开发前奏 1.1网页发展 首先搞懂. 1.HTTP:超级文本传输协议,是一种通讯协议. 通过这个网络协议WW浏览器与WWW ...
- 二分搜索-HihoCoder1139
题目描述: 由于自己“想得太多”,导致自己读了半天题才理解了题意.我还以为索敌值会随着每一次到达战略点而减小,结果题意是索敌值是固定了的,并不会改变. 如下是我对题目中第一个案例的分析: 每个圆圈代表 ...
- [漏洞分析]thinkphp 5.1.25 insert、insetAll、update方法注入
0x00 前言 这个洞,早在9月29号的时候我提交给先知,那时候tp还是5.1.25的版本,天还很蓝,我也还很年轻.时至今日这个洞依旧没有审核,而tp在这期间都已经更新到了5.1.29.在最近我去跟踪 ...
- vue 开发环境搭建,超级简单仅需3步。
1,打开 http://nodejs.cn/download/ 下载 nodejs,并安装. 2,成功以后,启动cmd命令行,输入npm install -g cnpm --registry=htt ...