且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法在 Spring 的身份验证过滤器中自动装配服务

更新时间:2023-08-28 19:22:22

我只是通过添加

SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);

即使我尝试添加显式限定符,我也不确定为什么我们应该这样做.现在代码看起来像

I am unsure why we should do this even when i tried adding explicit qualifier. and now the code looks like

public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain) throws IOException, ServletException {

        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);

        @SuppressWarnings("unchecked")
        Map<String, String[]> parms = request.getParameterMap();

        if (parms.containsKey("token")) {