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
a1b1a7d7
Unverified
Commit
a1b1a7d7
authored
May 15, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves EurekaHealthIndicator creation to auto config.
Fixes a race condition introduced in 1.3.0 fixes gh-1933
parent
ccdf0d9f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
EurekaClientAutoConfiguration.java
...k/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
+13
-1
EurekaDiscoveryClientConfiguration.java
...ud/netflix/eureka/EurekaDiscoveryClientConfiguration.java
+2
-13
EurekaClientAutoConfigurationTests.java
...ud/netflix/eureka/EurekaClientAutoConfigurationTests.java
+8
-1
No files found.
spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
View file @
a1b1a7d7
/*
* Copyright 2013-201
4
the original author or authors.
* Copyright 2013-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -12,6 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
springframework
.
cloud
.
netflix
.
eureka
;
...
...
@@ -24,6 +25,7 @@ import java.lang.annotation.Target;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureBefore
;
import
org.springframework.boot.autoconfigure.condition.AnyNestedCondition
;
...
...
@@ -271,4 +273,14 @@ public class EurekaClientAutoConfiguration {
}
@Configuration
@ConditionalOnClass
(
Endpoint
.
class
)
protected
static
class
EurekaHealthIndicatorConfiguration
{
@Bean
@ConditionalOnMissingBean
public
EurekaHealthIndicator
eurekaHealthIndicator
(
EurekaClient
eurekaClient
,
EurekaInstanceConfig
instanceConfig
,
EurekaClientConfig
clientConfig
)
{
return
new
EurekaHealthIndicator
(
eurekaClient
,
instanceConfig
,
clientConfig
);
}
}
}
spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClientConfiguration.java
View file @
a1b1a7d7
/*
* Copyright 2013-201
4
the original author or authors.
* Copyright 2013-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -12,12 +12,12 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
springframework
.
cloud
.
netflix
.
eureka
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.health.HealthAggregator
;
import
org.springframework.boot.actuate.health.OrderedHealthAggregator
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
...
...
@@ -30,7 +30,6 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.event.EventListener
;
import
com.netflix.appinfo.EurekaInstanceConfig
;
import
com.netflix.appinfo.HealthCheckHandler
;
import
com.netflix.discovery.EurekaClient
;
import
com.netflix.discovery.EurekaClientConfig
;
...
...
@@ -82,16 +81,6 @@ public class EurekaDiscoveryClientConfiguration {
}
}
@Configuration
@ConditionalOnClass
(
Endpoint
.
class
)
protected
static
class
EurekaHealthIndicatorConfiguration
{
@Bean
@ConditionalOnMissingBean
public
EurekaHealthIndicator
eurekaHealthIndicator
(
EurekaClient
eurekaClient
,
EurekaInstanceConfig
instanceConfig
,
EurekaClientConfig
clientConfig
)
{
return
new
EurekaHealthIndicator
(
eurekaClient
,
instanceConfig
,
clientConfig
);
}
}
@Configuration
@ConditionalOnProperty
(
value
=
"eureka.client.healthcheck.enabled"
,
matchIfMissing
=
false
)
...
...
spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java
View file @
a1b1a7d7
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -12,6 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
springframework
.
cloud
.
netflix
.
eureka
;
...
...
@@ -237,6 +238,12 @@ public class EurekaClientAutoConfigurationTests {
assertEquals
(
"mytesteurekaappname"
,
getInstanceConfig
().
getAppname
());
}
@Test
public
void
eurekaHealthIndicatorCreated
()
{
setupContext
();
this
.
context
.
getBean
(
EurekaHealthIndicator
.
class
);
}
private
void
testNonSecurePort
(
String
propName
)
{
addEnvironment
(
this
.
context
,
propName
+
":8888"
);
setupContext
();
...
...
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