Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
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-boot-admin
Commits
1eec10c5
Commit
1eec10c5
authored
Oct 23, 2015
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ApplicationDiscoveryListener customizable
parent
b107544a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
DiscoveryClientConfiguration.java
...ntric/boot/admin/config/DiscoveryClientConfiguration.java
+4
-2
ApplicationDiscoveryListener.java
...ic/boot/admin/discovery/ApplicationDiscoveryListener.java
+3
-3
No files found.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/DiscoveryClientConfiguration.java
View file @
1eec10c5
...
...
@@ -18,8 +18,9 @@ package de.codecentric.boot.admin.config;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Class
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
MissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
import
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -29,7 +30,7 @@ import de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener;
import
de.codecentric.boot.admin.registry.ApplicationRegistry
;
@Configuration
@ConditionalOn
Class
({
DiscoveryClient
.
class
}
)
@ConditionalOn
SingleCandidate
(
DiscoveryClient
.
class
)
@ConditionalOnProperty
(
prefix
=
"spring.boot.admin.discovery"
,
name
=
"enabled"
,
matchIfMissing
=
true
)
@AutoConfigureAfter
({
NoopDiscoveryClientAutoConfiguration
.
class
})
public
class
DiscoveryClientConfiguration
{
...
...
@@ -44,6 +45,7 @@ public class DiscoveryClientConfiguration {
private
ApplicationRegistry
registry
;
@Bean
@ConditionalOnMissingBean
public
ApplicationDiscoveryListener
applicationDiscoveryListener
()
{
ApplicationDiscoveryListener
listener
=
new
ApplicationDiscoveryListener
(
discoveryClient
,
registry
);
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/discovery/ApplicationDiscoveryListener.java
View file @
1eec10c5
...
...
@@ -73,7 +73,7 @@ public class ApplicationDiscoveryListener {
}
}
p
ublic
void
discover
()
{
p
rotected
void
discover
()
{
for
(
String
serviceId
:
discoveryClient
.
getServices
())
{
for
(
ServiceInstance
instance
:
discoveryClient
.
getInstances
(
serviceId
))
{
registry
.
register
(
convert
(
instance
));
...
...
@@ -81,7 +81,7 @@ public class ApplicationDiscoveryListener {
}
}
pr
ivate
Application
convert
(
ServiceInstance
instance
)
{
pr
otected
Application
convert
(
ServiceInstance
instance
)
{
String
serviceUrl
=
append
(
instance
.
getUri
().
toString
(),
serviceContextPath
);
String
managementUrl
=
append
(
instance
.
getUri
().
toString
(),
managementContextPath
);
String
healthUrl
=
append
(
managementUrl
,
healthEndpoint
);
...
...
@@ -102,7 +102,7 @@ public class ApplicationDiscoveryListener {
this
.
healthEndpoint
=
healthEndpoint
;
}
pr
ivate
String
append
(
String
uri
,
String
path
)
{
pr
otected
final
String
append
(
String
uri
,
String
path
)
{
String
baseUri
=
uri
.
replaceFirst
(
"/+$"
,
""
);
if
(
StringUtils
.
isEmpty
(
path
))
{
return
baseUri
;
...
...
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