美文网首页
springboot work with mysql

springboot work with mysql

作者: 韫秋 | 来源:发表于2019-02-23 14:50 被阅读0次

    I am so terrible.
    I have learned springboot for weeks and achive no success.
    I am upset.
    I've forgot the whole lessons when I learn a new one and that's killing me.
    and now let's count.
    I've learned eight lessons and there's four which are key lessons.
    1 - how to access the static source
    2 - how to catch the exception overall situation.
    3 - how to work with the freemarker.
    4 - how to work with the JSP
    and now,I am working on how to work with the mysql.
    I just made a mistake that comes out an error when I try to run my apps.
    Let's organize our thoughts.


    first of all,we'll add dependencies into the pom file.
    and that's it:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
      </dependencies>
    

    and second,we'll add some content into the application.properties file,just like this:

    spring.datasource.url=jdbc:mysql://localhost:3306/test
    spring.datasource.username=root
    spring.datasource.password=123456
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver
    

    the datasource url shows that we'll entry the test database and that's true.
    and all the things are correct by now and it will achive a success smoothly.

    write an service.class

    I've wrote a UserService.class just like this:

    
    

    the error message shows belows:

    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.
    
    image

    my mysql verison is 8.0.15。但是,在我的引入的依赖当中,

    相关文章

      网友评论

          本文标题:springboot work with mysql

          本文链接:https://www.haomeiwen.com/subject/ajqpyqtx.html