Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.

从报错信息中,我们就可以分析出错误原因是触发了数据源的自动化配置,然而当前项目其实并不需要数据源。查其根源是依赖方提供的API依赖中引用了一些多余的依赖触发了该自动化配置的加载。
如何解决
为了解决上面所述的问题,我们可以用两种方法来解决:
- 通过外部依赖的修改来解决:通过与依赖方沟通,在对方提供的API依赖中去掉不必要的依赖
- 通过禁用指定的自动化配置来避免加载不必要的自动化配置,下面列举了禁用的方法:
使用了@EnableAutoConfiguration的时候
- 1 @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
使用了@SpringBootApplication的时候
- 1 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
使用了@SpringCloudApplication的时候
- 1. @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
- 2. @SpringCloudApplication
通过配置文件来设置
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.的更多相关文章
- 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 ...
- 记一次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启动报错 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使用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 ************ ...
- 新建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 ...
- 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 ...
- springboot项目启动报错 url' attribute is not specified and no embedded datasource could be configured
报错相关信息: 2019-07-22 17:12:48.971 ERROR 8312 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : **** ...
- SpringBoot框架:'url' attribute is not specified and no embedded datasource could be configured问题处理
一.问题如下: Description: Failed to configure a DataSource: 'url' attribute is not specified and no em ...
- Configure swagger with spring boot
If you haven’t starting working with spring boot yet, you will quickly find that it pulls out all th ...
随机推荐
- 参看gitlab版本号
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
- Oracle课程档案,第十天
用户管理 Authentication: 身份验证 AAA:Authentication: 身份验证 Authorization: 权限管理 Audition: 审计 grant:授权 unset:撤 ...
- Linux在终端命令行模式下智能补全功能以及组合键
linux命令行下也有很多热键(快捷键).先来看看tab键 1.如果想看看linux下以c开头的命令可直接在命令行下敲入c然后连续敲两次tab,再选择y,会显示所有以c开头的命令. 2.涉及到文件时, ...
- day17 十七、时间模块
一.时间模块 import time print(time) # <module 'time' (built-in)> import time print('暂停开始') secs = t ...
- grpc,protoc, protoc-gen-go,rust
Rust 与服务端编程的碎碎念https://zhuanlan.zhihu.com/p/30028047 GRPC:golang使用protobuf https://segmentfault.com/ ...
- Xcode工程编译错误之iOS开发之Sending '__strong typeof (xxx)' (aka 'xxxx *__strong') to parameter of incompatible type 'id<xxx>'
iphone开发出现警告: Sending '__strong typeof (xxx)' (aka 'xxxx *__strong') to parameter of incompatible ty ...
- Mac 启动或者禁用翻盖自动开关机
从 2016 新款 MacBook Pro 起,预设打开笔电上盖或连接电源供应器时,电脑就会自动开机而且开机时没有启动声,本文教你如何将这些东西调整回原本的样子. 以下指令都是通过「应用程序」→「终端 ...
- linux 单次定时任务
使用at =======查看当前任务========= at -l 或者atq =======查看任务执行什么===== at -c =======配置任务========= at 02:00 ...
- Ch04 映射和元组 - 练习
1. 设置一个映射,其中包含你想要的一些装备,以及它们的价格.然后构建另一个映射,采用同一组键,但在价格上打9折. import scala.collection.JavaConversions.as ...
- Parco_Love_gcd
传送门 出题人说正解为RMQ,鄙人实在太蒟蒻了,不会呀只能暴力…… #include <bits/stdc++.h> using namespace std; #define ll lon ...