Skip to content
This repository was archived by the owner on Jun 29, 2018. It is now read-only.

Commit 47d8e17

Browse files
author
Johannes Stelzer
committed
Added spring-boot-configuration-processor and addiotional metadata for ConfigurationProperties
1 parent 39e77e6 commit 47d8e17

File tree

6 files changed

+93
-37
lines changed

6 files changed

+93
-37
lines changed

spring-boot-admin-server/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
<groupId>org.apache.commons</groupId>
2626
<artifactId>commons-lang3</artifactId>
2727
</dependency>
28+
<dependency>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-configuration-processor</artifactId>
31+
<optional>true</optional>
32+
</dependency>
2833

2934
<!-- Use Zuul WITHOUT Hystrix/Ribbon/Config Client -->
3035
<dependency>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{"groups": [
2+
{
3+
"name": "spring.boot.admin.hazelcast",
4+
"sourceType": "de.codecentric.boot.admin.config.AdminServerWebConfiguration.HazelcastStoreConfiguration"
5+
},
6+
{
7+
"name": "spring.boot.admin.discovery",
8+
"sourceType": "de.codecentric.boot.admin.config.AdminServerWebConfiguration.DiscoveryClientConfiguration"
9+
}
10+
],"properties": [
11+
{
12+
"name": "spring.boot.admin.hazelcast.enabled",
13+
"type": "java.lang.Boolean",
14+
"description": "Enable Hazelcast support.",
15+
"defaultValue": "true"
16+
},
17+
{
18+
"name": "spring.boot.admin.hazelcast.map",
19+
"type": "java.lang.String",
20+
"description": "Name of backing Hazelcast-Map",
21+
"defaultValue": "spring-boot-admin-application-store"
22+
},
23+
{
24+
"name": "spring.boot.admin.discovery.enabled",
25+
"type": "java.lang.Boolean",
26+
"description": "Enable Spring Cloud Discovery support.",
27+
"defaultValue": "true"
28+
},
29+
{
30+
"name": "spring.boot.admin.discovery.management.context-path",
31+
"type": "java.lang.String",
32+
"description": "management-path suffix for discovered applications",
33+
"defaultValue": ""
34+
}
35+
]

spring-boot-admin-starter-client/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
<groupId>org.springframework</groupId>
2626
<artifactId>spring-web</artifactId>
2727
</dependency>
28+
<dependency>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-configuration-processor</artifactId>
31+
<optional>true</optional>
32+
</dependency>
2833
<dependency>
2934
<groupId>org.jolokia</groupId>
3035
<artifactId>jolokia-core</artifactId>

spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/actuate/LogfileMvcEndpoint.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,25 @@ public class LogfileMvcEndpoint implements MvcEndpoint {
4444

4545
private static final Logger LOGGER = LoggerFactory.getLogger(LogfileMvcEndpoint.class);
4646

47+
/**
48+
* Logfile to serve at this endpoint. Defaults to ${logging.file}.
49+
*/
4750
@Value("${logging.file}")
4851
private String logfile;
4952

53+
/**
54+
* Path of the logfile-endpoint
55+
*/
5056
private String path = "/logfile";
5157

58+
/**
59+
* Is the logfile endpoint sensitive
60+
*/
5261
private boolean sensitive = true;
5362

63+
/**
64+
* Enable the logfile endpoint
65+
*/
5466
private boolean enabled = true;
5567

5668
@Override

spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/config/AdminClientProperties.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,27 @@
3737
@Order(Ordered.LOWEST_PRECEDENCE - 100)
3838
public class AdminClientProperties implements ApplicationListener<ApplicationEvent> {
3939

40+
/**
41+
* Client-management-URL to register with. Inferred at runtime, can be overriden in
42+
* case the reachable URL is different (e.g. Docker).
43+
*/
4044
private String managementUrl;
45+
46+
/**
47+
* Client-service-URL register with. Inferred at runtime, can be overriden in case the
48+
* reachable URL is different (e.g. Docker).
49+
*/
4150
private String serviceUrl;
51+
52+
/**
53+
* Client-health-URL to register with. Inferred at runtime, can be overriden in case
54+
* the reachable URL is different (e.g. Docker). Must be unique in registry.
55+
*/
4256
private String healthUrl;
4357

58+
/**
59+
* Name to register with. Defaults to ${spring.application.name}
60+
*/
4461
@Value("${spring.application.name:spring-boot-application}")
4562
private String name;
4663

@@ -90,11 +107,6 @@ private boolean startedDeployedWar(ApplicationEvent event) {
90107
return false;
91108
}
92109

93-
94-
/**
95-
* @return Client-management-URL to register with. Can be overriden in case the
96-
* reachable URL is different (e.g. Docker). Must be unique in registry.
97-
*/
98110
public String getManagementUrl() {
99111
if (managementUrl == null) {
100112
if (managementPort != -1) {
@@ -113,11 +125,6 @@ public void setManagementUrl(String managementUrl) {
113125
this.managementUrl = managementUrl;
114126
}
115127

116-
/**
117-
* @return Client-health-URL to register with. Can be overriden in case the reachable
118-
* URL is different (e.g. Docker). Must be unique in registry.
119-
*/
120-
121128
public String getHealthUrl() {
122129
if (healthUrl == null) {
123130
return append(getManagementUrl(), healthEndpointId);
@@ -129,10 +136,6 @@ public void setHealthUrl(String healthUrl) {
129136
this.healthUrl = healthUrl;
130137
}
131138

132-
/**
133-
* @return Client-service-URL to register with. Can be overriden in case the reachable
134-
* URL is different (e.g. Docker). Must be unique in registry.
135-
*/
136139
public String getServiceUrl() {
137140
if (serviceUrl == null) {
138141
if (serverPort != -1){
@@ -154,9 +157,6 @@ public boolean isServerInitialized() {
154157
return serverInitialized;
155158
}
156159

157-
/**
158-
* @return Name to register with.
159-
*/
160160
public String getName() {
161161
return name;
162162
}
@@ -176,7 +176,7 @@ private String getHostname() {
176176

177177
private String createLocalUri(int port, String path) {
178178
String scheme = server.getSsl() != null && server.getSsl().isEnabled() ? "https" : "http";
179-
return append(scheme + "://" + getHostname() + ":" + port + "/", path);
179+
return append(scheme + "://" + getHostname() + ":" + port + "/", path);
180180
}
181181

182182
private String append(String uri, String path) {

spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/config/AdminProperties.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,43 @@
2020
@ConfigurationProperties(prefix = "spring.boot.admin")
2121
public class AdminProperties {
2222

23+
/**
24+
* The admin servers url to register at
25+
*/
2326
private String url;
2427

28+
/**
29+
* The admin servers context path.
30+
*/
2531
private String contextPath = "api/applications";
2632

33+
/**
34+
* Time interval (in ms) the registration is repeated
35+
*/
2736
private int period = 10000;
2837

38+
/**
39+
* Username for basic authentication on admin server
40+
*/
2941
private String username;
3042

43+
/**
44+
* Password for basic authentication on admin server
45+
*/
3146
private String password;
3247

48+
/**
49+
* Enable automatic deregistration on shutdown
50+
*/
3351
private boolean autoDeregistration;
3452

3553
public void setUrl(String url) {
3654
this.url = url;
3755
}
38-
39-
/**
40-
* @return the Spring Boot Admin Server's url.
41-
*/
4256
public String getUrl() {
4357
return url;
4458
}
4559

46-
/**
47-
* @return the Spring Boot Admin Server's context path.
48-
*/
4960
public String getContextPath() {
5061
return contextPath;
5162
}
@@ -54,9 +65,6 @@ public void setContextPath(String contextPath) {
5465
this.contextPath = contextPath;
5566
}
5667

57-
/**
58-
* @return the time interval (in ms) the registration is repeated.
59-
*/
6068
public int getPeriod() {
6169
return period;
6270
}
@@ -69,9 +77,6 @@ public void setUsername(String username) {
6977
this.username = username;
7078
}
7179

72-
/**
73-
* @return username for basic authentication .
74-
*/
7580
public String getUsername() {
7681
return username;
7782
}
@@ -80,16 +85,10 @@ public void setPassword(String password) {
8085
this.password = password;
8186
}
8287

83-
/**
84-
* @return password for basic authentication.
85-
*/
8688
public String getPassword() {
8789
return password;
8890
}
8991

90-
/**
91-
* @return wether the application deregisters automatically on shutdown.
92-
*/
9392
public boolean isAutoDeregistration() {
9493
return autoDeregistration;
9594
}

0 commit comments

Comments
 (0)