一、报错信息如下

这个异常在Spring Boot中比较常见,在初次完成项目的构建后,因为Spring Boot 的自动配置时,检查到我们添加了数据源(Mysql)的相关的依赖包,结果在我们的配置文件中没有添加数据库相关的配置

二、解决方案

1、在 SpringBoot 应用程序启动时,排除 jdbc 的自动装配机制即可,在程序入口文件中新增配置注解

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

2、在开发库或者本地库中,如果有可用的临时数据库,可以先配置该库为暂时的数据库即可,在 application.properties 配置文件中,加入如下图配置内容:

spring.datasource.driver-class-name = com.mysql.jdbc.Driver
spring.datasource.url = jdbc:mysql://192.***.***.***:3306/etc_system?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username = root
spring.datasource.password = ***

3、如果先暂时使用不到数据库连接,只是测试搭建的项目是否能正常启动,可以先将该配置项注释掉即可,选中该项配置按快捷键 “ Ctrl + Shift + / ” 即可

三、再次启动成功

Tips:遇到错误别慌,沉着冷静,当你仔细专研的时候其实已经成功了一半,问题解决过后,仔细回想,这个问题也就那样。

当你慌的时候,你就失败了!!!!!!!!!!!

Spring Boot 报错:Failed to configure a DataSource相关推荐

  1. springboot报错Failed to configure a DataSource url attribute is not specified and no embedd

    Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could ...

  2. spring Boot 报错Failed to introspect Class [xxx] from ClassLoader

    因为之前把redis单打成jar包放入一个项目,然后该项目的jar包在cmd命令行运行报错,该问题主要原因是:因为redis包是外部包,spring在加载bean时,找不到对应的class文件, 部署 ...

  3. Jeecgboot报错Failed to configure a DataSource: ‘unl‘ attribute is not specified and no embedded dataso

    今天在配置文件都没变动过的情况下,启动的时候突然报这个bug,各种网上的方法都试过了. 都没用.折腾了我一个多小时.什么重启,清缓存都试过了,最后心一横,直接把maven库全删了重新拉取了.神奇的跑起 ...

  4. 解决Spring Boot报错Mapped Statements collection already contains value for...Error while adding the mapp

    解决Spring Boot报错Mapped Statements collection already contains value for...Error while adding the mapp ...

  5. Spring Boot 报错ThreadPoolTaskExecutor : Shutting down ExecutorService ‘applicationTaskExecutor‘

    问题 Spring Boot 报错ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 原因 ...

  6. spring Boot报错 之五种(不打包运行)

    Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as ...

  7. spring boot报错:Parameter 4 of constructor in xx required a bean of type ‘xx‘ that could not be found.

    spring boot 项目启动服务时,报错: 根据报错提示,一直认为是 SpringBootApplication 没有扫描到对应的 bean 路径. 最后,仔细排查发现是粗心的问题,自定义的常量没 ...

  8. 问题|启动Spring Boot报错-4处 @Spring Boot

    目录 描述 问题 问题1:Application failed to start with classpath 问题2:Unable to load authentication plugin 'ca ...

  9. 【Spring] Spring boot 报错 Unable to start ServletWebServerApplicationContext due to missing ServletWe

    1.概述 spring 报错如下 Error starting ApplicationContext. To display the conditions report re-run your app ...

最新文章

  1. matlab文档型数据导入,MATLAB-数据导入
  2. gerrit上sshkey设置问题
  3. 【学习笔记】Node.js学习笔记(二)
  4. perl大骆驼和小骆驼_你好骆驼:自动文件传输
  5. python-访问者模式
  6. 理解 C++ 的 Memory Order 以及 atomic 与并发程序的关系
  7. 织梦dedecms小说网站源码|带采集+搭建方式
  8. wxpython如何分开界面和运行代码_如何调试wxPython Demon源代码及几个细节
  9. Android项目实战(三十六):给背景加上阴影效果
  10. python文件处理——文本文件
  11. python下载付费文档教程-python爬文档
  12. 【ArcGIS进阶】制作土地利用转移矩阵
  13. 中级软考-软件设计师(一)
  14. 复原 IP 地址(回溯)
  15. mysql 金额大写_小写转大写金额_MySQL
  16. Life feelings--9--Mamba out 科比走了,给我们留下的那些惦念
  17. UG二次开发 创建圆柱和简单孔UF_MODL_create_simple_hole
  18. js实现图片上一张下一张点击
  19. 为什么要学习操作系统
  20. 悬挂运动控制系统 源代码 (05年电赛)

热门文章

  1. 最新最全最详细MacOS 10.14 Mojave黑苹果安装教程
  2. Android自定义权限与使用
  3. cesium 添加纽约城市模型
  4. (毕业设计资料)基于单片机SPWM逆变器电源系统设计
  5. 在docker centos 6.8安装lamp脚本
  6. 计算机专业应届生简历英语作文,计算机专业英文简历范文
  7. 利用官方工具刷REC
  8. 使用paddlepaddle做OCR识别
  9. java中相等和同一的区别
  10. GEE获取京津冀区域面积