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
f511c267
Unverified
Commit
f511c267
authored
Nov 06, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix circular reference during object creation.
parent
799fbf43
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
+11
-12
EurekaClientAutoConfiguration.java
...k/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
+2
-3
EurekaRegistration.java
...ud/netflix/eureka/serviceregistry/EurekaRegistration.java
+7
-6
EurekaServiceRegistry.java
...netflix/eureka/serviceregistry/EurekaServiceRegistry.java
+2
-3
No files found.
spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
View file @
f511c267
...
...
@@ -27,6 +27,7 @@ import java.net.URL;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.ObjectProvider
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator
;
import
org.springframework.boot.actuate.health.Health
;
...
...
@@ -96,8 +97,6 @@ public class EurekaClientAutoConfiguration {
private
static
final
Log
log
=
LogFactory
.
getLog
(
EurekaClientAutoConfiguration
.
class
);
private
ConfigurableEnvironment
env
;
@Autowired
(
required
=
false
)
private
HealthCheckHandler
healthCheckHandler
;
public
EurekaClientAutoConfiguration
(
ConfigurableEnvironment
env
)
{
this
.
env
=
env
;
...
...
@@ -185,7 +184,7 @@ public class EurekaClientAutoConfiguration {
@Bean
@ConditionalOnBean
(
AutoServiceRegistrationProperties
.
class
)
@ConditionalOnProperty
(
value
=
"spring.cloud.service-registry.auto-registration.enabled"
,
matchIfMissing
=
true
)
public
EurekaRegistration
eurekaRegistration
(
EurekaClient
eurekaClient
,
CloudEurekaInstanceConfig
instanceConfig
,
ApplicationInfoManager
applicationInfoManager
)
{
public
EurekaRegistration
eurekaRegistration
(
EurekaClient
eurekaClient
,
CloudEurekaInstanceConfig
instanceConfig
,
ApplicationInfoManager
applicationInfoManager
,
ObjectProvider
<
HealthCheckHandler
>
healthCheckHandler
)
{
return
EurekaRegistration
.
builder
(
instanceConfig
)
.
with
(
applicationInfoManager
)
.
with
(
eurekaClient
)
...
...
spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaRegistration.java
View file @
f511c267
...
...
@@ -27,6 +27,7 @@ import org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.aop.framework.Advised
;
import
org.springframework.aop.support.AopUtils
;
import
org.springframework.beans.factory.ObjectProvider
;
import
org.springframework.cloud.client.DefaultServiceInstance
;
import
org.springframework.cloud.client.serviceregistry.Registration
;
import
org.springframework.cloud.netflix.eureka.CloudEurekaClient
;
...
...
@@ -51,9 +52,9 @@ public class EurekaRegistration implements Registration, Closeable {
private
final
AtomicReference
<
CloudEurekaClient
>
cloudEurekaClient
=
new
AtomicReference
<>();
private
final
CloudEurekaInstanceConfig
instanceConfig
;
private
final
ApplicationInfoManager
applicationInfoManager
;
private
HealthCheckHandler
healthCheckHandler
;
private
ObjectProvider
<
HealthCheckHandler
>
healthCheckHandler
;
private
EurekaRegistration
(
CloudEurekaInstanceConfig
instanceConfig
,
EurekaClient
eurekaClient
,
ApplicationInfoManager
applicationInfoManager
,
HealthCheckHandler
healthCheckHandler
)
{
private
EurekaRegistration
(
CloudEurekaInstanceConfig
instanceConfig
,
EurekaClient
eurekaClient
,
ApplicationInfoManager
applicationInfoManager
,
ObjectProvider
<
HealthCheckHandler
>
healthCheckHandler
)
{
this
.
eurekaClient
=
eurekaClient
;
this
.
instanceConfig
=
instanceConfig
;
this
.
applicationInfoManager
=
applicationInfoManager
;
...
...
@@ -68,7 +69,7 @@ public class EurekaRegistration implements Registration, Closeable {
private
final
CloudEurekaInstanceConfig
instanceConfig
;
private
ApplicationInfoManager
applicationInfoManager
;
private
EurekaClient
eurekaClient
;
private
HealthCheckHandler
healthCheckHandler
;
private
ObjectProvider
<
HealthCheckHandler
>
healthCheckHandler
;
private
EurekaClientConfig
clientConfig
;
private
ApplicationEventPublisher
publisher
;
...
...
@@ -87,7 +88,7 @@ public class EurekaRegistration implements Registration, Closeable {
return
this
;
}
public
Builder
with
(
HealthCheckHandler
healthCheckHandler
)
{
public
Builder
with
(
ObjectProvider
<
HealthCheckHandler
>
healthCheckHandler
)
{
this
.
healthCheckHandler
=
healthCheckHandler
;
return
this
;
}
...
...
@@ -177,11 +178,11 @@ public class EurekaRegistration implements Registration, Closeable {
return
applicationInfoManager
;
}
public
HealthCheckHandler
getHealthCheckHandler
()
{
public
ObjectProvider
<
HealthCheckHandler
>
getHealthCheckHandler
()
{
return
healthCheckHandler
;
}
public
void
setHealthCheckHandler
(
HealthCheckHandler
healthCheckHandler
)
{
public
void
setHealthCheckHandler
(
ObjectProvider
<
HealthCheckHandler
>
healthCheckHandler
)
{
this
.
healthCheckHandler
=
healthCheckHandler
;
}
...
...
spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistry.java
View file @
f511c267
...
...
@@ -45,9 +45,8 @@ public class EurekaServiceRegistry implements ServiceRegistry<EurekaRegistration
reg
.
getApplicationInfoManager
()
.
setInstanceStatus
(
reg
.
getInstanceConfig
().
getInitialStatus
());
if
(
reg
.
getHealthCheckHandler
()
!=
null
)
{
reg
.
getEurekaClient
().
registerHealthCheck
(
reg
.
getHealthCheckHandler
());
}
reg
.
getHealthCheckHandler
().
ifAvailable
(
healthCheckHandler
->
reg
.
getEurekaClient
().
registerHealthCheck
(
healthCheckHandler
));
}
private
void
maybeInitializeClient
(
EurekaRegistration
reg
)
{
...
...
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