diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/livebean/LiveBeansModel.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/livebean/LiveBeansModel.java index 3f6d397d9..0f70a916d 100644 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/livebean/LiveBeansModel.java +++ b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/livebean/LiveBeansModel.java @@ -117,26 +117,22 @@ public class LiveBeansModel { public LiveBeansModel parse(String json) throws Exception { Builder model = LiveBeansModel.builder(); JSONObject mainObject = new JSONObject(json); - JSONObject beansObject = getBeans(mainObject); - for (String id : beansObject.keySet()) { - JSONObject beanObject = beansObject.getJSONObject(id); - LiveBean bean = parseBean(id, beanObject); - if (bean!=null) { - model.add(bean); + mainObject = mainObject.getJSONObject("contexts"); + for (String contextId : mainObject.keySet()) { + JSONObject contextObject = mainObject.getJSONObject(contextId); + JSONObject beansObject = contextObject.getJSONObject("beans"); + for (String id : beansObject.keySet()) { + JSONObject beanObject = beansObject.getJSONObject(id); + LiveBean bean = parseBean(id, contextId, beanObject); + if (bean!=null) { + model.add(bean); + } } } 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) { + private LiveBean parseBean(String id, String contextId, JSONObject beansJSON) { String type = beansJSON.optString("type"); String scope = beansJSON.optString("scope"); String resource = beansJSON.optString("resource");