Commit e265a5e3 by Spencer Gibb

upgrade to netflix feign 7.1.0.

Add feign-slf4j support. fixes gh-178
parent b2301434
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<main.basedir>${basedir}</main.basedir> <main.basedir>${basedir}</main.basedir>
<archaius.version>0.6.3</archaius.version> <archaius.version>0.6.3</archaius.version>
<eureka.version>1.1.145</eureka.version> <eureka.version>1.1.145</eureka.version>
<feign.version>6.1.3</feign.version> <feign.version>7.1.0</feign.version>
<hystrix.version>1.4.0-RC5</hystrix.version> <hystrix.version>1.4.0-RC5</hystrix.version>
<ribbon.version>2.0-RC13</ribbon.version> <ribbon.version>2.0-RC13</ribbon.version>
<zuul.version>1.0.28</zuul.version> <zuul.version>1.0.28</zuul.version>
...@@ -169,8 +169,17 @@ ...@@ -169,8 +169,17 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!--<dependency> <groupId>com.netflix.feign</groupId> <artifactId>feign-slf4j</artifactId> <!-- TODO: remove with feign 8.0.0 -->
<version>${feign.version}</version> </dependency> --> <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>
<version>${feign.version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.netflix.hystrix</groupId> <groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId> <artifactId>hystrix-core</artifactId>
......
...@@ -67,10 +67,20 @@ ...@@ -67,10 +67,20 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.netflix.feign</groupId> <groupId>com.netflix.feign</groupId>
<artifactId>feign-slf4j</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-ribbon</artifactId> <artifactId>feign-ribbon</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.squareup.dagger</groupId>
<artifactId>dagger</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId> <groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId> <artifactId>hystrix-core</artifactId>
<optional>true</optional> <optional>true</optional>
......
...@@ -6,6 +6,8 @@ import org.springframework.context.ApplicationEvent; ...@@ -6,6 +6,8 @@ import org.springframework.context.ApplicationEvent;
/** /**
* Specifically used when eureka is in the parent bootstrap context to relay the DiscoveryHeartbeatEvent to the child. Avoids stack overflow * Specifically used when eureka is in the parent bootstrap context to relay the DiscoveryHeartbeatEvent to the child. Avoids stack overflow
* @author Spencer Gibb * @author Spencer Gibb
*
* TODO: create a ParentDiscoveryHeartbeatEvent in s-c-commons rather than eureka, so eureka doesn't leak into zuul (so zuul can be used with consul for example)
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EurekaHeartbeatEvent extends ApplicationEvent { public class EurekaHeartbeatEvent extends ApplicationEvent {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.springframework.cloud.netflix.feign; package org.springframework.cloud.netflix.feign;
import feign.slf4j.Slf4jLogger;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration; import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration;
...@@ -52,8 +53,7 @@ public class FeignAutoConfiguration { ...@@ -52,8 +53,7 @@ public class FeignAutoConfiguration {
@Bean @Bean
public Logger feignLogger() { public Logger feignLogger() {
// return new Slf4jLogger(); //TODO pass Client classname in return new Slf4jLogger();
return new Logger.JavaLogger();
} }
@Bean @Bean
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.springframework.cloud.netflix.feign; package org.springframework.cloud.netflix.feign;
import feign.slf4j.Slf4jLogger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.archaius.ConfigurableEnvironmentConfiguration; import org.springframework.cloud.netflix.archaius.ConfigurableEnvironmentConfiguration;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -95,6 +96,7 @@ public class FeignConfiguration { ...@@ -95,6 +96,7 @@ public class FeignConfiguration {
} }
protected <T> T loadBalance(Feign.Builder builder, Class<T> type, String schemeName) { protected <T> T loadBalance(Feign.Builder builder, Class<T> type, String schemeName) {
builder.logger(new Slf4jLogger(type)); //TODO: how to have choice here?
if (this.ribbonClient != null) { if (this.ribbonClient != null) {
return builder.client(this.ribbonClient).target(type, schemeName); return builder.client(this.ribbonClient).target(type, schemeName);
} }
......
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