Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver cl

Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
mybatis逆向过程中出现的 ,用了最新的mysql 连接驱动

jdbc.driverClass   = com.mysql.dbc.Driver
jdbc.url = jdbc:mysql://127.0.0.1:3306/db?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT
jdbc.username = root
jdbc.password = root123
现在按照最新官方提示支持将com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver
jdbc.url = jdbc:mysql://127.0.0.1:3306/db?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT
jdbc.username = root
jdbc.password = root123

druid数据源

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid</artifactId>
    <version>1.0.18</version>
</dependency>

application.yml

mybatis:
  configuration:
     mapUnderscoreToCamelCase: true
  typeAliasesPackage: com.demo.entity
  mapperLocations: classpath:mapper/*.xml
spring:
  datasource:
    username: root
    password: 514730
    url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT
    driver-class-name: com.mysql.cj.jdbc.Driver
    # 使用druid数据源
    type: com.alibaba.druid.pool.DruidDataSource

application.proprrties

#spring.datasource.url=jdbc:mysql://localhost:3306/springboot?autoReconnect=true&useUnicode=true&characterEncoding=utf-8
#spring.datasource.username=root
#spring.datasource.password=514730
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
server.port=8789
spring.thymeleaf.cache=false
mybatis.mapper-locations= classpath:mapper/*.xml
mybatis.type-aliases-package=com.demo.entity
spring.thymeleaf.servlet.content-type= text/html 
spring.thymeleaf.mode: LEGACYHTML5
spring.ldap.embedded.ldif=ldap-server.ldif
spring.ldap.embedded.base-dn=dc=didispace,dc=com
#分页
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql

参考https://blog.csdn.net/anaini1314/article/details/71157791

猜你喜欢

转载自blog.csdn.net/weixin_33910385/article/details/87256568
今日推荐