public void invokeAfterPropertiesSet() throws Exception { feign.codec.Decoder feignDecoder = null; String[] beanNameArray = this.applicationContext.getBeanNamesForType(feign.codec.Decoder.class); for (int i = 0; beanNameArray != null && i < beanNameArray.length; i++) { String beanName = beanNameArray[i]; Object beanInst = this.applicationContext.getBean(beanName); if (CompensableFeignDecoder.class.isInstance(beanInst)) { continue; } else if (feignDecoder != null) { throw new RuntimeException("There are more than one feign.codec.Decoder exists!"); } else { feignDecoder = (feign.codec.Decoder) beanInst; } } if (feignDecoder == null) { feignDecoder = new ResponseEntityDecoder(new SpringDecoder(this.objectFactory)); } // end-if (feignDecoder == null) this.delegate = feignDecoder; }
@Override public Object decode(final Response response, Type type) throws IOException, FeignException { if (isParameterizeHttpEntity(type)) { type = ((ParameterizedType) type).getActualTypeArguments()[0]; Object decodedObject = decoder.decode(response, type); return createResponse(decodedObject, response); } else if (isHttpEntity(type)) { return createResponse(null, response); } else { return decoder.decode(response, type); } }
private boolean isParameterizeHttpEntity(Type type) { if (type instanceof ParameterizedType) { return isHttpEntity(((ParameterizedType) type).getRawType()); } return false; }
@Override public Object decode(final Response response, Type type) throws IOException, FeignException { if (isParameterizeHttpEntity(type)) { type = ((ParameterizedType) type).getActualTypeArguments()[0]; Object decodedObject = decoder.decode(response, type); return createResponse(decodedObject, response); } else if (isHttpEntity(type)) { return createResponse(null, response); } else { return decoder.decode(response, type); } }
private boolean isParameterizeHttpEntity(Type type) { if (type instanceof ParameterizedType) { return isHttpEntity(((ParameterizedType) type).getRawType()); } return false; }
@org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean(feign.codec.Decoder.class) @org.springframework.context.annotation.Bean public feign.codec.Decoder feignDecoder(@Autowired ObjectFactory<HttpMessageConverters> messageConverters) { return new ResponseEntityDecoder(new SpringDecoder(messageConverters)); }
@Bean @ConditionalOnMissingBean public Decoder feignDecoder() { return new OptionalDecoder(new ResponseEntityDecoder(new SpringDecoder(this.messageConverters))); }
@Bean @ConditionalOnMissingBean public Decoder feignDecoder() { return new OptionalDecoder(new ResponseEntityDecoder(new SpringDecoder(this.messageConverters))); }
public void invokeAfterPropertiesSet() throws Exception { feign.codec.Decoder feignDecoder = null; String[] beanNameArray = this.applicationContext.getBeanNamesForType(feign.codec.Decoder.class); for (int i = 0; beanNameArray != null && i < beanNameArray.length; i++) { String beanName = beanNameArray[i]; Object beanInst = this.applicationContext.getBean(beanName); if (TransactionFeignDecoder.class.isInstance(beanInst)) { continue; } else if (feignDecoder != null) { throw new RuntimeException("There are more than one feign.codec.Decoder exists!"); } else { feignDecoder = (feign.codec.Decoder) beanInst; } } if (feignDecoder == null) { feignDecoder = new ResponseEntityDecoder(new SpringDecoder(this.objectFactory)); } // end-if (feignDecoder == null) this.delegate = feignDecoder; }