Commit 869e3ec9 by Spencer Gibb

upgrade to feign 8.1.0

removes ugly dagger dependency fixes gh-183
parent edbb0acc
......@@ -24,7 +24,7 @@
<main.basedir>${basedir}</main.basedir>
<archaius.version>0.6.5</archaius.version>
<eureka.version>1.1.147</eureka.version>
<feign.version>7.3.0</feign.version>
<feign.version>8.1.0</feign.version>
<hystrix.version>1.4.0</hystrix.version>
<ribbon.version>2.0.0</ribbon.version>
<zuul.version>1.0.28</zuul.version>
......@@ -186,12 +186,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- TODO: remove with feign 8.0.0 -->
<dependency>
<groupId>com.squareup.dagger</groupId>
<artifactId>dagger</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-slf4j</artifactId>
......
......@@ -87,11 +87,6 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.squareup.dagger</groupId>
<artifactId>dagger</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId>
<optional>true</optional>
......
......@@ -16,13 +16,14 @@
package org.springframework.cloud.netflix.feign.support;
import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttpHeaders;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import javax.inject.Provider;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.http.HttpHeaders;
......@@ -30,8 +31,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.HttpMessageConverterExtractor;
import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttpHeaders;
import feign.FeignException;
import feign.Response;
import feign.codec.DecodeException;
......@@ -43,7 +42,7 @@ import feign.codec.Decoder;
public class SpringDecoder implements Decoder {
@Autowired
private Provider<HttpMessageConverters> messageConverters;
private ObjectFactory<HttpMessageConverters> messageConverters;
public SpringDecoder() {
}
......@@ -54,7 +53,7 @@ public class SpringDecoder implements Decoder {
if (type instanceof Class || type instanceof ParameterizedType) {
@SuppressWarnings({ "unchecked", "rawtypes" })
HttpMessageConverterExtractor<?> extractor = new HttpMessageConverterExtractor(
type, this.messageConverters.get().getConverters());
type, this.messageConverters.getObject().getConverters());
return extractor.extractData(new FeignResponseAdapter(response));
}
......
......@@ -16,16 +16,18 @@
package org.springframework.cloud.netflix.feign.support;
import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttpHeaders;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
import java.util.Collection;
import javax.inject.Provider;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.http.HttpHeaders;
......@@ -37,8 +39,6 @@ import feign.RequestTemplate;
import feign.codec.EncodeException;
import feign.codec.Encoder;
import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttpHeaders;
/**
* @author Spencer Gibb
*/
......@@ -46,10 +46,10 @@ import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttp
public class SpringEncoder implements Encoder {
@Autowired
private Provider<HttpMessageConverters> messageConverters;
private ObjectFactory<HttpMessageConverters> messageConverters;
@Override
public void encode(Object requestBody, RequestTemplate request)
public void encode(Object requestBody, Type bodyType, RequestTemplate request)
throws EncodeException {
// template.body(conversionService.convert(object, String.class));
if (requestBody != null) {
......@@ -62,8 +62,8 @@ public class SpringEncoder implements Encoder {
requestContentType = MediaType.valueOf(type);
}
for (HttpMessageConverter<?> messageConverter : this.messageConverters.get()
.getConverters()) {
for (HttpMessageConverter<?> messageConverter : this.messageConverters
.getObject().getConverters()) {
if (messageConverter.canWrite(requestType, requestContentType)) {
if (log.isDebugEnabled()) {
if (requestContentType != null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment