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. homework1(1)

    来自桂林理工大学物联网工程2019届的April 没参与过什么比赛项目但是课程学习能力还行,主要是快速学习之后很快就会忘记,接下来应该好好的总结并熟练记住运用知识完成对生活等各种的实践. 对课程的希望 ...

  2. seleniumUI自动化学习记录

    2019.2.9 尝试了一个启动浏览器并打开指定网址的程序: 这里首先要注意的就是浏览器的版本和selenium jar包的版本必须符合才行,不然会报错 2019.9.16 必须要下载相应的chrom ...

  3. 十大经典排序之希尔排序(C++实现)

    希尔排序 思路: 1.选择一个增量序列 t1,t2,--,tk,其中 ti > tj, tk = 1(最后必须是1) 2.按增量序列个数 k,对序列进行 k 趟排序 代码实现: #include ...

  4. heimaJava18_线程

    Java 线程 单线程 线程(thread)是一个程序内部的一条执行路径. main方法的执行其实就是一个单独的执行路径 程序中如果只有一条执行路径,那么这个程序就是单线程的程序 多线程 多线程是指从 ...

  5. 对css及css3的大致整理(查漏补缺)

  6. Java线上日志分析

    1.查询关键字前后30行 cat 日志文件名.log | grep -30 '关键字' 例: cat mcs-all.log | grep -30 '2019-04-08 13:30:04,271' ...

  7. element ui 全选反选

    <el-checkbox class="selectAll" :indeterminate="isIndeterminate" v-model=" ...

  8. 【帆吖】Java学习零基础22

    Java数组

  9. 实验2:Open vSwitch虚拟交换机实践(补实验一作业链接)

    实验1:SDN拓扑实践 实验2:Open vSwitch虚拟交换机实践 一.实验目的 能够对Open vSwitch进行基本操作: 能够通过命令行终端使用OVS命令操作Open vSwitch交换机, ...

  10. 使用react-vite-antd,修改antd主题,报错 [vite] Internal server error: Inline JavaScript is not enabled. Is it set in your options? It is hacky way to make this function will be compiled preferentially by less

    一般报错 在官方文档中,没有关于vite中如何使用自定义主题的相关配置,经过查阅 1.安装less  yarn add less (已经安装了就不必再安装) 2.首先将App.css改成App.les ...