Java 当重写UsernamePasswordAuthenticationFilter类的方法时,eclipse在SpringSecurity中显示错误

Java 当重写UsernamePasswordAuthenticationFilter类的方法时,eclipse在SpringSecurity中显示错误,java,spring-mvc,spring-security,Java,Spring Mvc,Spring Security,我想在SpringMVC的登录和注销页面中使用不同的用户名和角色 我已从以下链接学习,我正在使用spring 4.2.5: 但是我的一个班级显示了一个错误: public class AjaxAuthenticationProcessingFilter extends UsernamePasswordAuthenticationFilter { @Override protected void successfulAuthentication(HttpServletReque

我想在SpringMVC的登录和注销页面中使用不同的用户名和角色

我已从以下链接学习,我正在使用spring 4.2.5:

但是我的一个班级显示了一个错误:

public class AjaxAuthenticationProcessingFilter extends
UsernamePasswordAuthenticationFilter {

    @Override
    protected void successfulAuthentication(HttpServletRequest request,
            HttpServletResponse response, Authentication authResult)
            throws IOException, ServletException {
        super.successfulAuthentication(request, response, authResult);
    }
} 
Eclipse显示方法上的编译时错误

AjaxAuthenticationProcessingFilter类型的方法successfulAuthentication(HttpServletRequest、HttpServletResponse、Authentication)必须重写或实现超类型方法

另一个错误是当我调用
successfulAuthentication
方法 超级类
super.successfulAuthentication(请求、响应、authResult)

您可以看到下面给出的错误:

AbstractAuthenticationProcessingFilter类型中的方法successfulAuthentication(HttpServletRequest、HttpServletResponse、FilterChain、Authentication)不适用于 参数(HttpServletRequest、HttpServletResponse、身份验证)


如果有人知道spring security的任何链接,以实现具有不同角色的不同用户,请在spring xml配置的帮助下让我知道。

尝试下面的代码..检查导入

主要是

successfulAuthentication(HttpServletRequest request,
            HttpServletResponse response,Authentication authResult)
successfulAuthentication(HttpServletRequest request,
            HttpServletResponse response,FilterChain a, Authentication authResult)
不推荐使用

使用

successfulAuthentication(HttpServletRequest request,
            HttpServletResponse response,Authentication authResult)
successfulAuthentication(HttpServletRequest request,
            HttpServletResponse response,FilterChain a, Authentication authResult)
最后,

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

public class AjaxAuthenticationProcessingFilter extends
UsernamePasswordAuthenticationFilter {

    @Override
    protected void successfulAuthentication(HttpServletRequest request,
            HttpServletResponse response,FilterChain filter, Authentication authResult)
            throws IOException, ServletException {
        super.successfulAuthentication(request, response,filter, authResult);

    }

} 

我的spring security应用程序中仍然存在一些错误,如果你知道任何关于spring security基础知识的有用链接,那么请让我知道实际上对于spring security,你应该通过spring文档。没有专门的网站描述安全性或oauth。