扩展ArgumentResolvers,这里的interfaceMethodParameter可以修改一下,不然不能支持AliasFor注解
public static MethodParameter interfaceMethodParameter(MethodParameter parameter,
Class annotationType) {
if (!parameter.hasParameterAnnotation(annotationType)) {
for (Class<?> itfc : parameter.getDeclaringClass().getInterfaces()) {
try {
Method method = itfc.getMethod(parameter.getMethod().getName(),
parameter.getMethod().getParameterTypes());
MethodParameter itfParameter = new SynthesizingMethodParameter(method,
parameter.getParameterIndex());
if (itfParameter.hasParameterAnnotation(annotationType)) {
return itfParameter;
}
} catch (NoSuchMethodException e) {
continue;
}
}
}
return parameter;
}
谢谢楼主分享解决了好多问题
Spring Cloud实战小技巧(解决feign GET传pojo、继承接口方法参数注解等问题)源码地址: https://github.com/charlesvhe/spring-cloud-practice/tree/refactor spring cloud 实践...