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
6aefa229
Commit
6aefa229
authored
Jan 02, 2018
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
984351fa
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
177 additions
and
80 deletions
+177
-80
pom.xml
spring-boot-admin-samples/spring-boot-admin-sample/pom.xml
+2
-2
pom.xml
spring-boot-admin-server-ui/pom.xml
+10
-0
AdminServerUiAutoConfiguration.java
...dmin/server/ui/config/AdminServerUiAutoConfiguration.java
+42
-39
AdminServerUiProperties.java
.../boot/admin/server/ui/config/AdminServerUiProperties.java
+77
-0
AdminServerProperties.java
...ntric/boot/admin/server/config/AdminServerProperties.java
+10
-4
additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+24
-28
ClientProperties.java
...odecentric/boot/admin/client/config/ClientProperties.java
+9
-4
InstanceProperties.java
...ecentric/boot/admin/client/config/InstanceProperties.java
+3
-3
No files found.
spring-boot-admin-samples/spring-boot-admin-sample/pom.xml
View file @
6aefa229
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
~ Copyright 2014-201
7
the original author or authors.
~ Copyright 2014-201
8
the original author or authors.
~
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ you may not use this file except in compliance with the License.
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
</execution>
</execution>
</executions>
</executions>
<configuration>
<configuration>
<mainClass>
de.codecentric.boot.admin.
Test
Application
</mainClass>
<mainClass>
de.codecentric.boot.admin.
SpringBootAdmin
Application
</mainClass>
<addResources>
false
</addResources>
<addResources>
false
</addResources>
</configuration>
</configuration>
</plugin>
</plugin>
...
...
spring-boot-admin-server-ui/pom.xml
View file @
6aefa229
...
@@ -35,6 +35,16 @@
...
@@ -35,6 +35,16 @@
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
<optional>
true
</optional>
<optional>
true
</optional>
</dependency>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-configuration-processor
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
<plugins>
<plugins>
...
...
spring-boot-admin-server-ui/src/main/java/de/codecentric/boot/admin/server/ui/config/AdminServerUiAutoConfiguration.java
View file @
6aefa229
...
@@ -24,10 +24,10 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
...
@@ -24,10 +24,10 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
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
org.springframework.http.CacheControl
;
import
org.springframework.web.reactive.config.WebFluxConfigurer
;
import
org.springframework.web.reactive.config.WebFluxConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver
;
import
org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver
;
...
@@ -35,65 +35,68 @@ import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
...
@@ -35,65 +35,68 @@ import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
@Configuration
@Configuration
@ConditionalOnBean
(
AdminServerMarkerConfiguration
.
Marker
.
class
)
@ConditionalOnBean
(
AdminServerMarkerConfiguration
.
Marker
.
class
)
@AutoConfigureAfter
(
AdminServerWebConfiguration
.
class
)
@AutoConfigureAfter
(
AdminServerWebConfiguration
.
class
)
@EnableConfigurationProperties
(
AdminServerUiProperties
.
class
)
public
class
AdminServerUiAutoConfiguration
{
public
class
AdminServerUiAutoConfiguration
{
private
final
AdminServerUiProperties
uiProperties
;
private
final
ApplicationContext
applicationContext
;
//FIXME make property of it
public
AdminServerUiAutoConfiguration
(
AdminServerUiProperties
uiProperties
,
ApplicationContext
applicationContext
)
{
public
static
final
String
SBA_RESOURCE_LOC
=
"file:/Users/jedmeier/projects/spring-boot-admin/spring-boot-admin-server-ui/target/dist/"
;
this
.
uiProperties
=
uiProperties
;
//public static final String SBA_RESOURCE_LOC = "classpath:/META-INF/spring-boot-admin-server-ui/";
this
.
applicationContext
=
applicationContext
;
}
@Configuration
public
static
class
UiConfiguration
{
private
final
ApplicationContext
applicationContext
;
public
UiConfiguration
(
ApplicationContext
applicationContext
)
{
this
.
applicationContext
=
applicationContext
;
}
@Bean
@ConditionalOnMissingBean
public
UiController
homeUiController
()
{
return
new
UiController
();
}
@Bean
@Bean
public
SpringResourceTemplateResolver
adminTemplateResolver
()
{
@ConditionalOnMissingBean
SpringResourceTemplateResolver
resolver
=
new
SpringResourceTemplateResolver
();
public
UiController
homeUiController
()
{
resolver
.
setApplicationContext
(
this
.
applicationContext
);
return
new
UiController
();
resolver
.
setPrefix
(
SBA_RESOURCE_LOC
);
}
resolver
.
setSuffix
(
".html"
);
resolver
.
setTemplateMode
(
"HTML"
);
resolver
.
setCharacterEncoding
(
"UTF-8"
);
//FIXME make property of it
resolver
.
setCacheable
(
false
);
resolver
.
setOrder
(
10
);
resolver
.
setCheckExistence
(
true
);
return
resolver
;
}
@Bean
public
SpringResourceTemplateResolver
adminTemplateResolver
()
{
SpringResourceTemplateResolver
resolver
=
new
SpringResourceTemplateResolver
();
resolver
.
setApplicationContext
(
this
.
applicationContext
);
resolver
.
setPrefix
(
uiProperties
.
getTemplateLocation
());
resolver
.
setSuffix
(
".html"
);
resolver
.
setTemplateMode
(
"HTML"
);
resolver
.
setCharacterEncoding
(
"UTF-8"
);
//FIXME make property of it
resolver
.
setCacheable
(
false
);
resolver
.
setOrder
(
10
);
resolver
.
setCheckExistence
(
true
);
return
resolver
;
}
}
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
REACTIVE
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
REACTIVE
)
@Configuration
@Configuration
public
static
class
ReactiveUiConfiguration
implements
WebFluxConfigurer
{
public
static
class
ReactiveUiConfiguration
implements
WebFluxConfigurer
{
private
final
AdminServerUiProperties
uiProperties
;
public
ReactiveUiConfiguration
(
AdminServerUiProperties
uiProperties
)
{
this
.
uiProperties
=
uiProperties
;
}
@Override
@Override
public
void
addResourceHandlers
(
org
.
springframework
.
web
.
reactive
.
config
.
ResourceHandlerRegistry
registry
)
{
public
void
addResourceHandlers
(
org
.
springframework
.
web
.
reactive
.
config
.
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"/**"
)
.
addResourceLocations
(
SBA_RESOURCE_LOC
)
registry
.
addResourceHandler
(
"/**"
)
//FIXME make property of it
.
addResourceLocations
(
uiProperties
.
getResourceLocations
())
.
setCacheControl
(
CacheControl
.
noStore
());
.
setCacheControl
(
uiProperties
.
getCache
().
toCacheControl
());
}
}
}
}
//FIXME move to ui project
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
SERVLET
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
SERVLET
)
@Configuration
@Configuration
public
static
class
ServletUiConfiguration
implements
WebMvcConfigurer
{
public
static
class
ServletUiConfiguration
implements
WebMvcConfigurer
{
private
final
AdminServerUiProperties
uiProperties
;
public
ServletUiConfiguration
(
AdminServerUiProperties
uiProperties
)
{
this
.
uiProperties
=
uiProperties
;
}
@Override
@Override
public
void
addResourceHandlers
(
org
.
springframework
.
web
.
servlet
.
config
.
annotation
.
ResourceHandlerRegistry
registry
)
{
public
void
addResourceHandlers
(
org
.
springframework
.
web
.
servlet
.
config
.
annotation
.
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"/**"
)
.
addResourceLocations
(
SBA_RESOURCE_LOC
)
registry
.
addResourceHandler
(
"/**"
)
//FIXME make property of it
.
addResourceLocations
(
uiProperties
.
getResourceLocations
())
.
setCacheControl
(
CacheControl
.
noStore
());
.
setCacheControl
(
uiProperties
.
getCache
().
toCacheControl
());
}
}
}
}
}
}
spring-boot-admin-server-ui/src/main/java/de/codecentric/boot/admin/server/ui/config/AdminServerUiProperties.java
0 → 100644
View file @
6aefa229
/*
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
de
.
codecentric
.
boot
.
admin
.
server
.
ui
.
config
;
import
java.time.Duration
;
import
java.time.temporal.ChronoUnit
;
import
java.util.concurrent.TimeUnit
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.bind.convert.DefaultDurationUnit
;
import
org.springframework.http.CacheControl
;
@lombok
.
Data
@ConfigurationProperties
(
"spring.boot.admin.ui"
)
public
class
AdminServerUiProperties
{
private
static
final
String
[]
CLASSPATH_RESOURCE_LOCATIONS
=
{
"classpath:/META-INF/spring-boot-admin-server-ui/"
};
/**
* Locations of SBA ui resources.
*/
private
String
[]
resourceLocations
=
CLASSPATH_RESOURCE_LOCATIONS
;
/**
* Locations of SBA ui template.
*/
private
String
templateLocation
=
CLASSPATH_RESOURCE_LOCATIONS
[
0
];
private
final
Cache
cache
=
new
Cache
();
@lombok
.
Data
public
static
class
Cache
{
/**
* include "max-age" directive in Cache-Control http header.
*/
@DefaultDurationUnit
(
ChronoUnit
.
SECONDS
)
private
Duration
maxAge
=
Duration
.
ofSeconds
(
3600
);
/**
* include "no-cache" directive in Cache-Control http header.
*/
private
Boolean
noCache
=
false
;
/**
* include "no-store" directive in Cache-Control http header.
*/
private
Boolean
noStore
=
false
;
public
CacheControl
toCacheControl
()
{
if
(
Boolean
.
TRUE
.
equals
(
this
.
noStore
))
{
return
CacheControl
.
noStore
();
}
if
(
Boolean
.
TRUE
.
equals
(
this
.
noCache
))
{
return
CacheControl
.
noCache
();
}
if
(
this
.
maxAge
!=
null
)
{
return
CacheControl
.
maxAge
(
this
.
maxAge
.
getSeconds
(),
TimeUnit
.
SECONDS
);
}
return
CacheControl
.
empty
();
}
}
}
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/config/AdminServerProperties.java
View file @
6aefa229
...
@@ -17,7 +17,9 @@
...
@@ -17,7 +17,9 @@
package
de
.
codecentric
.
boot
.
admin
.
server
.
config
;
package
de
.
codecentric
.
boot
.
admin
.
server
.
config
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.temporal.ChronoUnit
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.bind.convert.DefaultDurationUnit
;
@lombok
.
Data
@lombok
.
Data
@ConfigurationProperties
(
"spring.boot.admin"
)
@ConfigurationProperties
(
"spring.boot.admin"
)
...
@@ -80,23 +82,27 @@ public class AdminServerProperties {
...
@@ -80,23 +82,27 @@ public class AdminServerProperties {
/**
/**
* Time interval to update the status of instances with expired statusInfo
* Time interval to update the status of instances with expired statusInfo
*/
*/
private
Duration
period
=
Duration
.
ofSeconds
(
10
);
@DefaultDurationUnit
(
ChronoUnit
.
MILLIS
)
private
Duration
period
=
Duration
.
ofMillis
(
10_000L
);
/**
/**
* Lifetime of status. The status won't be updated as long the last status isn't
* Lifetime of status. The status won't be updated as long the last status isn't
* expired.
* expired.
*/
*/
private
Duration
statusLifetime
=
Duration
.
ofSeconds
(
10
);
@DefaultDurationUnit
(
ChronoUnit
.
MILLIS
)
private
Duration
statusLifetime
=
Duration
.
ofMillis
(
10_000L
);
/**
/**
* Connect timeout when querying the instances' status and info.
* Connect timeout when querying the instances' status and info.
*/
*/
private
Duration
connectTimeout
=
Duration
.
ofSeconds
(
2
);
@DefaultDurationUnit
(
ChronoUnit
.
MILLIS
)
private
Duration
connectTimeout
=
Duration
.
ofMillis
(
2_000
);
/**
/**
* read timeout when querying the instances' status and info.
* read timeout when querying the instances' status and info.
*/
*/
private
Duration
readTimeout
=
Duration
.
ofSeconds
(
5
);
@DefaultDurationUnit
(
ChronoUnit
.
MILLIS
)
private
Duration
readTimeout
=
Duration
.
ofMillis
(
5_000
);
}
}
}
}
spring-boot-admin-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json
View file @
6aefa229
{
"groups"
:
[
{
"groups"
:
[
],
"properties"
:
[
],
{
"properties"
:
[
"name"
:
"spring.boot.admin.hazelcast.enabled"
,
{
"type"
:
"java.lang.Boolean"
,
"name"
:
"spring.boot.admin.hazelcast.enabled"
,
"description"
:
"Enable Hazelcast support."
,
"type"
:
"java.lang.Boolean"
,
"defaultValue"
:
"true"
"description"
:
"Enable Hazelcast support."
,
},
"defaultValue"
:
"true"
{
},
"name"
:
"spring.boot.admin.hazelcast.application-store"
,
{
"type"
:
"java.lang.String"
,
"name"
:
"spring.boot.admin.hazelcast.event-store"
,
"description"
:
"Name of backing Hazelcast-Map for storing applications"
,
"type"
:
"java.lang.String"
,
"defaultValue"
:
"spring-boot-admin-application-store"
"description"
:
"Name of backing Hazelcast-Map for storing the instance events"
,
},
"defaultValue"
:
"spring-boot-admin-application-store"
{
},
"name"
:
"spring.boot.admin.hazelcast.application-store"
,
{
"type"
:
"java.lang.String"
,
"name"
:
"spring.boot.admin.discovery.enabled"
,
"description"
:
"Name of backing Hazelcast-List for storing the journal"
,
"type"
:
"java.lang.Boolean"
,
"defaultValue"
:
"spring-boot-admin-event-store"
"description"
:
"Enable Spring Cloud Discovery support."
,
},
"defaultValue"
:
"true"
{
}
"name"
:
"spring.boot.admin.discovery.enabled"
,
]
"type"
:
"java.lang.Boolean"
,
}
"description"
:
"Enable Spring Cloud Discovery support."
,
"defaultValue"
:
"true"
}
]}
spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/client/config/ClientProperties.java
View file @
6aefa229
/*
/*
* Copyright 2014-201
7
the original author or authors.
* Copyright 2014-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,7 +16,9 @@
...
@@ -16,7 +16,9 @@
package
de
.
codecentric
.
boot
.
admin
.
client
.
config
;
package
de
.
codecentric
.
boot
.
admin
.
client
.
config
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.temporal.ChronoUnit
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.bind.convert.DefaultDurationUnit
;
@lombok
.
Data
@lombok
.
Data
@ConfigurationProperties
(
prefix
=
"spring.boot.admin.client"
)
@ConfigurationProperties
(
prefix
=
"spring.boot.admin.client"
)
...
@@ -35,17 +37,20 @@ public class ClientProperties {
...
@@ -35,17 +37,20 @@ public class ClientProperties {
/**
/**
* Time interval the registration is repeated
* Time interval the registration is repeated
*/
*/
private
Duration
period
=
Duration
.
ofSeconds
(
10
);
@DefaultDurationUnit
(
ChronoUnit
.
MILLIS
)
private
Duration
period
=
Duration
.
ofMillis
(
10_000L
);
/**
/**
* Connect timeout for the registration.
* Connect timeout for the registration.
*/
*/
private
Duration
connectTimeout
=
Duration
.
ofSeconds
(
5
);
@DefaultDurationUnit
(
ChronoUnit
.
MILLIS
)
private
Duration
connectTimeout
=
Duration
.
ofMillis
(
5_000L
);
/**
/**
* Read timeout (in ms) for the registration.
* Read timeout (in ms) for the registration.
*/
*/
private
Duration
readTimeout
=
Duration
.
ofSeconds
(
5
);
@DefaultDurationUnit
(
ChronoUnit
.
MILLIS
)
private
Duration
readTimeout
=
Duration
.
ofMillis
(
5_000L
);
/**
/**
* Username for basic authentication on admin server
* Username for basic authentication on admin server
...
...
spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/client/config/InstanceProperties.java
View file @
6aefa229
/*
/*
* Copyright 2014-201
7
the original author or authors.
* Copyright 2014-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
*/
*/
package
de
.
codecentric
.
boot
.
admin
.
client
.
config
;
package
de
.
codecentric
.
boot
.
admin
.
client
.
config
;
import
java.util.HashMap
;
import
java.util.
Linked
HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
...
@@ -65,6 +65,6 @@ public class InstanceProperties {
...
@@ -65,6 +65,6 @@ public class InstanceProperties {
/**
/**
* Metadata that should be associated with this application
* Metadata that should be associated with this application
*/
*/
private
Map
<
String
,
String
>
metadata
=
new
HashMap
<>();
private
Map
<
String
,
String
>
metadata
=
new
Linked
HashMap
<>();
}
}
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