From 506d51f65827080f3428e20120bcf16656e9b938 Mon Sep 17 00:00:00 2001 From: yukun Date: Mon, 31 May 2021 13:33:39 +0800 Subject: [PATCH] =?UTF-8?q?RpcServiceInvocationHandler#invoke=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=88=A4=E6=96=AD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rpc/client/proxy/RpcServiceInvocationHandler.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/rpc-client/src/main/java/com/appleyk/rpc/client/proxy/RpcServiceInvocationHandler.java b/rpc-client/src/main/java/com/appleyk/rpc/client/proxy/RpcServiceInvocationHandler.java index b2cdd66..9485200 100644 --- a/rpc-client/src/main/java/com/appleyk/rpc/client/proxy/RpcServiceInvocationHandler.java +++ b/rpc-client/src/main/java/com/appleyk/rpc/client/proxy/RpcServiceInvocationHandler.java @@ -38,11 +38,7 @@ public RpcServiceInvocationHandler(RpcServiceAnnotationMetaData metaData){ } public RpcServiceInvocationHandler(ApplicationContext context){ - ServiceDiscovery discovery = context.getBean(ServiceDiscovery.class); - if (discovery==null){ - throw new RuntimeException("serviceRegistry bean not found !"); - } - this.serviceDiscovery = discovery; + this.serviceDiscovery = context.getBean(ServiceDiscovery.class); } /** @@ -55,7 +51,7 @@ public RpcServiceInvocationHandler(ApplicationContext context){ @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { /*如果是当前类的实例自己调用自己的invoke方法的话,那就直接返回*/ - if (method.getDeclaringClass().equals(this)){ + if (method.getDeclaringClass().equals(this.getClass())){ return method.invoke(proxy,args); }