Fix problems caused by changes in actuator endpoints for boot 2.0... AGAIN
This commit is contained in:
@@ -242,13 +242,15 @@ public class SpringBootApp {
|
||||
}
|
||||
|
||||
public String getAutoConfigReport() throws Exception {
|
||||
//Boot 1.x
|
||||
Object result = getActuatorDataFromAttribute("org.springframework.boot:type=Endpoint,name=autoConfigurationReportEndpoint", "Data");
|
||||
if (result != null) {
|
||||
String report = new ObjectMapper().writeValueAsString(result);
|
||||
return report;
|
||||
}
|
||||
|
||||
result = getActuatorDataFromOperation("org.springframework.boot:type=Endpoint,name=Conditions", "getEvaluationReport");
|
||||
//Boot 2.x
|
||||
result = getActuatorDataFromOperation("org.springframework.boot:type=Endpoint,name=Conditions", "applicationConditionEvaluation");
|
||||
if (result != null) {
|
||||
String report = new ObjectMapper().writeValueAsString(result);
|
||||
return report;
|
||||
|
||||
@@ -117,7 +117,7 @@ public class LiveBeansModel {
|
||||
public LiveBeansModel parse(String json) throws Exception {
|
||||
Builder model = LiveBeansModel.builder();
|
||||
JSONObject mainObject = new JSONObject(json);
|
||||
JSONObject beansObject = mainObject.getJSONObject("beans");
|
||||
JSONObject beansObject = getBeans(mainObject);
|
||||
for (String id : beansObject.keySet()) {
|
||||
JSONObject beanObject = beansObject.getJSONObject(id);
|
||||
LiveBean bean = parseBean(id, beanObject);
|
||||
@@ -128,6 +128,14 @@ public class LiveBeansModel {
|
||||
return model.build();
|
||||
}
|
||||
|
||||
private JSONObject getBeans(JSONObject mainObject) {
|
||||
JSONObject beans = mainObject.optJSONObject("beans");
|
||||
if (beans==null) {
|
||||
beans = mainObject.getJSONObject("contexts").getJSONObject("application").getJSONObject("beans");
|
||||
}
|
||||
return beans;
|
||||
}
|
||||
|
||||
private LiveBean parseBean(String id, JSONObject beansJSON) {
|
||||
String type = beansJSON.optString("type");
|
||||
String scope = beansJSON.optString("scope");
|
||||
|
||||
Reference in New Issue
Block a user