1 16 17 package org.springframework.aop.framework; 18 19 39 public abstract class AopContext { 40 41 47 private static final ThreadLocal currentProxy = new ThreadLocal (); 48 49 50 59 public static Object currentProxy() throws IllegalStateException { 60 Object proxy = currentProxy.get(); 61 if (proxy == null) { 62 throw new IllegalStateException ( 63 "Cannot find current proxy: Set 'exposeProxy' property on Advised to 'true' to make it available."); 64 } 65 return proxy; 66 } 67 68 75 public static Object setCurrentProxy(Object proxy) { 76 Object old = currentProxy.get(); 77 currentProxy.set(proxy); 78 return old; 79 } 80 81 } 82 | Popular Tags |