spring version:4.3.7.RELEASE

The interceptor is not available in spring with the following configuration, The preHandle method of the AuthInterceptor is not executed

@Component
public class WebMvcConfigurerAdapterConfig extends WebMvcConfigurerAdapter {
    @Resource
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}

However, the following configuration is available

    <mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/**"/>
            <ref bean="authInterceptor"/>
        </mvc:interceptor>
    </mvc:interceptors>

Is my posture wrong?

Comment From: dingqianwen

The debug WebMvcConfigurerAdapterConfig. Under the class addInterceptors method confirmed the execution, but interceptors and have no effect

Comment From: rstoyanchev

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.