BSpringapplication (java) all controllers worked adequately (taking /adding /changing /deleting, i.e.GET/POST/PATCH/DELETErequests), however after adding the dependencySpring Securityat some point the methods stopped workingDELETEandPATCH... Moreover, the methodsGET\POSTwork properly for all controllers. When trying to access methodsPATCH\DELETEthrows the following error in the console:

WARN 15516 ---[nio-8080-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver: Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported]

At this time, on the link itself for this request, it produces the following result

If it's important, I can throw off the code of the rewritten methodconfigure (HttpSecurity http)... Also possibly important, controllers are implemented using annotations@Controller, but not@RestController...

What could be the problem?

Attach Spring Security configuration to question

Alexandr2021-02-25 01:48:38

1.try doing RestController annotation. 2. Pass the required header in the Content-Type, which is used to mark your PATCH /DELETE methods (most likely, you need to pass application-json)

Andrew Bystrov2021-02-25 01:48:38

@Alexandr Attached the configuration (if I understood correctly, if you need something else, please tell me)

Nick Alymov2021-02-25 01:48:38