AvengerEug commented on issue #7336:
URL: https://github.com/apache/dubbo/issues/7336#issuecomment-869535287


   > > 请问dubbo filter中可否获取提供者的Method对象?看了看invocation和invoker感觉都没有提供方法获取。
   > 
   > 可以通过 Invocation 获取到方法名和参数信息,基于反射再去获取
   
   使用Spring的工具类来获取指定的方法,类似这样:
   ```java
           String methodName = invocation.getMethodName();
           Class<?>[] parameterTypes = invocation.getParameterTypes();
   
           return ReflectionUtils.findMethod(invoker.getInterface(), 
methodName, parameterTypes);
   ```
   Spring的反射工具类内部有缓存机制,可以减少反射带来的消耗。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to