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

错误原因:

显然,根据错误原因可知找不到数据源配置。但是由于依赖方提供的API依赖中引用了一些多余的依赖触发了该自动化配置的加载,详情查看:https://blog.csdn.net/dyc87112/article/details/73739535,导致数据源配置自动启动生效。

这里是由于依赖了:

<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>

解决方案:

1.不配置数据源的情况下:

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, MailSenderAutoConfiguration.class})

详细请参考:https://zhuanlan.zhihu.com/p/96508798

2.配置数据源:本文数据源配置在yml文件中:

spring:
datasource:
url: jdbc:mysql://xxxxxxxxxx
username: xxx
password: xxx
driver-class-name: com.mysql.jdbc.Driver

注意:pom文件中package类型不能为pom,否则项目编译后target中没有yml配置文件,同理打包后jar包中也没有yml配置文件。

如下位置:

 <groupId>com.xxx</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<!--<package>pom</package>-->
<description>Demo project for Spring Boot</description>

以上!

												

关于“Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.”的更多相关文章

  1. 新建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 ...

  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. 记一次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 ...

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

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

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

  7. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

    SpringBoot项目编译成功,启动报错 提示信息很明显,通过查看依赖关系,可以找到原因 导致这个问题的原因是因为,在 pom.xml 配置文件中,配置了数据连接技术 spring-boot-sta ...

  8. 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) 作用://取消数据库配置 但是 在用到数据库的时候记 ...

  9. 5. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

    解决方案,见  https://www.jianshu.com/p/836d455663da

随机推荐

  1. 多测师讲解内置函数 _format_高级讲师肖sir

    #python中的格式化输出:format()# 和%号格式化输出一样,是%号的另外一种格式#1.不设置指定位置,按默认顺序 a ='{}'.format('hello','nihao','dajia ...

  2. jenkins 构建 job 并获取其状态的实现

    目录 BACKGROUND INVESTIGATION I 1. 连续触发的相同 job 构建不会重复入队 2. 连续触发的不同 job 构建会各自入队 3. 参数变动的相同 job 构建将分别入队 ...

  3. python算法常用技巧与内置库

    python算法常用技巧与内置库 近些年随着python的越来越火,python也渐渐成为了很多程序员的喜爱.许多程序员已经开始使用python作为第一语言来刷题. 最近我在用python刷题的时候想 ...

  4. Socket编程,C语言版!

    socket编程--send函数&recv函数详解 一.send函数 ✍ 函数原型: int send( SOCKET s,char *buf,int len,int flags ); ✍ 功 ...

  5. 一文读懂Redis常见对象类型的底层数据结构

    Redis是一个基于内存中的数据结构存储系统,可以用作数据库.缓存和消息中间件.Redis支持五种常见对象类型:字符串(String).哈希(Hash).列表(List).集合(Set)以及有序集合( ...

  6. Anderson《空气动力学基础》5th读书笔记 第0记——白金汉PI定理

    目录 量纲分析:白金汉PI定理 相似参数 量纲分析:白金汉PI定理 在空气动力学中,飞机的空气动力主要由自由来流的密度ρ∞,自由来流数V∞,翼弦长度c,自由来流的粘性系数μ∞以及音速a∞,所以假设我们 ...

  7. 记一次py交易

    讲一个故事 以下故事真实性不保证(你们懂的) 我没说这个是真的 所以不能当做以后别人挑我刺的证据 我只是讲个故事罢了 故事可以是fake 我不会承认这个故事是真的罢了 朋友是某c9高校工科专业 学校培 ...

  8. LeakCanary检测(二)

    在主方法主实现一个内存泄漏,检测到手机会发送通知,也可以用利用androidStudio自带的Profile检测内存泄漏 public class MainActivity extends AppCo ...

  9. Go之NSQ简介,原理和使用

    NSQ简介 NSQ是Go语言编写的一个开源的实时分布式内存消息队列,其性能十分优异. NSQ 是实时的分布式消息处理平台,其设计的目的是用来大规模地处理每天数以十亿计级别的消息.它具有分布式和去中心化 ...

  10. List集合,对象根据某个相同的属性,合并另外属性

    描述及实现: 1.List中有 Modular字段值有重复一样的2.Modular字段一样的话去重并且OrderAmount相加 HashMap<String,DataReport> te ...