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
fd36a0cc
Unverified
Commit
fd36a0cc
authored
Jun 15, 2016
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default to HttpClientRibbonCommandFactory
parent
398c5aa0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
ZuulProxyConfiguration.java
...gframework/cloud/netflix/zuul/ZuulProxyConfiguration.java
+19
-7
SampleZuulProxyWithHttpClientTests.java
...loud/netflix/zuul/SampleZuulProxyWithHttpClientTests.java
+1
-7
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulProxyConfiguration.java
View file @
fd36a0cc
...
...
@@ -21,6 +21,7 @@ import org.springframework.boot.actuate.endpoint.Endpoint;
import
org.springframework.boot.actuate.trace.TraceRepository
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.cloud.client.actuator.HasFeatures
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
import
org.springframework.cloud.client.discovery.event.HeartbeatEvent
;
...
...
@@ -39,6 +40,7 @@ import org.springframework.cloud.netflix.zuul.filters.route.RestClientRibbonComm
import
org.springframework.cloud.netflix.zuul.filters.route.RibbonCommandFactory
;
import
org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter
;
import
org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter
;
import
org.springframework.cloud.netflix.zuul.filters.route.apache.HttpClientRibbonCommandFactory
;
import
org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping
;
import
org.springframework.context.ApplicationEvent
;
import
org.springframework.context.ApplicationListener
;
...
...
@@ -56,9 +58,6 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
private
TraceRepository
traces
;
@Autowired
private
SpringClientFactory
clientFactory
;
@Autowired
private
DiscoveryClient
discovery
;
@Autowired
...
...
@@ -77,10 +76,23 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
this
.
discovery
,
this
.
zuulProperties
,
this
.
serviceRouteMapper
);
}
@Bean
@ConditionalOnMissingBean
public
RibbonCommandFactory
<?>
ribbonCommandFactory
()
{
return
new
RestClientRibbonCommandFactory
(
this
.
clientFactory
);
@Configuration
protected
static
class
HttpClientRibbonConfiguration
{
@Bean
@ConditionalOnMissingBean
public
RibbonCommandFactory
<?>
ribbonCommandFactory
(
SpringClientFactory
clientFactory
)
{
return
new
HttpClientRibbonCommandFactory
(
clientFactory
);
}
}
@Configuration
@ConditionalOnProperty
(
"zuul.ribbon.restclient.enabled"
)
protected
static
class
RestClientRibbonConfiguration
{
@Bean
@ConditionalOnMissingBean
public
RibbonCommandFactory
<?>
ribbonCommandFactory
(
SpringClientFactory
clientFactory
)
{
return
new
RestClientRibbonCommandFactory
(
clientFactory
);
}
}
// pre filters
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/SampleZuulProxyWithHttpClientTests.java
View file @
fd36a0cc
...
...
@@ -101,7 +101,7 @@ public class SampleZuulProxyWithHttpClientTests extends ZuulProxyTestBase {
@Test
public
void
ribbonCommandFactoryOverridden
()
{
assertTrue
(
"ribbonCommandFactory not a
My
RibbonCommandFactory"
,
assertTrue
(
"ribbonCommandFactory not a
HttpClient
RibbonCommandFactory"
,
this
.
ribbonCommandFactory
instanceof
HttpClientRibbonCommandFactory
);
}
...
...
@@ -127,12 +127,6 @@ class SampleHttpClientZuulProxyApplication extends ZuulProxyTestBase.AbstractZuu
}
@Bean
public
RibbonCommandFactory
<?>
ribbonCommandFactory
(
final
SpringClientFactory
clientFactory
)
{
return
new
HttpClientRibbonCommandFactory
(
clientFactory
);
}
@Bean
public
MyErrorController
myErrorController
(
ErrorAttributes
errorAttributes
)
{
return
new
MyErrorController
(
errorAttributes
);
}
...
...
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