标签:
项目开发过程中,总会出现一些公共性的基础性服务。例如:日志、事务等等。即使在之前的OO的开发过程中,利用封装、继承、多态这些特性已经使开发趋于这样一个比较易扩展、易维护的开发流程。但是对于这些公共性的服务,开发者越来越发现这些代码总是在不断的重复。所以AOP应势而生,基于切面编程其实基于OO这样一个开发理念而形成的。好了,关于AOP的充电过程自行去了解。package com.cfl.aop.interceptor;import javax.interceptor.AroundInvoke;import javax.interceptor.InvocationContext;public class InterceptorCommonService {@AroundInvokepublic Object interceptorMethod(InvocationContext ic) throws Exception {System.out.println("InterceptorCommonService -----------excuting!excuting!excuting!excuting!-------------:" + ic.getMethod().getName());return ic.proceed();}}
@Stateless@Interceptors({InterceptorCommonService.class, InterceptorCommonService2.class})//@Interceptors(InterceptorCommonService.class)@Remotepublic class LoginBeanimpl {***;@AroundInvokepublic String loggerImpl{***;}@ExcludeClassInterceptorspublic String veritfy(User user) {***;}public void login(){***;}}
标签:
原文地址:http://blog.csdn.net/cfl20121314/article/details/45111265