For anybody having the same problem but csrf is disabled:
- Check that you permitted the controller url in your SecurityFilterChain if you are using Spring Security, although this should create an access denied exception.
- Make sure to select the correct mapping for the controller method. @GetMapping for a get request and @PostMapping for a post request.
If you send a post request to a method declared with @GetMapping spring boot will throw the 405 error.