Commit 47d8e174 by Johannes Stelzer

Added spring-boot-configuration-processor and addiotional metadata for ConfigurationProperties

parent 39e77e6f
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Use Zuul WITHOUT Hystrix/Ribbon/Config Client --> <!-- Use Zuul WITHOUT Hystrix/Ribbon/Config Client -->
<dependency> <dependency>
......
{"groups": [
{
"name": "spring.boot.admin.hazelcast",
"sourceType": "de.codecentric.boot.admin.config.AdminServerWebConfiguration.HazelcastStoreConfiguration"
},
{
"name": "spring.boot.admin.discovery",
"sourceType": "de.codecentric.boot.admin.config.AdminServerWebConfiguration.DiscoveryClientConfiguration"
}
],"properties": [
{
"name": "spring.boot.admin.hazelcast.enabled",
"type": "java.lang.Boolean",
"description": "Enable Hazelcast support.",
"defaultValue": "true"
},
{
"name": "spring.boot.admin.hazelcast.map",
"type": "java.lang.String",
"description": "Name of backing Hazelcast-Map",
"defaultValue": "spring-boot-admin-application-store"
},
{
"name": "spring.boot.admin.discovery.enabled",
"type": "java.lang.Boolean",
"description": "Enable Spring Cloud Discovery support.",
"defaultValue": "true"
},
{
"name": "spring.boot.admin.discovery.management.context-path",
"type": "java.lang.String",
"description": "management-path suffix for discovered applications",
"defaultValue": ""
}
]
\ No newline at end of file
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jolokia</groupId> <groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId> <artifactId>jolokia-core</artifactId>
</dependency> </dependency>
......
...@@ -44,13 +44,25 @@ public class LogfileMvcEndpoint implements MvcEndpoint { ...@@ -44,13 +44,25 @@ public class LogfileMvcEndpoint implements MvcEndpoint {
private static final Logger LOGGER = LoggerFactory.getLogger(LogfileMvcEndpoint.class); private static final Logger LOGGER = LoggerFactory.getLogger(LogfileMvcEndpoint.class);
/**
* Logfile to serve at this endpoint. Defaults to ${logging.file}.
*/
@Value("${logging.file}") @Value("${logging.file}")
private String logfile; private String logfile;
/**
* Path of the logfile-endpoint
*/
private String path = "/logfile"; private String path = "/logfile";
/**
* Is the logfile endpoint sensitive
*/
private boolean sensitive = true; private boolean sensitive = true;
/**
* Enable the logfile endpoint
*/
private boolean enabled = true; private boolean enabled = true;
@Override @Override
......
...@@ -37,10 +37,27 @@ import org.springframework.util.StringUtils; ...@@ -37,10 +37,27 @@ import org.springframework.util.StringUtils;
@Order(Ordered.LOWEST_PRECEDENCE - 100) @Order(Ordered.LOWEST_PRECEDENCE - 100)
public class AdminClientProperties implements ApplicationListener<ApplicationEvent> { public class AdminClientProperties implements ApplicationListener<ApplicationEvent> {
/**
* Client-management-URL to register with. Inferred at runtime, can be overriden in
* case the reachable URL is different (e.g. Docker).
*/
private String managementUrl; private String managementUrl;
/**
* Client-service-URL register with. Inferred at runtime, can be overriden in case the
* reachable URL is different (e.g. Docker).
*/
private String serviceUrl; private String serviceUrl;
/**
* Client-health-URL to register with. Inferred at runtime, can be overriden in case
* the reachable URL is different (e.g. Docker). Must be unique in registry.
*/
private String healthUrl; private String healthUrl;
/**
* Name to register with. Defaults to ${spring.application.name}
*/
@Value("${spring.application.name:spring-boot-application}") @Value("${spring.application.name:spring-boot-application}")
private String name; private String name;
...@@ -90,11 +107,6 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve ...@@ -90,11 +107,6 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve
return false; return false;
} }
/**
* @return Client-management-URL to register with. Can be overriden in case the
* reachable URL is different (e.g. Docker). Must be unique in registry.
*/
public String getManagementUrl() { public String getManagementUrl() {
if (managementUrl == null) { if (managementUrl == null) {
if (managementPort != -1) { if (managementPort != -1) {
...@@ -113,11 +125,6 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve ...@@ -113,11 +125,6 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve
this.managementUrl = managementUrl; this.managementUrl = managementUrl;
} }
/**
* @return Client-health-URL to register with. Can be overriden in case the reachable
* URL is different (e.g. Docker). Must be unique in registry.
*/
public String getHealthUrl() { public String getHealthUrl() {
if (healthUrl == null) { if (healthUrl == null) {
return append(getManagementUrl(), healthEndpointId); return append(getManagementUrl(), healthEndpointId);
...@@ -129,10 +136,6 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve ...@@ -129,10 +136,6 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve
this.healthUrl = healthUrl; this.healthUrl = healthUrl;
} }
/**
* @return Client-service-URL to register with. Can be overriden in case the reachable
* URL is different (e.g. Docker). Must be unique in registry.
*/
public String getServiceUrl() { public String getServiceUrl() {
if (serviceUrl == null) { if (serviceUrl == null) {
if (serverPort != -1){ if (serverPort != -1){
...@@ -154,9 +157,6 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve ...@@ -154,9 +157,6 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve
return serverInitialized; return serverInitialized;
} }
/**
* @return Name to register with.
*/
public String getName() { public String getName() {
return name; return name;
} }
...@@ -176,7 +176,7 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve ...@@ -176,7 +176,7 @@ public class AdminClientProperties implements ApplicationListener<ApplicationEve
private String createLocalUri(int port, String path) { private String createLocalUri(int port, String path) {
String scheme = server.getSsl() != null && server.getSsl().isEnabled() ? "https" : "http"; String scheme = server.getSsl() != null && server.getSsl().isEnabled() ? "https" : "http";
return append(scheme + "://" + getHostname() + ":" + port + "/", path); return append(scheme + "://" + getHostname() + ":" + port + "/", path);
} }
private String append(String uri, String path) { private String append(String uri, String path) {
......
...@@ -20,32 +20,43 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -20,32 +20,43 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.boot.admin") @ConfigurationProperties(prefix = "spring.boot.admin")
public class AdminProperties { public class AdminProperties {
/**
* The admin servers url to register at
*/
private String url; private String url;
/**
* The admin servers context path.
*/
private String contextPath = "api/applications"; private String contextPath = "api/applications";
/**
* Time interval (in ms) the registration is repeated
*/
private int period = 10000; private int period = 10000;
/**
* Username for basic authentication on admin server
*/
private String username; private String username;
/**
* Password for basic authentication on admin server
*/
private String password; private String password;
/**
* Enable automatic deregistration on shutdown
*/
private boolean autoDeregistration; private boolean autoDeregistration;
public void setUrl(String url) { public void setUrl(String url) {
this.url = url; this.url = url;
} }
/**
* @return the Spring Boot Admin Server's url.
*/
public String getUrl() { public String getUrl() {
return url; return url;
} }
/**
* @return the Spring Boot Admin Server's context path.
*/
public String getContextPath() { public String getContextPath() {
return contextPath; return contextPath;
} }
...@@ -54,9 +65,6 @@ public class AdminProperties { ...@@ -54,9 +65,6 @@ public class AdminProperties {
this.contextPath = contextPath; this.contextPath = contextPath;
} }
/**
* @return the time interval (in ms) the registration is repeated.
*/
public int getPeriod() { public int getPeriod() {
return period; return period;
} }
...@@ -69,9 +77,6 @@ public class AdminProperties { ...@@ -69,9 +77,6 @@ public class AdminProperties {
this.username = username; this.username = username;
} }
/**
* @return username for basic authentication .
*/
public String getUsername() { public String getUsername() {
return username; return username;
} }
...@@ -80,16 +85,10 @@ public class AdminProperties { ...@@ -80,16 +85,10 @@ public class AdminProperties {
this.password = password; this.password = password;
} }
/**
* @return password for basic authentication.
*/
public String getPassword() { public String getPassword() {
return password; return password;
} }
/**
* @return wether the application deregisters automatically on shutdown.
*/
public boolean isAutoDeregistration() { public boolean isAutoDeregistration() {
return autoDeregistration; return autoDeregistration;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment