mysql和springboot还有mybatis版本搭配的一些坑

mysql版本8.0

报错:Wed Dec 19 22:42:12 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

把:

spring.datasource.url=jdbc:mysql:///:3306/sso?

换成 

spring.datasource.url=jdbc:mysql:////sso?useUnicode=true&characterEncoding=utf-8&useSSL=false

解决。

springboot使用2.0.8.BUILD-SNAPSHOT版本

mysql驱动包默认是:

可以还成8.0.11版本的,中间遇到点坑具体未及时记录了,,,

最终版本的搭配如下:



    4.0.0
    
        org.springframework.boot
        spring-boot-starter-parent
        2.0.8.BUILD-SNAPSHOT
         
    
    com.mcshop
    demo0101
    0.0.1-SNAPSHOT
    demo0101
    Demo project for Spring Boot

    
        1.8
    

    
        
            org.springframework.boot
            spring-boot-starter-data-redis
        
        
            org.springframework.boot
            spring-boot-starter-jdbc
        
        
            org.springframework.boot
            spring-boot-starter-web
        
        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            1.3.2
        
        
            mysql
            mysql-connector-java
            8.0.11
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            com.alibaba
            fastjson
            1.2.31
        
        
            com.alibaba
            druid
            1.1.10
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
        
            
                src/main/java
                
                    **/*.xml
                
            
            src/main/resources
        
    

    
        
            spring-snapshots
            Spring Snapshots
            https://repo.spring.io/snapshot
            
                true
            
        
        
            spring-milestones
            Spring Milestones
            https://repo.spring.io/milestone
        
    
    
        
            spring-snapshots
            Spring Snapshots
            https://repo.spring.io/snapshot
            
                true
            
        
        
            spring-milestones
            Spring Milestones
            https://repo.spring.io/milestone
        
    


application.properties配置如下:

#datasource
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql:///:3306/sso?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456.
#mybatis
mybatis.type-aliases-package=com.mcshop.demo0101.pojo
mybatis.mapper-locations=classpath:com/mcshop/demo0101/dao/*Mapper.xml

 

你可能感兴趣的:(随手一写)