Spring Security - 405 Request Method 'POST' Not Supported

前端 未结 6 1448
执笔经年
执笔经年 2021-01-13 10:31

I have implemented Spring Security to my project, but I am getting status 405 when I try to log in. I have already added csrf token in the form.

6条回答
  •  逝去的感伤
    2021-01-13 11:12

    You can set two endpoints for one url. But you cannot set any request parameter as required. As I saw your request map for login, you can set your request method like this:

    @RequestMapping(value = "/login", method = { RequestMethod.GET, RequestMethod.POST })
    public ModelAndView loginPage() {
        return new ModelAndView("login");
    }
    

提交回复
热议问题