这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos
@InterceptorBinding
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface TrackClass {
}
@TrackClass
@Interceptor
public class TrackClassInterceptor {
@AroundInvoke
Object execute(InvocationContext context) throws Exception {
Log.info("from TrackClass");
return context.proceed();
}
}
@InterceptorBinding
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface TrackMethod {
}
@TrackMethod
@Interceptor
public class TrackMethodInterceptor {
@AroundInvoke
Object execute(InvocationContext context) throws Exception {
Log.info("from TrackMethod");
return context.proceed();
}
}
@ApplicationScoped
@TrackClass
public class ExcludeInterceptorDemo {
public void test0() {
Log.info("from test0");
}
@TrackMethod
public void test1() {
Log.info("from test1");
}
}
@QuarkusTest
public class ExcludeInterceptorTest {
@Inject
ExcludeInterceptorDemo excludeInterceptorDemo;
@Test
public void test() {
excludeInterceptorDemo.test0();
Log.info("*****************************");
excludeInterceptorDemo.test1();
}
}
名称 | 链接 | 备注 |
---|---|---|
项目主页 | https://github.com/zq2599/blog_demos | 该项目在GitHub上的主页 |
git仓库地址(https) | https://github.com/zq2599/blog_demos.git | 该项目源码的仓库地址,https协议 |
git仓库地址(ssh) | git@github.com:zq2599/blog_demos.git | 该项目源码的仓库地址,ssh协议 |
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://xinchen.blog.csdn.net/article/details/124581260
内容来源于网络,如有侵权,请联系作者删除!