Commit 97898e05 by Dennis Schulte

Merge pull request #15 from joshiste/mgmt-ctx-path

Register application with correct spring-boot management path
parents d10b5bf3 56cb7948
...@@ -69,13 +69,16 @@ public class SpringBootAdminRegistratorTask implements Runnable { ...@@ -69,13 +69,16 @@ public class SpringBootAdminRegistratorTask implements Runnable {
} }
} }
// register the application with the used URL and port // register the application with the used URL and port
String url = new URL("http", InetAddress.getLocalHost().getCanonicalHostName(), port, "").toString(); String managementPath = env.getProperty("management.context-path", "");
String url = new URL("http", InetAddress.getLocalHost().getCanonicalHostName(), port, managementPath)
.toString();
Application app = new Application(); Application app = new Application();
app.setId(id); app.setId(id);
app.setUrl(url); app.setUrl(url);
template.postForObject(adminUrl + "/api/applications", app, String.class); template.postForObject(adminUrl + "/api/applications", app, String.class);
LOGGER.info("Application registered itself at the admin application with ID '{}' and URL '{}'", id, url); LOGGER.info("Application registered itself at the admin application with ID '{}' and URL '{}'", id, url);
} catch (Exception e) { }
catch (Exception e) {
LOGGER.warn("Failed to register application at spring-boot-admin, message={}", e.getMessage()); LOGGER.warn("Failed to register application at spring-boot-admin, message={}", e.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