RESTFull 一种互联网软件架构设计的风格,但它并不是标准,它只是提出了一组客户端和服务器交互时的架构理念和设计原则,基于这种理念和原则设计的接口可以更简洁,更有层次;

如果一个架构符合REST原则,就称它为RESTFull架构;

比如我们要访问一个http接口:http://localhost:80080/api/order?id=1521&status=1

采用RESTFull风格则http地址为:http://localhost:80080/api/order/1021/1

2. springboot 中开发RESTFull

Spring boot开发RESTFull 主要是几个注解实现:

1、@PathVariable
    获取url中的数据;
    该注解是实现RESTFull最主要的一个注解;
2、增加 post方法
    PostMapping;
    接收和处理Post方式的请求;
3、删除 delete方法
    DeleteMapping;
    接收delete方式的请求,可以使用GetMapping代替;
4、修改 put方法
    PutMapping;
    接收put方式的请求,可以用PostMapping代替;
5、查询 get方法
    GetMapping;
    接收get方式的请求;

相关文章:

  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-07-28
  • 2021-09-08
猜你喜欢
  • 2021-04-18
  • 2020-10-05
  • 2021-03-31
  • 2021-12-12
  • 2021-11-05
  • 2021-02-20
相关资源
相似解决方案