Class ThreadLocalMethodHooks


  • public final class ThreadLocalMethodHooks
    extends Object
    Provides a mechanism to register thread-local interceptors for arbitrary method calls. Note that in order for this to work, the AOP interceptor returned by advice() needs to be incorporated into a Spring proxy.
    Since:
    7.14
    • Method Detail

      • advice

        public static org.springframework.aop.MethodBeforeAdvice advice()
        Returns:
        a method interceptor that will invoke any hooks registered for the current thread.
      • registerHook

        public static void registerHook​(Method method,
                                        org.springframework.aop.MethodBeforeAdvice hook)
        Register the given hook to run against any cal to the given method on the current thread.
      • unregisterHooks

        public static void unregisterHooks()
        Unregister any method hooks registered on the current thread.