|
|
|
@ -175,8 +175,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar |
|
|
|
else { |
|
|
|
else { |
|
|
|
result.append("\"type\": null,\n"); |
|
|
|
result.append("\"type\": null,\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
String resource = StringUtils.replace(bd.getResourceDescription(), "\\", "/"); |
|
|
|
result.append("\"resource\": \"").append(getEscapedResourceDescription(bd)).append("\",\n"); |
|
|
|
result.append("\"resource\": \"").append(resource).append("\",\n"); |
|
|
|
|
|
|
|
result.append("\"dependencies\": ["); |
|
|
|
result.append("\"dependencies\": ["); |
|
|
|
String[] dependencies = bf.getDependenciesForBean(beanName); |
|
|
|
String[] dependencies = bf.getDependenciesForBean(beanName); |
|
|
|
if (dependencies.length > 0) { |
|
|
|
if (dependencies.length > 0) { |
|
|
|
@ -201,7 +200,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Determine whether the specified bean is eligible for inclusion in the |
|
|
|
* Determine whether the specified bean is eligible for inclusion in the |
|
|
|
* LiveBeansView JSON snapshot. |
|
|
|
* LiveBeansView JSON snapshot. |
|
|
|
* @param beanName the name of the bean |
|
|
|
* @param beanName the name of the bean |
|
|
|
* @param bd the corresponding bean definition |
|
|
|
* @param bd the corresponding bean definition |
|
|
|
@ -213,4 +212,31 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar |
|
|
|
(!bd.isLazyInit() || bf.containsSingleton(beanName))); |
|
|
|
(!bd.isLazyInit() || bf.containsSingleton(beanName))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Determine a resource description for the given bean definition and |
|
|
|
|
|
|
|
* apply basic JSON escaping (backslashes, double quotes) to it. |
|
|
|
|
|
|
|
* @param bd the bean definition to build the resource description for |
|
|
|
|
|
|
|
* @return the JSON-escaped resource description |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected String getEscapedResourceDescription(BeanDefinition bd) { |
|
|
|
|
|
|
|
String resourceDescription = bd.getResourceDescription(); |
|
|
|
|
|
|
|
if (resourceDescription == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
StringBuilder result = new StringBuilder(resourceDescription.length() + 16); |
|
|
|
|
|
|
|
for (int i = 0; i < resourceDescription.length(); i++) { |
|
|
|
|
|
|
|
char character = resourceDescription.charAt(i); |
|
|
|
|
|
|
|
if (character == '\\') { |
|
|
|
|
|
|
|
result.append('/'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (character == '"') { |
|
|
|
|
|
|
|
result.append("\\").append('"'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
result.append(character); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|