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
50efa853
Commit
50efa853
authored
Nov 04, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add optional DiscoveryClientOptionalArgs
For extensibility by connectors
parent
966e03ba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
DiscoveryClientConfiguration.java
...rk/cloud/netflix/eureka/DiscoveryClientConfiguration.java
+20
-11
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/DiscoveryClientConfiguration.java
View file @
50efa853
...
@@ -16,11 +16,14 @@
...
@@ -16,11 +16,14 @@
package
org
.
springframework
.
cloud
.
netflix
.
eureka
;
package
org
.
springframework
.
cloud
.
netflix
.
eureka
;
import
com.netflix.appinfo.ApplicationInfoManager
;
import
java.lang.annotation.Documented
;
import
com.netflix.appinfo.EurekaInstanceConfig
;
import
java.lang.annotation.ElementType
;
import
com.netflix.discovery.EurekaClient
;
import
java.lang.annotation.Retention
;
import
com.netflix.discovery.EurekaClientConfig
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.AllNestedConditions
;
import
org.springframework.boot.autoconfigure.condition.AllNestedConditions
;
import
org.springframework.boot.autoconfigure.condition.AnyNestedCondition
;
import
org.springframework.boot.autoconfigure.condition.AnyNestedCondition
;
...
@@ -36,11 +39,11 @@ import org.springframework.context.annotation.Bean;
...
@@ -36,11 +39,11 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Conditional
;
import
org.springframework.context.annotation.Conditional
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
java.lang.annotation.Documented
;
import
com.netflix.appinfo.ApplicationInfoManager
;
import
java.lang.annotation.ElementType
;
import
com.netflix.appinfo.EurekaInstanceConfig
;
import
java.lang.annotation.Retention
;
import
com.netflix.discovery.DiscoveryClient.DiscoveryClientOptionalArgs
;
import
java.lang.annotation.RetentionPolicy
;
import
com.netflix.discovery.EurekaClient
;
import
java.lang.annotation.Target
;
import
com.netflix.discovery.EurekaClientConfig
;
/**
/**
* @author Spencer Gibb
* @author Spencer Gibb
...
@@ -61,13 +64,16 @@ public class DiscoveryClientConfiguration {
...
@@ -61,13 +64,16 @@ public class DiscoveryClientConfiguration {
@Autowired
@Autowired
private
ApplicationContext
context
;
private
ApplicationContext
context
;
@Autowired
(
required
=
false
)
private
DiscoveryClientOptionalArgs
optionalArgs
;
@Bean
(
destroyMethod
=
"shutdown"
)
@Bean
(
destroyMethod
=
"shutdown"
)
@ConditionalOnMissingBean
(
value
=
EurekaClient
.
class
,
search
=
SearchStrategy
.
CURRENT
)
@ConditionalOnMissingBean
(
value
=
EurekaClient
.
class
,
search
=
SearchStrategy
.
CURRENT
)
@SneakyThrows
@SneakyThrows
public
EurekaClient
eurekaClient
(
ApplicationInfoManager
applicationInfoManager
,
public
EurekaClient
eurekaClient
(
ApplicationInfoManager
applicationInfoManager
,
EurekaClientConfig
config
,
EurekaInstanceConfig
instance
)
{
EurekaClientConfig
config
,
EurekaInstanceConfig
instance
)
{
applicationInfoManager
.
initComponent
(
instance
);
applicationInfoManager
.
initComponent
(
instance
);
return
new
CloudEurekaClient
(
applicationInfoManager
,
config
,
this
.
context
);
return
new
CloudEurekaClient
(
applicationInfoManager
,
config
,
optionalArgs
,
this
.
context
);
}
}
}
}
...
@@ -78,6 +84,9 @@ public class DiscoveryClientConfiguration {
...
@@ -78,6 +84,9 @@ public class DiscoveryClientConfiguration {
@Autowired
@Autowired
private
ApplicationContext
context
;
private
ApplicationContext
context
;
@Autowired
(
required
=
false
)
private
DiscoveryClientOptionalArgs
optionalArgs
;
@Bean
(
destroyMethod
=
"shutdown"
)
@Bean
(
destroyMethod
=
"shutdown"
)
@ConditionalOnMissingBean
(
value
=
EurekaClient
.
class
,
search
=
SearchStrategy
.
CURRENT
)
@ConditionalOnMissingBean
(
value
=
EurekaClient
.
class
,
search
=
SearchStrategy
.
CURRENT
)
@SneakyThrows
@SneakyThrows
...
@@ -85,7 +94,7 @@ public class DiscoveryClientConfiguration {
...
@@ -85,7 +94,7 @@ public class DiscoveryClientConfiguration {
public
EurekaClient
eurekaClient
(
ApplicationInfoManager
applicationInfoManager
,
public
EurekaClient
eurekaClient
(
ApplicationInfoManager
applicationInfoManager
,
EurekaClientConfig
config
,
EurekaInstanceConfig
instance
)
{
EurekaClientConfig
config
,
EurekaInstanceConfig
instance
)
{
applicationInfoManager
.
initComponent
(
instance
);
applicationInfoManager
.
initComponent
(
instance
);
return
new
CloudEurekaClient
(
applicationInfoManager
,
config
,
this
.
context
);
return
new
CloudEurekaClient
(
applicationInfoManager
,
config
,
optionalArgs
,
this
.
context
);
}
}
}
}
...
...
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