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. python3GUI--实用!B站视频下载工具(附源码)

    目录 一.准备工作 二.预览 1.启动 2.解析 3.下载中 4.下载完成 5.结果 三.设计流程 1.bilibili_video_spider 2.视频json的查找 四.源代码 1.Bilibi ...

  2. Sql Server新建一个只读权限的用户

    1,新建只能访问某一个表的只读用户. --添加只允许访问指定表的用户: exec sp_addlogin '用户名','密码','默认数据库名' --添加到数据库 exec sp_grantdbacc ...

  3. GDB 调试 - 正确地加载调试符号文件

    一.开发流程 1. 编译可执行文件 1 #include <stdio.h> 2 #include <unistd.h> 3 4 void test() 5 { 6 char ...

  4. django_静态文件

    **************************************************************************************************** ...

  5. 005Java开发环境搭建

    005Java开发环境搭建 1.JDK下载与安装 (1)卸载 首先我们先来学习一下如何卸载JDK. 删除Java的安装目录(jdk整个包). 删除环境变量里的"JAVA_HOME" ...

  6. angularJS依赖注入的个人理解

    依赖注入:一句话 --- 没事你不要来找我,有事我会去找你. AngularJS    5个核心组件用来作为依赖注入: value factory service provider constant ...

  7. AbstractRoutingDataSource - 动态数据源

    AbstractRoutingDataSource 类说明: (1)它的抽象方法 determineCurrentLookupKey() 决定使用哪个数据源. (2)项目启动时,先调用 setTarg ...

  8. 使用Wireshark查看HTTPS中TLS握手过程

    通过使用Wireshark抓包分析TLS握手的过程,可以更容易理解和验证TLS协议,本文将先介绍Wireshark解密HTTPS流量的方法,然后分别验证TLS握手过程和TLS会话恢复的过程. 一.使用 ...

  9. k8s 关于pull image failed 问题

    问题描述: Failed to pull image "nginx": rpc error: code = Unknown desc = failed to pul 解决办法: 1 ...

  10. MySQL学习(六)timestamp & datetime 区别

    参考博客: https://cloud.tencent.com/developer/article/1407693 timestamp只使用datetime一半的存储空间,并且会根据时区变化,具有特殊 ...