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. 用-pthread替代-lpthread

    -pthread 在多数系统中,-pthread会被展开为"-D_REENTRANT -lpthread".作为编译参数可以通知系统函数开启多线程安全特性,比如将errno定义线程 ...

  2. SpringBoot+MongoDB实现物流订单系统

    码字不易,点赞收藏,养成习惯!原创作者公众号:bigsai.更多精彩期待与您分享!项目收录在github的MongoDB案例中,文章收录在回车课堂中如果没基础请看看前两篇(墙裂推荐)MongoDB从立 ...

  3. pytest文档49-命令行参数--tb的使用

    前言 pytest 使用命令行执行用例的时候,有些用例执行失败的时候,屏幕上会出现一大堆的报错内容,不方便快速查看是哪些用例失败. --tb=style 参数可以设置报错的时候回溯打印内容,可以设置参 ...

  4. golang拾遗:为什么我们需要泛型

    从golang诞生起是否应该添加泛型支持就是一个热度未曾消减的议题.泛型的支持者们认为没有泛型的语言是不完整的,而泛型的反对者们则认为接口足以取代泛型,增加泛型只会徒增语言的复杂度.双方各执己见,争执 ...

  5. git学习(六) git reset操作

    git reset 操作 git reset git reset HEAD 文件名 移除不必要的添加到暂存区的文件 git reset HEAD^ 或者 commitid 去掉上一次的提交 git r ...

  6. ng中的ng-content ng-template ng-container

    在angular中,有这样三个自带的标签,但是在angular的文档中没有说明,只有在api中有简单的描述,摸索了半天才搞懂是咋回事. ng-content <div> <ng-co ...

  7. springmvc maven 入门及页面拿不到controller的值 显示${message} el表达式不起作用

    1:参考https://www.cnblogs.com/zhuawang/p/5651896.html 操作完,运行,结果不是后端控制器controller返回的,是index.jsp中的. 因为执行 ...

  8. oVirt4.4虚拟机备份方法

    红帽oVirt于今年推出了oVirt 4.4,该版本在系统.存储.网络.用户界面等方面做出增强功能与优化更新,为oVirt用户提供功能更强大.更灵活的IT基础架构.云祺科技也于最近发布了全新版本云祺容 ...

  9. java后端选型20200729

    参考地址:https://gitee.com/shuzheng/zheng 后端技术: 技术 名称 官网 Spring Framework 容器 http://projects.spring.io/s ...

  10. C1. Pokémon Army (easy version) 解析(DP)

    Codeforce 1420 C1. Pokémon Army (easy version) 解析(DP) 今天我們來看看CF1420C1 題目連結 題目 對於一個數列\(a\),選若干個數字,求al ...