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
54c052c5
Commit
54c052c5
authored
Mar 01, 2017
by
Ryan Baxter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable Hystrix support when using Feign by default. Fixes #1277.
parent
de886d6c
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
12 deletions
+37
-12
spring-cloud-netflix.adoc
docs/src/main/asciidoc/spring-cloud-netflix.adoc
+1
-3
FeignClientsConfiguration.java
...mework/cloud/netflix/feign/FeignClientsConfiguration.java
+1
-1
HystrixSecurityAutoConfiguration.java
...ix/hystrix/security/HystrixSecurityAutoConfiguration.java
+1
-1
EnableFeignClientsTests.java
...ramework/cloud/netflix/feign/EnableFeignClientsTests.java
+1
-2
FeignClientOverrideDefaultsTests.java
...cloud/netflix/feign/FeignClientOverrideDefaultsTests.java
+3
-3
FeignClientValidationTests.java
...oud/netflix/feign/invalid/FeignClientValidationTests.java
+27
-0
FeignClientTests.java
...framework/cloud/netflix/feign/valid/FeignClientTests.java
+2
-1
HystrixSecurityTests.java
.../cloud/netflix/hystrix/security/HystrixSecurityTests.java
+1
-1
No files found.
docs/src/main/asciidoc/spring-cloud-netflix.adoc
View file @
54c052c5
...
...
@@ -1062,9 +1062,7 @@ NOTE: `PROD-SVC` is the name of the service the Clients will be making requests
[[
spring
-
cloud
-
feign
-
hystrix
]]
===
Feign
Hystrix
Support
If
Hystrix
is
on
the
classpath
,
by
default
Feign
will
wrap
all
methods
with
a
circuit
breaker
.
Returning
a
`
com
.
netflix
.
hystrix
.
HystrixCommand
`
is
also
available
.
This
lets
you
use
reactive
patterns
(
with
a
call
to
`.
toObservable
()`
or
`.
observe
()`
or
asynchronous
use
(
with
a
call
to
`.
queue
()`).
To
disable
Hystrix
support
for
Feign
,
set
`
feign
.
hystrix
.
enabled
=
false
`.
If
Hystrix
is
on
the
classpath
and
`
feign
.
hystrix
.
enabled
=
true
`,
Feign
will
wrap
all
methods
with
a
circuit
breaker
.
Returning
a
`
com
.
netflix
.
hystrix
.
HystrixCommand
`
is
also
available
.
This
lets
you
use
reactive
patterns
(
with
a
call
to
`.
toObservable
()`
or
`.
observe
()`
or
asynchronous
use
(
with
a
call
to
`.
queue
()`).
To
disable
Hystrix
support
on
a
per
-
client
basis
create
a
vanilla
`
Feign
.
Builder
`
with
the
"prototype"
scope
,
e
.
g
.:
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClientsConfiguration.java
View file @
54c052c5
...
...
@@ -98,7 +98,7 @@ public class FeignClientsConfiguration {
@Bean
@Scope
(
"prototype"
)
@ConditionalOnMissingBean
@ConditionalOnProperty
(
name
=
"feign.hystrix.enabled"
,
matchIfMissing
=
tru
e
)
@ConditionalOnProperty
(
name
=
"feign.hystrix.enabled"
,
matchIfMissing
=
fals
e
)
public
Feign
.
Builder
feignHystrixBuilder
()
{
return
HystrixFeign
.
builder
();
}
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityAutoConfiguration.java
View file @
54c052c5
...
...
@@ -74,7 +74,7 @@ public class HystrixSecurityAutoConfiguration {
super
(
ConfigurationPhase
.
REGISTER_BEAN
);
}
@ConditionalOnProperty
(
name
=
"feign.hystrix.enabled"
,
matchIfMissing
=
tru
e
)
@ConditionalOnProperty
(
name
=
"feign.hystrix.enabled"
,
matchIfMissing
=
fals
e
)
static
class
HystrixEnabled
{
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/EnableFeignClientsTests.java
View file @
54c052c5
...
...
@@ -35,7 +35,6 @@ import feign.Feign;
import
feign.Logger
;
import
feign.codec.Decoder
;
import
feign.codec.Encoder
;
import
feign.hystrix.HystrixFeign
;
import
feign.slf4j.Slf4jLogger
;
/**
...
...
@@ -73,7 +72,7 @@ public class EnableFeignClientsTests {
@Test
public
void
builderDefaultCorrect
()
{
Hystrix
Feign
.
Builder
.
class
Feign
.
Builder
.
class
.
cast
(
this
.
feignContext
.
getInstance
(
"foo"
,
Feign
.
Builder
.
class
));
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/FeignClientOverrideDefaultsTests.java
View file @
54c052c5
...
...
@@ -121,8 +121,8 @@ public class FeignClientOverrideDefaultsTests {
@Test
public
void
overrideBuilder
()
{
Feign
.
Builder
.
class
.
cast
(
this
.
context
.
getInstance
(
"foo"
,
Feign
.
Builder
.
class
));
Hystrix
Feign
.
Builder
.
class
Hystrix
Feign
.
Builder
.
class
.
cast
(
this
.
context
.
getInstance
(
"foo"
,
Feign
.
Builder
.
class
));
Feign
.
Builder
.
class
.
cast
(
this
.
context
.
getInstance
(
"bar"
,
Feign
.
Builder
.
class
));
}
...
...
@@ -187,7 +187,7 @@ public class FeignClientOverrideDefaultsTests {
@Bean
public
Feign
.
Builder
feignBuilder
()
{
return
Feign
.
builder
();
return
Hystrix
Feign
.
builder
();
}
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/invalid/FeignClientValidationTests.java
View file @
54c052c5
...
...
@@ -16,7 +16,10 @@
package
org
.
springframework
.
cloud
.
netflix
.
feign
.
invalid
;
import
feign.Feign
;
import
feign.hystrix.FallbackFactory
;
import
feign.hystrix.HystrixFeign
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
...
...
@@ -128,6 +131,10 @@ public class FeignClientValidationTests {
}
}
@Bean
public
Feign
.
Builder
feignBuilder
()
{
return
HystrixFeign
.
builder
();
}
}
@Test
...
...
@@ -158,6 +165,11 @@ public class FeignClientValidationTests {
class
Dummy
{
}
@Bean
public
Feign
.
Builder
feignBuilder
()
{
return
HystrixFeign
.
builder
();
}
}
@Test
...
...
@@ -187,6 +199,11 @@ public class FeignClientValidationTests {
return
null
;
}
}
@Bean
public
Feign
.
Builder
feignBuilder
()
{
return
HystrixFeign
.
builder
();
}
}
@Test
...
...
@@ -217,6 +234,11 @@ public class FeignClientValidationTests {
class
Dummy
{
}
@Bean
public
Feign
.
Builder
feignBuilder
()
{
return
HystrixFeign
.
builder
();
}
}
@Test
...
...
@@ -252,5 +274,10 @@ public class FeignClientValidationTests {
}
}
@Bean
public
Feign
.
Builder
feignBuilder
()
{
return
HystrixFeign
.
builder
();
}
}
}
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/valid/FeignClientTests.java
View file @
54c052c5
...
...
@@ -97,7 +97,8 @@ import rx.Single;
@SpringBootTest
(
classes
=
FeignClientTests
.
Application
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
value
=
{
"spring.application.name=feignclienttest"
,
"logging.level.org.springframework.cloud.netflix.feign.valid=DEBUG"
,
"feign.httpclient.enabled=false"
,
"feign.okhttp.enabled=false"
})
"feign.httpclient.enabled=false"
,
"feign.okhttp.enabled=false"
,
"feign.hystrix.enabled=true"
})
@DirtiesContext
public
class
FeignClientTests
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityTests.java
View file @
54c052c5
...
...
@@ -40,7 +40,7 @@ import org.springframework.web.client.RestTemplate;
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@DirtiesContext
@SpringBootTest
(
classes
=
HystrixSecurityApplication
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
properties
=
"username.ribbon.listOfServers=localhost:${local.server.port}"
)
@SpringBootTest
(
classes
=
HystrixSecurityApplication
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
properties
=
{
"username.ribbon.listOfServers=localhost:${local.server.port}"
,
"feign.hystrix.enabled=true"
}
)
public
class
HystrixSecurityTests
{
@Autowired
private
CustomConcurrenyStrategy
customConcurrenyStrategy
;
...
...
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