Skip to content

🏎 使用spring data rest快速搞定restful接口

hacker-and-painter/spring-data-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

使用Spring Data REST构建微服务 (两行代码搞定RESTFul)

原文地址 Spring Data REST入门

快速开始

1. clone 本项目
2. 导入idea
3. 运行 SpringDataRestApplication.java

教程

文章目录下

运行效果

  • POST 新增User

同样方式新增几条测试数据

  • GET查询

    • 列表查询

    • 主键查询

    • 分页查询

    • 分页+排序查询

  • PUT、POST更新数据

或者

  • DELETE删除数据

测试完毕 最后再看一下项目结构

注意点

spring data rest 默认是不暴露id的,需要加个配置类

@Configuration
public class RepositoryConfig extends RepositoryRestConfigurerAdapter {
    @Override
    public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
        config.exposeIdsFor(User.class);
    }
}

参考

https://www.imooc.com/article/15706

spring data rest and swagger

https://github.com/LINKIT-Group/spring-data-rest

About

🏎 使用spring data rest快速搞定restful接口

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages