1 错误信息

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
无法配置DataSource:未指定'url'属性,也无法配置嵌入数据源。

2 分析

即 在应用中尚未配置datasource的一些相关属性,例如:数据源连接URL,数据库驱动,用户名,密码等

SpringBoot的自动配置:我们只是需要提供配置文件的值,SpringBoot就会自动配置。配置在application.properties文件中。

#访问根路径

#应用名称
spring.application.name=springboot-demo #访问端口号
server.port=8080 #编码格式
server.tomcat.uri-encoding=utf-8 #数据库相关配置
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/sql_test
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5 #session生命周期
server.servlet.session.timeout=30m

3 其它解决方法

当然,也可不配置,但需要特别声明一下启动类头部声明:

@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})

4 参考文献

[SrpingBoot]初步搭建springboot应用,报错:Failed to configure a DataSource: 'url' attribute is not specified and no embedd[转载]的更多相关文章

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

  2. 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 创建 ...

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

  4. SpringBoot 2.0 报错: Failed to configure a DataSource: 'url' attribute is not specified and no embe

    问题描述 *************************** APPLICATION FAILED TO START *************************** Description ...

  5. 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}),但是这样会排除 ...

  6. springboot项目启动报错 Failed to configure a DataSource: 'url' attribute is not specified and no embedde

    参考:https://blog.csdn.net/Coyotess/article/details/80637837

  7. springboot启动报错Failed to configure a DataSource

    2018-11-21 19:43:12.076 WARN 5392 --- [ main] ConfigServletWebServerApplicationContext : Exception e ...

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

  9. SpringBoot项目刚刚创建就报异常,Failed to configure a DataSource: 'url' attribute is not specified and no embedded 的解决办法

    错误信息: Description: Failed to configure a DataSource: 'url' attribute is not specified and no embedde ...

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

随机推荐

  1. 一,创建一个electron应用程序

    之前我们已经用html+css+js创建了一个项目,现在将这个项目用electron以应用程序呈现. 1,首先新建一个文件夹,从终端进入该文件夹: 2,在该文件夹下执行npm init,初始化该项目. ...

  2. 解决黑苹果macOS Monterey系统无法正常睡眠、睡眠无法唤醒,唤醒后显示器无输出问题

    1.解决无法睡眠问题:添加睡眠补丁:HibernationFixup.kext, 或者添加ssdt:ssdt-GPRW.aml,并在ACPI补丁中添加热补丁: 2.解决睡眠后无法唤醒.唤醒后显示器无输 ...

  3. Java中int型数据类型对应MySQL数据库中哪种类型?

    java类   mysql数据库 java.lang.Byte byte TINYINT java.lang.Short short SMALLINT java.lang.Integer intege ...

  4. 关于TIdTCPClient的几种方法

    关于TIdTCPClient的几种方法 收藏  其实Indy比较简单,但是可以提供的方法太多了.我找了很久,才搞明白. 比方说这个读取缓冲区的数据,就有很多种方法.相对于TTcpClient的几种方法 ...

  5. 入门文章学习(一)-Beginner Tutorial

    Abstract: 参照"背景知识查阅"一文的学习路径,对几篇文章的学习做了记录.这是"Beginner Tutorial"一文的学习笔记. 文章链接: htt ...

  6. centos7中Firefox安装Flash插件

    第一步:先下载好Flash插件安装包,可以到Adobe官网下载.因为是linux 64位系统,所以要下个匹配的,我下载的是flash_player_npapi_linux.x86_64.tar.gz, ...

  7. SQLyog 13.1.1.0注册码证书秘钥

    注册信息: Name:(用户名随意) License Key: Professional: 8e053a86-cdd3-48ed-b5fe-94c51b3d343c Enterprise: a4668 ...

  8. Executors.newScheduledThreadPool()定时任务线程池

    定时任务线程池是由 Timer 进化而来 jdk中的计划任务 Timer 工具类提供了以计时器或计划任务的功能来实现按指定时间或时间间隔执行任务,但由于 Timer 工具类并不是以池 pool ,而是 ...

  9. table control的最小高度

    标准的表维护和不通过向导建的table control最小显示行是2. 通过向导建立的table control最小显示行是4. 前台没有任何能看出来的配置差异. 有个隐藏的最小显示行,只有把屏幕下来 ...

  10. Python批量采集百度资讯文章,如何自定义采集日期范围

    01 引言 大家好!蜡笔小曦有个朋友是做能源相关工作的,她想要有一个工具以天为单位持续地采集百度资讯中能源相关的文章进行留存和使用. 其中有个需求点是说能够自定义采集的开始日期和结束日期,这样更加灵活 ...