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
46e319ee
Commit
46e319ee
authored
Jun 01, 2016
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.3.x'
parents
778ca87c
e1eeb038
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
17 deletions
+96
-17
pom.xml
spring-boot-admin-docs/pom.xml
+0
-1
pom.xml
spring-boot-admin-samples/pom.xml
+0
-1
pom.xml
...g-boot-admin-samples/spring-boot-admin-sample-war/pom.xml
+0
-2
DiscoveryClientConfiguration.java
...ntric/boot/admin/config/DiscoveryClientConfiguration.java
+9
-13
DiscoveryClientConfigurationTest.java
...c/boot/admin/config/DiscoveryClientConfigurationTest.java
+87
-0
No files found.
spring-boot-admin-docs/pom.xml
View file @
46e319ee
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
<version>
1.4.0-SNAPSHOT
</version>
<version>
1.4.0-SNAPSHOT
</version>
<relativePath>
..
</relativePath>
<relativePath>
..
</relativePath>
</parent>
</parent>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-docs
</artifactId>
<artifactId>
spring-boot-admin-docs
</artifactId>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<name>
Spring Boot Admin Docs
</name>
<name>
Spring Boot Admin Docs
</name>
...
...
spring-boot-admin-samples/pom.xml
View file @
46e319ee
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
<version>
1.4.0-SNAPSHOT
</version>
<version>
1.4.0-SNAPSHOT
</version>
<relativePath>
..
</relativePath>
<relativePath>
..
</relativePath>
</parent>
</parent>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-samples
</artifactId>
<artifactId>
spring-boot-admin-samples
</artifactId>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<name>
Spring Boot Admin Samples
</name>
<name>
Spring Boot Admin Samples
</name>
...
...
spring-boot-admin-samples/spring-boot-admin-sample-war/pom.xml
View file @
46e319ee
<?xml version="1.0"?>
<?xml version="1.0"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-sample-war
</artifactId>
<artifactId>
spring-boot-admin-sample-war
</artifactId>
<version>
1.4.0-SNAPSHOT
</version>
<packaging>
war
</packaging>
<packaging>
war
</packaging>
<parent>
<parent>
<groupId>
de.codecentric
</groupId>
<groupId>
de.codecentric
</groupId>
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/DiscoveryClientConfiguration.java
View file @
46e319ee
...
@@ -17,18 +17,18 @@ package de.codecentric.boot.admin.config;
...
@@ -17,18 +17,18 @@ package de.codecentric.boot.admin.config;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureBefore
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
import
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
;
import
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
;
import
org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient.EurekaServiceInstance
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
com.netflix.discovery.EurekaClient
;
import
de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener
;
import
de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener
;
import
de.codecentric.boot.admin.discovery.DefaultServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.DefaultServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.EurekaServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.EurekaServiceInstanceConverter
;
...
@@ -58,23 +58,19 @@ public class DiscoveryClientConfiguration {
...
@@ -58,23 +58,19 @@ public class DiscoveryClientConfiguration {
}
}
@Configuration
@Configuration
@ConditionalOnClass
({
EurekaServiceInstance
.
class
})
@ConditionalOnBean
(
EurekaClient
.
class
)
@AutoConfigureBefore
(
DefaultConverterConfiguration
.
class
)
public
static
class
EurekaConverterConfiguration
{
public
static
class
EurekaConverterConfiguration
{
@Bean
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingBean
({
ServiceInstanceConverter
.
class
})
public
EurekaServiceInstanceConverter
serviceInstanceConverter
()
{
public
EurekaServiceInstanceConverter
serviceInstanceConverter
()
{
return
new
EurekaServiceInstanceConverter
();
return
new
EurekaServiceInstanceConverter
();
}
}
}
}
@Configuration
@Bean
@ConditionalOnMissingBean
({
ServiceInstanceConverter
.
class
})
@ConfigurationProperties
(
prefix
=
"spring.boot.admin.discovery.converter"
)
@ConfigurationProperties
(
prefix
=
"spring.boot.admin.discovery.converter"
)
public
static
class
DefaultConverterConfiguration
{
public
DefaultServiceInstanceConverter
serviceInstanceConverter
()
{
@Bean
return
new
DefaultServiceInstanceConverter
();
@ConditionalOnMissingBean
public
DefaultServiceInstanceConverter
serviceInstanceConverter
()
{
return
new
DefaultServiceInstanceConverter
();
}
}
}
}
}
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/config/DiscoveryClientConfigurationTest.java
0 → 100644
View file @
46e319ee
package
de
.
codecentric
.
boot
.
admin
.
config
;
import
static
org
.
hamcrest
.
CoreMatchers
.
instanceOf
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.cloud.client.ServiceInstance
;
import
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
;
import
org.springframework.cloud.commons.util.UtilAutoConfiguration
;
import
org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
de.codecentric.boot.admin.discovery.DefaultServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.EurekaServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.ServiceInstanceConverter
;
import
de.codecentric.boot.admin.model.Application
;
public
class
DiscoveryClientConfigurationTest
{
private
AnnotationConfigWebApplicationContext
context
;
@After
public
void
close
()
{
if
(
this
.
context
!=
null
)
{
this
.
context
.
close
();
}
}
@Test
public
void
defaultServiceInstanceConverter
()
{
load
(
NoopDiscoveryClientAutoConfiguration
.
class
);
assertThat
(
context
.
getBean
(
ServiceInstanceConverter
.
class
),
is
(
instanceOf
(
DefaultServiceInstanceConverter
.
class
)));
}
@Test
public
void
eurekaServiceInstanceConverter
()
{
load
(
UtilAutoConfiguration
.
class
,
EurekaClientAutoConfiguration
.
class
);
assertThat
(
context
.
getBean
(
ServiceInstanceConverter
.
class
),
is
(
instanceOf
(
EurekaServiceInstanceConverter
.
class
)));
}
@Test
public
void
customServiceInstanceConverter
()
{
load
(
NoopDiscoveryClientAutoConfiguration
.
class
,
TestCustomServiceInstanceConverterConfig
.
class
);
assertThat
(
context
.
getBean
(
ServiceInstanceConverter
.
class
),
is
(
instanceOf
(
CustomServiceInstanceConverter
.
class
)));
}
@Configuration
static
class
TestCustomServiceInstanceConverterConfig
{
@Bean
public
CustomServiceInstanceConverter
converter
()
{
return
new
CustomServiceInstanceConverter
();
}
}
static
class
CustomServiceInstanceConverter
implements
ServiceInstanceConverter
{
@Override
public
Application
convert
(
ServiceInstance
instance
)
{
return
null
;
}
}
private
void
load
(
Class
<?>...
configs
)
{
AnnotationConfigWebApplicationContext
applicationContext
=
new
AnnotationConfigWebApplicationContext
();
for
(
Class
<?>
config
:
configs
)
{
applicationContext
.
register
(
config
);
}
applicationContext
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
);
applicationContext
.
register
(
ServerPropertiesAutoConfiguration
.
class
);
applicationContext
.
register
(
AdminServerWebConfiguration
.
class
);
applicationContext
.
register
(
DiscoveryClientConfiguration
.
class
);
applicationContext
.
refresh
();
this
.
context
=
applicationContext
;
}
}
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