我使用此代码验证:
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
......
}
我如何用Spring Security重写代码以获得相同的结果?
您应该Spring Security来管理身份验证和授权。您似乎已经使用了HandlerInterceptor,这是不推荐的。
https://www.baeldung.com/spring-boot-security-autoconfiguration