mysql的驱动类com.mysql.jdbc.Driver过时了,需要用com.mysql.cj.jdbc.Driver代替
springboot项目整合mybatis,配置文件如下:
server: port: 8081 mybatis: config-location: classpath:mybatis/mybatis-config.xml #mybatis配置文件所在路径 type-aliases-package: com.yuanqiao.entities #所有entity别名类所在包 mapper-locations: classpath:mybatis/mapper/*.xml spring: application: name: swaggerdemo datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC username: root password: 123456 dbcp2: min-idle: 5 #数据库连接池的最小维持连接数 initial-size: 5 #初始化连接数 max-total: 5 #最大连接数 max-wait-millis: 200 #等待连接获取的最大超时时间
做sql查询的时候,提示com.mysql.jdbc.Driver已经弃用了。
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5540e55e] was not registered for synchronization because synchronization is not active
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2019-07-20 16:16:42.533 INFO 59084 --- [nio-8081-exec-2] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@366b8e6b] will not be managed by Spring
==> Preparing: select * from user where id = ?
==> Parameters: 1(Integer)
<== Columns: id, name, sex, age
<== Row: 1, zhangsan, male, 22
<== Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5540e55e]
原文地址:https://www.cnblogs.com/mkl34367803/p/11218145.html
- MySQL 教程
- MySQL 安装
- MySQL 管理与配置
- MySQL PHP 语法
- MySQL 连接
- MySQL 创建数据库
- MySQL 删除数据库
- MySQL 选择数据库
- MySQL 数据类型
- MySQL 创建数据表
- MySQL 删除数据表
- MySQL 插入数据
- MySQL 查询数据
- MySQL where 子句
- MySQL UPDATE 查询
- MySQL DELETE 语句
- MySQL LIKE 子句
- mysql order by
- Mysql Join的使用
- MySQL NULL 值处理
- MySQL 正则表达式
- MySQL 事务
- MySQL ALTER命令
- MySQL 索引
- MySQL 临时表
- MySQL 复制表
- 查看MySQL 元数据
- MySQL 序列 AUTO_INCREMENT
- MySQL 处理重复数据
- MySQL 及 SQL 注入
- MySQL 导出数据
- MySQL 导入数据
- MYSQL 函数大全
- MySQL Group By 实例讲解
- MySQL Max()函数实例讲解
- mysql count函数实例
- MYSQL UNION和UNION ALL实例
- MySQL IN 用法
- MySQL between and 实例讲解
- 微信小程序实现时间轴和地区列表的功能
- Android ListView的Item点击效果的定制
- Android Application存取公共数据的实例详解
- Android Handler的详解及实例
- Android 通过Intent调用系统拍照程序出现图片太小的问题解决办法
- Android Bitmap压缩方式分析
- Android自定义View实现游戏摇杆键盘的方法示例
- 详解Android Libgdx中ScrollPane和Actor事件冲突问题的解决办法
- Android ImageView的selector效果实例详解
- 完美解决关于禁止ViewPager预加载的相关问题
- Android开发之OpenGL绘制2D图形的方法分析
- Android实现RecyclerView下拉刷新效果
- 详解 Android中Libgdx使用ShapeRenderer自定义Actor解决无法接收到Touch事件的问题
- Android Shader应用开发之雷达扫描效果
- Android开发之绘制平面上的多边形功能分析