SpringBoot项目异常汇总

一:SpringBoot 报不支持Post 方法
报错信息:request method ‘post’ not supported

方法使用Get 访问没问题,表单提交时用POST方法
后台报 不支持 POST 方法

原因:项目中引入了 springSecurity 安全校验

正在使用具有CSRF保护的springSecurityFilterChain。这意味着当你通过POST请求发送表单时,你必须发送一个令牌。尝试将下一个输入添加到表单中

<!-- csrf防护未关闭时,需要添加 -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />

猜你喜欢

转载自blog.csdn.net/sinat_34979884/article/details/128117747
今日推荐