这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos
@InterceptorBinding@Target({ElementType.TYPE, ElementType.METHOD})@Retention(RetentionPolicy.RUNTIME)public @interface TrackClass {}
@InterceptorBinding
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface TrackClass {
}
@TrackClass@Interceptorpublic class TrackClassInterceptor { @AroundInvoke Object execute(InvocationContext context) throws Exception { Log.info("from TrackClass"); return context.proceed(); }}
@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 {}
public @interface TrackMethod {
@TrackMethod@Interceptorpublic class TrackMethodInterceptor { @AroundInvoke Object execute(InvocationContext context) throws Exception { Log.info("from TrackMethod"); return context.proceed(); }}
@TrackMethod
public class TrackMethodInterceptor {
Log.info("from TrackMethod");
@ApplicationScoped@TrackClasspublic class ExcludeInterceptorDemo { public void test0() { Log.info("from test0"); } @TrackMethod public void test1() { Log.info("from test1"); }}
@ApplicationScoped
public class ExcludeInterceptorDemo {
public void test0() {
Log.info("from test0");
public void test1() {
Log.info("from test1");
@QuarkusTestpublic class ExcludeInterceptorTest { @Inject ExcludeInterceptorDemo excludeInterceptorDemo; @Test public void test() { excludeInterceptorDemo.test0(); Log.info("*****************************"); excludeInterceptorDemo.test1(); }}
@QuarkusTest
public class ExcludeInterceptorTest {
@Inject
ExcludeInterceptorDemo excludeInterceptorDemo;
@Test
public void test() {
excludeInterceptorDemo.test0();
Log.info("*****************************");
excludeInterceptorDemo.test1();
学习路上,你不孤单,欣宸原创一路相伴...
原文链接:https://www.cnblogs.com/bolingcavalry/p/17608154.html
本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728