springboot-jpa构建REST服务
①添加依赖
②在application.properties里配置连接池,jpa
③编写实体类
④编写dao接口,继承JpaRepository
基本增删改查接口就有了,用Postman测试接口
GET请求: http://127.0.0.1:8080/books //查询全部 books 实体类首字母小写加s
http://127.0.0.1:8080/books?page=0&size=2&sort=id,desc //分页,排序
http://127.0.0.1:8080/books/1 //查询id为1
POST请求:http://127.0.0.1:8080/books //添加
PUT请求:http://127.0.0.1:8080/books/3 //修改
DELETE请求:http://127.0.0.1:8080/books/4 //删除