SpringBoot has automatically configured HiddenHttpMethodFilter for us, but recently I found that it seems that it cannot be used. The SpringBoot version I am using is 2.2.2, and the default configuration has been changed to false. , that is, automatic configuration is turned off. I don’t know what sprongboot is. It’s a trap! ! !
There was an unexpected error (type=Method Not Allowed, status=405).
Request method 'POST' not supported
org.springframework.web.HttpRequestMethodNotSupportedException: Request method ' POST' not supported
To change the springboot configuration yml file to
spring: mvc: hiddenmethod: filter: enabled: true
The automatic configuration of SpringBoot turns off the spring.mvc.hiddenmethod.filter filter by default, so when When the data we submit is PUT, POST, or DELETE, the _method we use does not work.
spring.mvc.hiddenmethod.filter automatic configuration:
##3. Solution Just set the hiddenmethod.filter filter to enabled in Spring Boot's configuration file application.properties.spring.mvc.hiddenmethod.filter.enabled=true
The above is the detailed content of How to solve the error 405 when Springboot uses put and delete requests. For more information, please follow other related articles on the PHP Chinese website!