在RequestMapping中获取和发布

时间:2019-07-01 14:29:52

标签: java spring spring-mvc

我正在测试以下RequestMapping:

@RequestMapping(value="/review", method=RequestMethod.POST)
public String reviewData( HttpServletRequest request, 
        HttpServletResponse response, 
        HttpSession session, 
        @RequestBody HashMap<String, Object> data,
        @CurrentUser User user) throws Exception {
    System.out.println("Hello World!");
}

我正在测试此代码,希望数据可以从供应商的API发送到该代码;我已经通过他们的文档进行了确认,并根据与开发人员的对话进行了确认。尽管如此,我仍然收到405错误:

Request method 'GET' not supported

我对这个问题不知所措,愿意接受建议。我实际上想知道以下RequestMapping是否可以正常工作来对此进行补救?

@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})

0 个答案:

没有答案
相关问题