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
8f6cd86e
Commit
8f6cd86e
authored
Dec 14, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #704 from hscholz/master
* pull704: Explicitly set target to feign client name.
parents
2acd353c
abd32fbf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
FeignClientFactoryBean.java
...framework/cloud/netflix/feign/FeignClientFactoryBean.java
+8
-8
FeignClientTests.java
...framework/cloud/netflix/feign/valid/FeignClientTests.java
+1
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClientFactoryBean.java
View file @
8f6cd86e
...
...
@@ -18,9 +18,6 @@ package org.springframework.cloud.netflix.feign;
import
java.util.Map
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.InitializingBean
;
...
...
@@ -36,11 +33,14 @@ import feign.Logger;
import
feign.Request
;
import
feign.RequestInterceptor
;
import
feign.Retryer
;
import
feign.Target
;
import
feign.Target.HardCodedTarget
;
import
feign.codec.Decoder
;
import
feign.codec.Encoder
;
import
feign.codec.ErrorDecoder
;
import
feign.hystrix.HystrixFeign
;
import
feign.slf4j.Slf4jLogger
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* @author Spencer Gibb
...
...
@@ -120,10 +120,10 @@ class FeignClientFactoryBean implements FactoryBean<Object>, InitializingBean, A
return
factory
.
getInstance
(
this
.
name
,
type
);
}
protected
<
T
>
T
loadBalance
(
Feign
.
Builder
builder
,
FeignClientFactory
factory
,
Class
<
T
>
type
,
String
url
)
{
protected
<
T
>
T
loadBalance
(
Feign
.
Builder
builder
,
FeignClientFactory
factory
,
Target
<
T
>
target
)
{
Client
client
=
getOptional
(
factory
,
Client
.
class
);
if
(
client
!=
null
)
{
return
builder
.
client
(
client
).
target
(
t
ype
,
url
);
return
builder
.
client
(
client
).
target
(
t
arget
);
}
throw
new
IllegalStateException
(
"No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-ribbon?"
);
...
...
@@ -140,12 +140,12 @@ class FeignClientFactoryBean implements FactoryBean<Object>, InitializingBean, A
}
else
{
url
=
this
.
name
;
}
return
loadBalance
(
feign
(
factory
),
factory
,
this
.
type
,
url
);
return
loadBalance
(
feign
(
factory
),
factory
,
new
HardCodedTarget
<>(
this
.
type
,
this
.
name
,
url
)
);
}
if
(
StringUtils
.
hasText
(
this
.
url
)
&&
!
this
.
url
.
startsWith
(
"http"
))
{
this
.
url
=
"http://"
+
this
.
url
;
}
return
feign
(
factory
).
target
(
this
.
type
,
this
.
url
);
return
feign
(
factory
).
target
(
new
HardCodedTarget
<>(
this
.
type
,
this
.
name
,
this
.
url
)
);
}
@Override
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/valid/FeignClientTests.java
View file @
8f6cd86e
...
...
@@ -279,6 +279,7 @@ public class FeignClientTests {
public
void
testHystrixCommand
()
{
HystrixCommand
<
List
<
Hello
>>
command
=
this
.
testClient
.
getHellosHystrix
();
assertNotNull
(
"command was null"
,
command
);
assertEquals
(
"Hystrix command group name should match the name of the feign client"
,
"localapp"
,
command
.
getCommandGroup
().
name
());
List
<
Hello
>
hellos
=
command
.
execute
();
assertNotNull
(
"hellos was null"
,
hellos
);
assertEquals
(
"hellos didn't match"
,
hellos
,
getHelloList
());
...
...
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