报错信息为:Caused by: java.lang.AbstractMethodError:com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidateMetadata(Ljava/lang/Class;)Ljava/util/List;
解决方式:
找合适的位置自定义一个SentinelContractHolder类,包名和源码保持一致。
包名:package com.alibaba.cloud.sentinel.feign
代码如下:
package com.alibaba.cloud.sentinel.feign;
import feign.Contract;
import feign.MethodMetadata;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SentinelContractHolder implements Contract {
private final Contract delegate;
public final static Map METADATA_MAP = new HashMap<>();
public SentinelContractHolder(Contract delegate) {
this.delegate = delegate;
}
@Override
public List parseAndValidateMetadata(Class> targetType) {
List metadatas = delegate.parseAndValidateMetadata(targetType);
metadatas.forEach(metadata -> METADATA_MAP
.put(targetType.getName() + metadata.configKey(), metadata));
return metadatas;
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)