BSpring
application (java
) all controllers worked adequately (taking /adding /changing /deleting, i.e.GET
/POST
/PATCH
/DELETE
requests), however after adding the dependencySpring Security
at some point the methods stopped workingDELETE
andPATCH
... Moreover, the methodsGET
\POST
work properly for all controllers. When trying to access methodsPATCH
\DELETE
throws 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?
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- java : Spring does not create an object, throws an exception that the class has an invalid property
- java : Spring mvc not finding bean @Service UserService
- java : Get the same AnonymousAuthenticationToken object from the SecurityContextHolder
- java : Restricting access to data by organization
- java - sprin boot + mybatis + h2 does not launch the app properly
- java - how to separate spring common processing for each project
- receiving json data in java
- java - i can't understand the transition relationship of html files in spring boot
- java - i want to format a variable in the text
Attach Spring Security configuration to question
Alexandr2021-02-25 01:48:38