spring 拦截器相关问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq876551724/article/details/80845029

HandlerInterceptor是springMVC项目中的拦截器,它拦截的目标是请求的地址,比MethodInterceptor先执行。

MethodInterceptor使用包名匹配不能拦截Controller时,使用使用如下方式

<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
        <property name="beanNames">
            <list><value>*Controller</value></list>
        </property>
        <property name="interceptorNames">
            <list><value>annotationMethodInterceptor</value></list>
        </property>
    </bean>

MethodInterceptor实现的是Interceptor接口,Interceptor继承自Advice接口,即MethodInterceptor也是aop的一种实现方式

猜你喜欢

转载自blog.csdn.net/qq876551724/article/details/80845029