feign.FeignException$MethodNotAllowed: status 405 reading UserService#getUserList()
1) The called interface address consists of multiple parts. For example, the project is configured with the /base
address, the Controller
is configured with the /user
address, the interface is configured with the /getUserList
address, and the called interface address is only configured with /getUserList
address, resulting in an error.
@PostMapping("/getUserList")
List<User> getUserList();
You can configure the correct path by calling the interface.
@PostMapping("/base/user/getUserList")
List<User> getUserList();
2) The called interface is a Get
request, the parameters are not annotated with @RequestParam
, and the parameters of the calling interface are not annotated with @RequestParam
, resulting in an error.
@GetMapping("/base/user/getUserList")
List<User> getUserList(User user);
Parameters can be annotated with @RequestParam
.
@GetMapping("/base/user/getUserList")
List<User> getUserList(@RequestParam User user);