Commit c973e3af by Johannes Edmeier

Rename spring.boot.admin.context-path to spring.boot.admin.api-path on client-side.

parent bbd51513
......@@ -187,8 +187,8 @@ The Spring Boot Admin Client registers the application at the admin server. This
| URL of the spring-boot-admin application to register at. This triggers the AutoConfiguration. *Mandatory*.
|
| spring.boot.admin.context-path
| Context-path of registration endpoint at your admin server.
| spring.boot.admin.api-path
| Http-path of registration endpoint at your admin server.
| `"api/applications"`
| spring.boot.admin.username
......
......@@ -26,9 +26,9 @@ public class AdminProperties {
private String url;
/**
* The admin servers context path.
* The admin rest-apis path.
*/
private String contextPath = "api/applications";
private String apiPath = "api/applications";
/**
* Time interval (in ms) the registration is repeated
......@@ -58,12 +58,16 @@ public class AdminProperties {
return url;
}
public String getContextPath() {
return contextPath;
public void setApiPath(String apiPath) {
this.apiPath = apiPath;
}
public void setContextPath(String contextPath) {
this.contextPath = contextPath;
public String getApiPath() {
return apiPath;
}
public String getAdminUrl() {
return url + "/" + apiPath;
}
public int getPeriod() {
......
......@@ -70,12 +70,11 @@ public class ApplicationRegistrator {
*/
public boolean register() {
Application self = null;
String adminUrl = admin.getUrl() + '/' + admin.getContextPath();
try {
self = createApplication();
@SuppressWarnings("rawtypes")
ResponseEntity<Map> response = template.postForEntity(adminUrl,
ResponseEntity<Map> response = template.postForEntity(admin.getAdminUrl(),
new HttpEntity<Application>(self, HTTP_HEADERS), Map.class);
if (response.getStatusCode().equals(HttpStatus.CREATED)) {
......@@ -94,7 +93,7 @@ public class ApplicationRegistrator {
}
} catch (Exception ex) {
LOGGER.warn("Failed to register application as {} at spring-boot-admin ({}): {}", self,
adminUrl, ex.getMessage());
admin.getAdminUrl(), ex.getMessage());
}
return false;
......@@ -103,15 +102,13 @@ public class ApplicationRegistrator {
public void deregister() {
String id = registeredId.get();
if (id != null) {
String adminUrl = admin.getUrl() + '/' + admin.getContextPath() + "/" + id;
try {
template.delete(adminUrl);
template.delete(admin.getAdminUrl() + "/" + id);
registeredId.set(null);
} catch (Exception ex) {
LOGGER.warn(
"Failed to deregister application (id={}) at spring-boot-admin ({}): {}",
id, adminUrl, ex.getMessage());
id, admin.getAdminUrl(), ex.getMessage());
}
}
}
......
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