Exception in thread "main" java.lang.IllegalStateException: Cannot find current proxy: Set 'exposeProxy' property on Advised to 'true' to make it available.
JdkDynamicAopProxy
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (this.advised.exposeProxy) { //只有true的时候,才设置AopContext.setCurrentProx // Make invocation available if necessary. oldProxy = AopContext.setCurrentProxy(proxy); setProxyContext = true; }}
public final class AopContext { /** * ThreadLocal holder for AOP proxy associated with this thread. * Will contain {@code null} unless the "exposeProxy" property on * the controlling proxy configuration has been set to "true". * @see ProxyConfig#setExposeProxy */ private static final ThreadLocal