轻轻松松学习SpringBoot2:第十七篇: 数据库操作异常

一:Spring Boot 数据库配置之后,启动工程,发现并没有读取配置文件,即使配置文件数据库配置是错的(比如用户名不存在等),程序还是可以正常运行,也不报错

解决方案:新建工程


二:Establishing SSL


这是因为msyql版本太高导致

解决方案:在数据库配置项中加入useSSL=true

url: jdbc:mysql://127.0.0.1:3306/test?useSSL=true

三:No identifier specified for entity: com.example.test.Test

这是因为jpa中id需要是主键,加上注解即可

解决方案

    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }

猜你喜欢

转载自blog.csdn.net/stronglyh/article/details/80890076