Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
966e03ba
Commit
966e03ba
authored
Oct 18, 2015
by
Jakub Narloch
Committed by
Spencer Gibb
Oct 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feign OkHttp client configuration
parent
22f4b82e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
1 deletion
+47
-1
pom.xml
pom.xml
+10
-0
pom.xml
spring-cloud-netflix-core/pom.xml
+10
-0
FeignRibbonClientAutoConfiguration.java
...flix/feign/ribbon/FeignRibbonClientAutoConfiguration.java
+26
-0
FeignClientTests.java
...framework/cloud/netflix/feign/valid/FeignClientTests.java
+1
-1
No files found.
pom.xml
View file @
966e03ba
...
...
@@ -287,6 +287,11 @@
<version>
${feign.version}
</version>
</dependency>
<dependency>
<groupId>
com.netflix.feign
</groupId>
<artifactId>
feign-okhttp
</artifactId>
<version>
${feign.version}
</version>
</dependency>
<dependency>
<groupId>
com.netflix.hystrix
</groupId>
<artifactId>
hystrix-core
</artifactId>
<version>
${hystrix.version}
</version>
...
...
@@ -364,6 +369,11 @@
<version>
${spring-integration-dsl.version}
</version>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp
</groupId>
<artifactId>
okhttp
</artifactId>
<version>
2.5.0
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
18.0
</version>
...
...
spring-cloud-netflix-core/pom.xml
View file @
966e03ba
...
...
@@ -117,6 +117,11 @@
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.feign
</groupId>
<artifactId>
feign-okhttp
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.netflix.hystrix
</groupId>
<artifactId>
hystrix-core
</artifactId>
<optional>
true
</optional>
...
...
@@ -177,6 +182,11 @@
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp
</groupId>
<artifactId>
okhttp
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<!-- Only needed at compile time -->
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/FeignRibbonClientAutoConfiguration.java
View file @
966e03ba
...
...
@@ -33,6 +33,7 @@ import com.netflix.loadbalancer.ILoadBalancer;
import
feign.Client
;
import
feign.Feign
;
import
feign.httpclient.ApacheHttpClient
;
import
feign.okhttp.OkHttpClient
;
/**
* Autoconfiguration to be activated if Feign is in use and needs to be use Ribbon as a
...
...
@@ -81,4 +82,28 @@ public class FeignRibbonClientAutoConfiguration {
return
new
LoadBalancerFeignClient
(
delegate
,
this
.
cachingFactory
);
}
}
@Configuration
@ConditionalOnClass
(
OkHttpClient
.
class
)
@ConditionalOnProperty
(
value
=
"feign.okhttp.enabled"
,
matchIfMissing
=
true
)
protected
static
class
OkHttpConfiguration
{
@Autowired
(
required
=
false
)
private
com
.
squareup
.
okhttp
.
OkHttpClient
okHttpClient
;
@Autowired
CachingSpringLoadBalancerFactory
cachingFactory
;
@Bean
public
Client
feignClient
()
{
OkHttpClient
delegate
;
if
(
this
.
okHttpClient
!=
null
)
{
delegate
=
new
OkHttpClient
(
this
.
okHttpClient
);
}
else
{
delegate
=
new
OkHttpClient
();
}
return
new
LoadBalancerFeignClient
(
delegate
,
this
.
cachingFactory
);
}
}
}
\ No newline at end of file
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/valid/FeignClientTests.java
View file @
966e03ba
...
...
@@ -74,7 +74,7 @@ import feign.RequestTemplate;
@WebIntegrationTest
(
randomPort
=
true
,
value
=
{
"spring.application.name=feignclienttest"
,
"logging.level.org.springframework.cloud.netflix.feign.valid=DEBUG"
,
"feign.httpclient.enabled=false"
})
"feign.httpclient.enabled=false"
,
"feign.okhttp.enabled=false"
})
@DirtiesContext
public
class
FeignClientTests
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment