Java Spring AOP: Using CustomizableTraceInterceptor with JavaConfig @EnableAspectJAutoProxy, not XML

前端 未结 3 1719
醉话见心
醉话见心 2020-12-24 09:17

Spring AOP has a method-level tracer called CustomizableTraceInterceptor. Using Spring\'s XML configuration approach, one would set up this tracer like so:

3条回答
  •  醉梦人生
    2020-12-24 09:44

    Unfortunately, you cannot because the Java language does not support method literals which would be needed to support this in Spring JavaConfig. A bug was opened for this but marked as "Won't Fix": https://jira.springsource.org/browse/SPR-8148.

    The two options mentioned in the bug report are:

    1. Continue using by including the relevant XML snippet using @ImportResource
    2. Convert any existing elemements to use @Aspect style. [which is not possible with the CustomizableTraceInterceptor]

提交回复
热议问题