swagger报Whitelabel Error Page status=405问题解决

访问swagger链接时报如下错误

 

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Mar 17 20:14:30 CST 2022

There was an unexpected error (type=Method Not Allowed, status=405).

Request method 'GET' not supported

原因是@PostMapping 没有配置路径

   @PostMapping
    public UserInfoResponse queryUserNameById(@RequestBody UserInfoRequest request){
        log.info("查询用户姓名请求参数",request);
        UserInfoResponse response = userService.selectUserNameById(request);
        log.info("查询用户姓名返回参数",request);
        return response;
    }

你可能感兴趣的:(异常,p2p,网络协议,网络)