天天看點

springcloud使用feign報錯

報錯

 Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is feign.FeignException: status 405 reading ProductClient#listForOrder(List); content:

{"timestamp":"2018-10-15T02:59:36.639+0000","status":405,"error":"Method Not Allowed","message":"Request method 'POST' not supported","path":"/product/listForOrder"}] with root cause

原因,我使用了

@RequestBody
           

使用了這個注解,就不能使用@GetMapping而是使用@PostMapping

隻有單個參數@RequestParam或者無參的時候,可以使用@GetMapping

或者@PathVariable @RequestBody兩個注解連用可以使用@GetMapping

繼續閱讀