我有一个 Spring Boot 2.7.6 应用程序,Spring Security 5.7.5 运行没有问题:身份验证有效,我根据角色浏览不同的页面,Swagger UI 可用等。我没有针对您的不推荐使用的警告信息。
\n我迁移到 Spring Boot 3.0.0,因此迁移到 Spring Security 6.0.0。我按照迁移指南进行操作,服务器启动没有错误。但我的网址不再有效。我的状态是 401。
\n问题#1:GET http://localhost:8080/swagger-ui/index.html导致客户端出现 401 错误。
在日志中我有一个 404:
\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG org.springframework.web.servlet.DispatcherServlet : GET "/swagger-ui/index.html", parameters={}\nDEBUG o.s.web.servlet.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [static/]]\nDEBUG o.s.w.servlet.resource.ResourceHttpRequestHandler : Resource not found\nDEBUG org.springframework.web.servlet.DispatcherServlet : Completed 404 …Run Code Online (Sandbox Code Playgroud)