根据报错信息,你的Controller方法只支持GET请求,不支持POST请求。你需要在@RequestMapping注解中添加method属性来指定支持的请求方法。例如,如果你的Controller方法同时支持GET和POST请求,可以这样写:

@RequestMapping(value = "/queryOrderStatus", params = {"orderSn"}, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String queryOrderStatus(String orderSn){
    // ...
}

这样配置后,你的Controller方法就可以同时支持GET和POST请求了。

Spring Boot @RequestMapping 注解支持POST请求方法

原文地址: https://www.cveoy.top/t/topic/ohjB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录