参考博客:https://blog.csdn.net/ttzommed/article/details/90669320
原文中编写FunSentinelFeign类时,由于SentinelInvocationHandler方法的构造函数并不是public修饰
return new SentinelInvocationHandler(target, dispatch, funFallbackFactory),会报错。修改为使用反射调用
//获取指定的构造方法
Constructor<SentinelInvocationHandler> constructor = SentinelInvocationHandler.class.
getDeclaredConstructor(Target.class, Map.class, FallbackFactory.class);
constructor.setAccessible(true);
return constructor.newInstance(target, dispatch, new FallbackFactory.Default(fallbackInstance));
demo地址:gitee