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
b533ad3b
Commit
b533ad3b
authored
Oct 26, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to spring.cloud.config.bootstrap.enabled=true
To enable EUreka-first bootstrap. See gh-42
parent
46e6d24a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
DiscoveryClientConfigServiceBootstrapConfiguration.java
...g/DiscoveryClientConfigServiceBootstrapConfiguration.java
+2
-4
DiscoveryClientConfigServiceBootstrapConfigurationTests.java
...coveryClientConfigServiceBootstrapConfigurationTests.java
+2
-2
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/config/DiscoveryClientConfigServiceBootstrapConfiguration.java
View file @
b533ad3b
...
...
@@ -36,7 +36,7 @@ import com.netflix.discovery.DiscoveryClient;
*
*/
@ConditionalOnClass
({
DiscoveryClient
.
class
,
ConfigServicePropertySourceLocator
.
class
})
@ConditionalOnExpression
(
"${spring.cloud.
bootstrap.useDiscovery
:false}"
)
@ConditionalOnExpression
(
"${spring.cloud.
config.discovery.enabled
:false}"
)
@Configuration
@EnableEurekaClient
@Import
(
EurekaClientAutoConfiguration
.
class
)
...
...
@@ -44,8 +44,6 @@ import com.netflix.discovery.DiscoveryClient;
public
class
DiscoveryClientConfigServiceBootstrapConfiguration
implements
ApplicationListener
<
ContextRefreshedEvent
>
{
private
static
final
String
DEFAULT_CONFIG_SERVER
=
"CONFIGSERVER"
;
@Autowired
private
DiscoveryClient
client
;
...
...
@@ -56,7 +54,7 @@ public class DiscoveryClientConfigServiceBootstrapConfiguration implements
public
void
onApplicationEvent
(
ContextRefreshedEvent
event
)
{
try
{
log
.
info
(
"Locating configserver via discovery"
);
InstanceInfo
server
=
client
.
getNextServerFromEureka
(
DEFAULT_CONFIG_SERVER
,
InstanceInfo
server
=
client
.
getNextServerFromEureka
(
delegate
.
getDiscovery
().
getServiceId
()
,
false
);
String
url
=
server
.
getHomePageUrl
();
if
(
server
.
getMetadata
().
containsKey
(
"password"
))
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/config/DiscoveryClientConfigServiceBootstrapConfigurationTests.java
View file @
b533ad3b
...
...
@@ -62,7 +62,7 @@ public class DiscoveryClientConfigServiceBootstrapConfigurationTests {
public
void
onWhenRequested
()
throws
Exception
{
Mockito
.
when
(
client
.
getNextServerFromEureka
(
"CONFIGSERVER"
,
false
)).
thenReturn
(
info
);
setup
(
"spring.cloud.
bootstrap.useDiscovery
=true"
);
setup
(
"spring.cloud.
config.discovery.enabled
=true"
);
assertEquals
(
1
,
context
.
getBeanNamesForType
(
DiscoveryClientConfigServiceBootstrapConfiguration
.
class
).
length
);
...
...
@@ -77,7 +77,7 @@ public class DiscoveryClientConfigServiceBootstrapConfigurationTests {
info
.
getMetadata
().
put
(
"password"
,
"bar"
);
Mockito
.
when
(
client
.
getNextServerFromEureka
(
"CONFIGSERVER"
,
false
)).
thenReturn
(
info
);
setup
(
"spring.cloud.
bootstrap.useDiscovery
=true"
);
setup
(
"spring.cloud.
config.discovery.enabled
=true"
);
ConfigServicePropertySourceLocator
locator
=
context
.
getBean
(
ConfigServicePropertySourceLocator
.
class
);
assertEquals
(
"http://foo:7001/"
,
locator
.
getUri
());
...
...
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