标签:span add public http pack cat res body 最大
1 最大的坑先记录一下
利用feign发post请求,参数放在请求体中
package com.example.demo.controller; import com.example.demo.bean.User; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/user") public class UserAction { @RequestMapping("/list") public Object list(){ return "sdfsdfsdfsdf"; } @RequestMapping("/add") public Object add(@RequestBody User user){ return "sdfsdfsdfsdf"; } }
package com.example.demo.feign; import com.example.demo.bean.User; import feign.Body; import feign.Headers; import feign.Param; import feign.RequestLine; public interface Invorker { @RequestLine(value = "POST /user/add") @Headers("Content-Type: application/json") public Object add(User user); @RequestLine("GET /user/list") public Object list(); }
标签:span add public http pack cat res body 最大
原文地址:https://www.cnblogs.com/hzzhero/p/9867966.html