org.springframework.web.HttpRequestMethodNotSupportedException:不支持请求方法“GET”

问题描述 投票:0回答:1

使用 Spring security 和 Spring boot 查看页面不起作用

日志 2024-01-28T02:08:21.293+05:30 DEBUG 13196 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping :映射到 com.ims.controller.UserController#home() 2024-01-28T02:08:21.957 + 05:30调试13196 --- [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver:选择“text/html”给定[text/html,application/xhtml+xml,image/ avif,图像/webp,图像/apng,应用程序/xml;q=0.9,/;q=0.8,应用程序/签名交换;v=b3;q=0.7] 2024-01-28T02:08:21.958 + 05:30 DEBUG 13196 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView:视图名称“登录”,模型{} 2024-01-28T02:08:21.964+05:30 DEBUG 13196 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView :转发到[登录] 2024-01-28T02:08:21.979 + 05:30 DEBUG 13196 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet:“FORWARD”调度 GET“/login”,参数={} 2024-01-28T02:08:21.984 + 05:30警告13196 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver:已解决[org.springframework.web.HttpRequestMethodNotSupportedException:不支持请求方法“GET”] 2024-01-28T02:08:21.986 + 05:30 DEBUG 13196 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet:从“FORWARD”调度退出,状态405 2024-01-28T02:08:21.989 + 05:30调试13196 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet:已完成405 METHOD_NOT_ALLOWED 2024-01-28T02:08:21.991+05:30 DEBUG 13196 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet:“ERROR”调度 GET“/error”,参数={} 2024-01-28T02:08:21.991+05:30 DEBUG 13196 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping :映射到 org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#errorHtml( HttpServlet 请求、HttpServlet 响应) 2024-01-28T02:08:22.005 + 05:30调试13196 --- [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver:选择“text/html”给定[text/html,text/html;q=0.8] 2024-01-28T02:08:22.008 + 05:30 DEBUG 13196 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet:从“错误”调度退出,状态405

home controller class method

Allowed permit all

thymeleaf configs

login.html is not allowed

spring spring-boot spring-mvc spring-security spring-thymeleaf
1个回答
0
投票

我认为你应该禁用遇到 {yourIP}:{port}/login 的 http.formLogin()

© www.soinside.com 2019 - 2024. All rights reserved.