本文整理了Java中feign.Feign
类的一些代码示例,展示了Feign
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feign
类的具体详情如下:
包路径:feign.Feign
类名称:Feign
[英]Feign's purpose is to ease development against http apis that feign restfulness.
In implementation, Feign is a Feign#newInstance for generating Target http apis.
[中]Feign的目的是简化针对假装RESTfulity的http API的开发。
在实现中,Feign是一个用于生成目标http API的新实例。
代码示例来源:origin: yu199195/Raincat
@Bean
@Scope("prototype")
public Feign.Builder feignBuilder() {
return Feign.builder().requestInterceptor(new RestTemplateInterceptor());
}
代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba
MethodMetadata methodMetadata = SentinelContractHolder.metadataMap
.get(method.getDeclaringClass().getName()
+ Feign.configKey(method.getDeclaringClass(), method));
代码示例来源:origin: com.netflix.denominator/denominator-clouddns
@Provides
@Singleton
CloudDNS cloudDNS(Feign feign, CloudDNSTarget target) {
return feign.newInstance(target);
}
代码示例来源:origin: com.netflix.denominator/denominator-clouddns
@Provides
@Singleton
CloudIdentity cloudIdentity(Feign feign) {
return feign.newInstance(EmptyTarget.create(CloudIdentity.class, "cloudidentity"));
}
代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba
static Feign.Builder builder(BeanFactory beanFactory) {
return Feign.builder().client(new FescarFeignClient(beanFactory));
}
}
代码示例来源:origin: com.netflix.feign/feign-core
/**
* @deprecated use {@link #configKey(Class, Method)} instead.
*/
@Deprecated
public static String configKey(Method method) {
return configKey(method.getDeclaringClass(), method);
}
代码示例来源:origin: io.github.openfeign/feign-hystrix
/**
* @see #target(Class, String, FallbackFactory)
*/
public <T> T target(Target<T> target, FallbackFactory<? extends T> fallbackFactory) {
return build(fallbackFactory).newInstance(target);
}
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
static Feign.Builder builder(BeanFactory beanFactory) {
return Feign.builder().retryer(Retryer.NEVER_RETRY).client(client(beanFactory));
}
代码示例来源:origin: com.palantir.remoting3/jaxrs-clients
@Override
public final List<MethodMetadata> parseAndValidatateMetadata(Class<?> targetType) {
List<MethodMetadata> mdList = delegate.parseAndValidatateMetadata(targetType);
Map<String, MethodMetadata> methodMetadataByConfigKey = new LinkedHashMap<String, MethodMetadata>();
for (MethodMetadata md : mdList) {
methodMetadataByConfigKey.put(md.configKey(), md);
}
for (Method method : targetType.getMethods()) {
if (method.getDeclaringClass() == Object.class) {
continue;
}
String configKey = Feign.configKey(targetType, method);
MethodMetadata metadata = methodMetadataByConfigKey.get(configKey);
if (metadata != null) {
processMetadata(targetType, method, metadata);
}
}
return mdList;
}
代码示例来源:origin: com.netflix.feign/feign-core
public <T> T target(Target<T> target) {
return build().newInstance(target);
}
代码示例来源:origin: zpng/spring-cloud-7simple
@Bean
@Scope("prototype")
public Feign.Builder feignBuilder() {
return Feign.builder();
}
代码示例来源:origin: com.palantir.remoting/feign-config
@Override
public final List<MethodMetadata> parseAndValidatateMetadata(Class<?> targetType) {
List<MethodMetadata> mdList = delegate.parseAndValidatateMetadata(targetType);
Map<String, MethodMetadata> methodMetadataByConfigKey = new LinkedHashMap<String, MethodMetadata>();
for (MethodMetadata md : mdList) {
methodMetadataByConfigKey.put(md.configKey(), md);
}
for (Method method : targetType.getMethods()) {
if (method.getDeclaringClass() == Object.class) {
continue;
}
String configKey = Feign.configKey(targetType, method);
MethodMetadata metadata = methodMetadataByConfigKey.get(configKey);
if (metadata != null) {
processMetadata(targetType, method, metadata);
}
}
return mdList;
}
代码示例来源:origin: io.github.openfeign/feign-hystrix
/**
* @see #target(Class, String, Object)
*/
public <T> T target(Target<T> target, T fallback) {
return build(fallback != null ? new FallbackFactory.Default<T>(fallback) : null)
.newInstance(target);
}
代码示例来源:origin: coderqianlq/spring-cloud-cli
@Bean
@Scope("prototype")
@ConditionalOnMissingBean
@ConditionalOnProperty(name = "feign.hystrix.enabled", matchIfMissing = true)
public Feign.Builder feignBuilder() {
return Feign.builder();
}
}
代码示例来源:origin: com.palantir.conjure.java.runtime/conjure-java-jaxrs-client
@Override
public final List<MethodMetadata> parseAndValidatateMetadata(Class<?> targetType) {
List<MethodMetadata> mdList = delegate.parseAndValidatateMetadata(targetType);
Map<String, MethodMetadata> methodMetadataByConfigKey = new LinkedHashMap<String, MethodMetadata>();
for (MethodMetadata md : mdList) {
methodMetadataByConfigKey.put(md.configKey(), md);
}
for (Method method : targetType.getMethods()) {
if (method.getDeclaringClass() == Object.class) {
continue;
}
String configKey = Feign.configKey(targetType, method);
MethodMetadata metadata = methodMetadataByConfigKey.get(configKey);
if (metadata != null) {
processMetadata(targetType, method, metadata);
}
}
return mdList;
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-openfeign-core
@Bean
@Scope("prototype")
@ConditionalOnMissingBean
public Feign.Builder feignBuilder(Retryer retryer) {
return Feign.builder().retryer(retryer);
}
代码示例来源:origin: palantir/conjure-java-runtime
@Override
public final List<MethodMetadata> parseAndValidatateMetadata(Class<?> targetType) {
List<MethodMetadata> mdList = delegate.parseAndValidatateMetadata(targetType);
Map<String, MethodMetadata> methodMetadataByConfigKey = new LinkedHashMap<String, MethodMetadata>();
for (MethodMetadata md : mdList) {
methodMetadataByConfigKey.put(md.configKey(), md);
}
for (Method method : targetType.getMethods()) {
if (method.getDeclaringClass() == Object.class) {
continue;
}
String configKey = Feign.configKey(targetType, method);
MethodMetadata metadata = methodMetadataByConfigKey.get(configKey);
if (metadata != null) {
processMetadata(targetType, method, metadata);
}
}
return mdList;
}
代码示例来源:origin: spring-cloud/spring-cloud-openfeign
@Bean
@Scope("prototype")
@ConditionalOnMissingBean
public Feign.Builder feignBuilder(Retryer retryer) {
return Feign.builder().retryer(retryer);
}
代码示例来源:origin: kptfh/feign-reactive
Map<String, MethodHandler> apply(final Target target) {
Map<String, MethodMetadata> metadata = contract.parseAndValidatateMetadata(target.type())
.stream()
.collect(Collectors.toMap(
MethodMetadata::configKey,
md -> md
));
Map<String, Method> configKeyToMethod = Stream.of(target.type().getMethods())
.collect(Collectors.toMap(
method -> Feign.configKey(target.type(), method),
method -> method
));
final Map<String, MethodHandler> result = new LinkedHashMap<>();
for (final Map.Entry<String, Method> entry : configKeyToMethod.entrySet()) {
String configKey = entry.getKey();
MethodMetadata md = metadata.get(configKey);
MethodHandler methodHandler = md != null
? factory.create(target, md)
: factory.createDefault(entry.getValue()); //isDefault(entry.getValue())
result.put(configKey, methodHandler);
}
return result;
}
}
代码示例来源:origin: kloiasoft/eventapis
@Bean
public Feign.Builder feignBuilder(@Autowired List<RequestInterceptor> interceptors) {
return Feign.builder()
.requestInterceptors(interceptors);
}
内容来源于网络,如有侵权,请联系作者删除!