日期:2014-05-19 浏览次数:21167 次
?
import javax.interceptor.AroundInvoke; import javax.interceptor.Interceptor; import javax.interceptor.InvocationContext; |
?
?
Here is the example :
? ? ? ? 1.Define the annotation for interceptor
//@Inheritedto specify that the annotation can //be inherited from superclasses @Inherited @InterceptorBinding @Retention(RetentionPolicy.RUNTIME) @Target({TYPE, METHOD}) public @interface Logged { } |
?
2. Define the interceptor
@Logged @Interceptor public class LoggedInterceptor implements Serializable {
|