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
28db47c7
Commit
28db47c7
authored
Mar 25, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move RibbonClientHttpRequestFactory to configuration conditional on netflix httpclient classes
parent
55d46eb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
RibbonAutoConfiguration.java
...amework/cloud/netflix/ribbon/RibbonAutoConfiguration.java
+24
-15
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonAutoConfiguration.java
View file @
28db47c7
...
...
@@ -19,6 +19,7 @@ package org.springframework.cloud.netflix.ribbon;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.netflix.client.http.HttpRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureBefore
;
...
...
@@ -52,21 +53,6 @@ public class RibbonAutoConfiguration {
@Autowired
(
required
=
false
)
private
List
<
RibbonClientSpecification
>
configurations
=
new
ArrayList
<>();
@Autowired
(
required
=
false
)
@LoadBalanced
private
RestTemplate
restTemplate
;
@PostConstruct
public
void
init
()
{
if
(
restTemplate
!=
null
)
{
restTemplate
.
setRequestFactory
(
ribbonClientHttpRequestFactory
());
}
}
@Bean
public
RibbonClientHttpRequestFactory
ribbonClientHttpRequestFactory
()
{
return
new
RibbonClientHttpRequestFactory
(
springClientFactory
());
}
@Bean
public
SpringClientFactory
springClientFactory
()
{
...
...
@@ -81,4 +67,27 @@ public class RibbonAutoConfiguration {
return
new
RibbonLoadBalancerClient
(
springClientFactory
());
}
@Configuration
@ConditionalOnClass
(
HttpRequest
.
class
)
protected
static
class
A
{
@Autowired
(
required
=
false
)
@LoadBalanced
private
RestTemplate
restTemplate
;
@Autowired
private
SpringClientFactory
springClientFactory
;
@PostConstruct
public
void
init
()
{
if
(
restTemplate
!=
null
)
{
restTemplate
.
setRequestFactory
(
ribbonClientHttpRequestFactory
());
}
}
@Bean
public
RibbonClientHttpRequestFactory
ribbonClientHttpRequestFactory
()
{
return
new
RibbonClientHttpRequestFactory
(
springClientFactory
);
}
}
}
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