spring mvc中的AOP和interceptors

项目中采用Interceptor来过滤URL来决定哪些可以在不登录的情况下访问,哪些必须要登录才可以访问;

public class SessionTimeoutInterceptor implements HandlerInterceptor {

此时需要在servlet.xml中配置<mvc:interceptor>

同时亦采用AOP来记录日志,使用注解方式

@Component
@Aspect

同时在servlet.xml中配置

<aop:aspectj-autoproxy></aop:aspectj-autoproxy>

经测试发现,interceptor先于AOP执行。

文章来源: http://www.itnose.net/detail/6249790.html
更多文章: http://www.itnose.net/type/7.html

猜你喜欢

转载自twobrushes.iteye.com/blog/2203605