[SrpingBoot]初步搭建springboot应用,报错:Failed to configure a DataSource: 'url' attribute is not specified and no embedd[转载]
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[转载]的更多相关文章
- 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 ...
- 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 创建 ...
- 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 ...
- SpringBoot 2.0 报错: Failed to configure a DataSource: 'url' attribute is not specified and no embe
问题描述 *************************** APPLICATION FAILED TO START *************************** Description ...
- 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}),但是这样会排除 ...
- springboot项目启动报错 Failed to configure a DataSource: 'url' attribute is not specified and no embedde
参考:https://blog.csdn.net/Coyotess/article/details/80637837
- springboot启动报错Failed to configure a DataSource
2018-11-21 19:43:12.076 WARN 5392 --- [ main] ConfigServletWebServerApplicationContext : Exception e ...
- 新建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 ...
- 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 ...
- 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 ************ ...
随机推荐
- 最短路算法之 Dijkstra
部分内容参考了李煜东的<算法竞赛进阶指南>,在此声明. 单源最短路径 单源最短路径问题,是说,给定一张有向图(无向图)\(G=(V,E)\) ,\(V\) 是点集,\(E\) 是边集,\( ...
- Verilog 变量声明与数据类型一
Verilog 变量声明与数据类型一 Verilog语法中最基本的数据类型有 线网(wire),寄存器(reg)和整数(integer)三种类型,这三种数据类型是可综合的数据类型,在Verilog 程 ...
- 互联网架构 之备份服务器 rsync
备份服务器(Rsync) 1.介绍备份的场景 1.什么情况下需要备份 一般数据比较重要的情况下,数据如果丢失很容易找不回来了的,建议备份. 2.什么是备份 将原有的数据复制一份或几份存起来,以备不时之 ...
- doy 18 定时任务
1.定时任务 1.什么是定时任务 类似日常生活之中的闹钟:主要用于定时执行某些命令,达到定时处理数据的作用. 2.定时任务的软件的种类 1.linux操作系统自带的软件:crontab 2.第三方的定 ...
- rust-must-know-crates-5ad8 100DayOfRust
https://dev.to/cad97/rust-must-know-crates-5ad8 https://dev.to/search?q=100DayOfRust https://fastert ...
- How to enable CIFS in kernel 4.9
kernel config 要打开这几项
- mysql修改数据库表及字段的编码格式
1.修改表的编码格式 ALTER TABLE `table` DEFAULT CHARACTER SET utf8; 2.修改字段编码格式 ALTER TABLE `table` CHANGE `字段 ...
- Java VSCode 基础教学
VSCode 超全设置1.下载2.插件安装3.项目创建4.设置5.快捷键6.优化7.导出 Jar 包 VSCode 超全设置 VSCode(Visual Studio Code) 是一款 Micros ...
- 简单总结一下html中能见到的各种相对路径
试列举如下(在本文中,星号表示资源名): href="/*" href="//*" href="*" href="./*" ...
- 搭建rust开发环境
1.打开https://www.rust-lang.org/tools/install 下载64位安装器 选择第一项默认安装 安装器会下载安装rust 相关工具链,并添加path C:\Users\z ...