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. Python3网络爬虫--爬取有声小说(附源码)

    目录 一.目标 1.首页 2.网页源代码 二.爬取详情页 1.查看详情页 2.小说详情 3.小说简介 4.播放列表 三.爬取小说音频 1.确定数据加载方式 2.寻找真实音频播放地址 3.URL解码 4 ...

  2. 新安装的eclipse没有新建java project----解决方法:安装插件

    问题描述:最近新安装的一个eclipse版本,建立新工程的时候发现没有java project选项,如下: 百度了一些资料:https://blog.csdn.net/sinat_41752599/a ...

  3. 拉勾java核心类库--String类

    String类 @author :magiclx 摘要:String类是用final进行修饰的,关于字符串的一个类,其中包含很多个方法 关键词:String,常量池,正则表达式,数组转化 正文: 参考 ...

  4. Linux 常用杂项命令

    1.查看监听端口的进程名称 lsof -i:[3306] # 3306是端口名称 2.查看PID进程文件的位置 ls -al /proc/51955/exe # 51955是进程PID

  5. Vue 使用插件nprogress页面加载进度条

    下载 npm i nprogress 在main.js中引入: import App from './App' import VueRouter from 'vue-router' import ro ...

  6. [ABC284F] ABCBAC(字符串哈希)

    思路 这里我们要注意以下几点: 字符串哈希自然溢出(\(\pmod 2^64\))会被卡,会\(WA~5\)个点 注意有模数的时候不要用\(unsigned\ long \ long\)类型 代码 # ...

  7. MOBIUS: Towards the Next Generation of Query-Ad Matching in Baidu's Sponsored Search——百度下一代搜索广告系统

    简介 传统的广告最终的呈现需要经过召回与排序两个阶段,百度的搜索架构则采用三层漏斗状,如图1所示.最上面的一层用于筛选出和用户查询最相关的一部分广告,将整个候选广告集从亿级降到千级:下面两层是排序阶段 ...

  8. Identityserver4 ClientCredentials授权

    转自:https://www.cnblogs.com/hyqq/p/14138024.html:侵删. Client Credentials 客户端应用不代表用户,客户端应用本身就相当于资源所有者 通 ...

  9. [rk3568][common] 环境搭建

    1. 安装依赖 sudo apt-get install uuid uuid-dev zlib1g-dev liblz-dev liblzo2-2 liblzo2-dev lzop \ git-cor ...

  10. CSP2022-S游寄

    游寄游寄,顾名思义,边游边寄 11.00AM 起床 复习了一下各种终端命令,然后又复习了一下对拍 虽然都没用到 然后接着睡. 有点小紧张,毕竟一年没搞OI 12.00AM 今天吃河虾 还行,只是有点扎 ...