参考文章:https://blog.csdn.net/qq_37250305/article/details/80608477

1、自己写测试例子时,报错:couldn’t check if tables are already present using metadata:
2、首先:本地Mysql数据库版本是5.7.17的,而项目运行时,用的驱动是8.0.26的,如下图所示:

3、于是,修改pom.xml文件,mysql驱动增加版本,如下图所示:

4、接着修改配置文件下的驱动类名称,8.0.26用的是com.mysql.cj.jdbc.Driver,改为com.mysql.jdbc.Driver,如下图所示:

5、运行项目,发现还是一样报的couldn’t check if tables are already present using metadata,于是在配置文件url底下,加了这么一串字符:
?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC&nullCatalogMeansCurrent=true

6、运行还是报错,最后发现原因:配置类与启动类同包或者在其子包下
而在启动类下加了一行代码:

ApplicationContext context = new AnnotationConfigApplicationContext(DataSourceConfig.class);

然而Spring容器在启动的时候会去扫描@Configuration,并将相关的类进行加载。并且配置类与启动类须同包或者在其子包下。因此上面的代码无需增加,只需要改下存放配置类的路径即可。

后面发现跟第一点的驱动版本也没关系,5.7.17版本可以用8.0.26的驱动程序,但是改成5.1相关的驱动程序也没关系。。。

我真的是菜鸡,菜鸡,菜鸡。。。哎

SpringBoot报错couldn‘t check if tables are already present using metadata:相关推荐

  1. SpringBoot报错:Could not autowire. No beans of ‘DiscussantMapper‘ type found

    SpringBoot报错:Could not autowire. No beans of 'DiscussantMapper' type found 一.资源 @Mapper和@Repository注 ...

  2. 启动springboot报错Error creating bean with name 'dataSource' defined in class path resource

    2019独角兽企业重金招聘Python工程师标准>>> 启动springboot报错Error creating bean with name 'dataSource' define ...

  3. 转载:Android Studio 3.1.2 新项目报错 AAPT2 error: check logs for details (Gradle 3.1.2)

    转载自 https://blog.csdn.net/u011618035/article/details/80574645 原本好好的项目,突然有一天打开就开始报错AAPT2 error: check ...

  4. 【杂文】spring-boot报错 ~ zone value ‘Öйú±ê׼ʱ¼ä‘ is unrecognized or represents more than on time zone.

    spring-boot报错 zone value 'Öйú±ê׼ʱ¼ä' is unrecognized 修改MySQL的配置文件(failed) 更改MySQL中的系统时间(failed) 修 ...

  5. springboot报错!!!

    点击运行springboot,再在浏览器访问路径的时候,报错!!! 运行结果出来了,但是再结束的时候报错. springboot报错java.lang.NoSuchMethodError: javax ...

  6. 【Debugger】解决springboot报错Failed to resolve org.junit.platform:junit-platform-launcher:1.x.x的两种解决方案

    [Debugger]解决springboot报错Failed to resolve org.junit.platform:junit-platform-launcher:1.x.x的两种解决方案 主要 ...

  7. springboot文件上传报错:Required request part ‘file‘ is not present

    文件上传报错:Required request part 'file' is not present 如下使用CommonsMultipartResolver: @Configuration publ ...

  8. springboot报错:class path resource cannot be opened because it does not exits

    问题描述:springboot报错:在使用@PropertySource注解读取properties文件时,报错:class path resource cannot be opened becaus ...

  9. 前端代码与后端联调:报错:Required String parameter ‘userID‘ is not present

    后端框架: SpringBoot 前端框架: React ajax 前端界面使用 ajax进行请求url链接 传递参数:username 数据类型 String 报错: Required String ...

最新文章

  1. 【Java学习笔记之二十五】初步认知Java内部类
  2. 前端开发网络——Ajax(GET、POST)
  3. ReactNative环境配置
  4. Python的Lock对象和Condition对象对比
  5. 关于QT中对窗口中某个widget建类
  6. truncate(can)
  7. 经验分享 | 我是如何从小白到收获几个不错的offer!
  8. 【软考】(五)网络互联设备
  9. 获取对话框当前cfont_flutter根据控件位置弹出对话框
  10. 管理感悟:正确认识自己的工作
  11. Apizza--特别好用的 Http请求模拟工具 PHP写接口然后测试详细教程
  12. python中if else语句用法_Python条件语句详解:if、else、switch都有了
  13. 网络存储学习之网络存储技术的发展现状及趋势
  14. 使用TypeScript两年后,还值得吗?
  15. 干货来啦!「敏捷开发畅想与实战」沙龙回顾
  16. 如何将Mac升级到High Sierra
  17. python做题记录之正方形拼接
  18. 方舟服务器建家位置,方舟生存进化新手建家图文攻略 方舟生存进化在哪建家比较好-游侠网...
  19. CLRS 17.4动态表
  20. python 大智慧接口_大智慧股票本地数据读取接口(含源码)

热门文章

  1. .net framework4与其client profile版本的区别
  2. Hibernate 学习-1
  3. 数据结构(C语言版)顺序栈相关算法的代码实现
  4. UML建模之状态图(Statechart Diagram)
  5. [置顶] 有关ListIterator接口的add与remove方法探究
  6. android activity详解一:概述
  7. 整理下STL algorithms(3)
  8. [ app.json 文件内容错误] app.json: [“usingComponents“][“van-button“]: “@vant/weapp/button/index“ 未找到
  9. 从减少DNS查找来优化网站
  10. 实现背景透明的方法,兼容ie6/7/8等浏览器