Class LiveBeansView

  • java.lang.Object
    • Field Detail


        public static final java.lang.String MBEAN_DOMAIN_PROPERTY_NAME
        The "MBean Domain" property name.
        See Also:
        Constant Field Values

        public static final java.lang.String MBEAN_APPLICATION_KEY
        The MBean application key.
        See Also:
        Constant Field Values
    • Constructor Detail

      • LiveBeansView

        public LiveBeansView()
    • Method Detail

      • findApplicationContexts

        protected java.util.Set<ConfigurableApplicationContext> findApplicationContexts()
        Find all applicable ApplicationContexts for the current application.

        Called if no specific ApplicationContext has been set for this LiveBeansView.

        the set of ApplicationContexts
      • generateJson

        protected java.lang.String generateJson(java.util.Set<ConfigurableApplicationContext> contexts)
        Actually generate a JSON snapshot of the beans in the given ApplicationContexts.

        This implementation doesn't use any JSON parsing libraries in order to avoid third-party library dependencies. It produces an array of context description objects, each containing a context and parent attribute as well as a beans attribute with nested bean description objects. Each bean object contains a bean, scope, type and resource attribute, as well as a dependencies attribute with a nested array of bean names that the present bean depends on.

        contexts - the set of ApplicationContexts
        the JSON document
      • isBeanEligible

        protected boolean isBeanEligible(java.lang.String beanName,
                                         BeanDefinition bd,
                                         ConfigurableBeanFactory bf)
        Determine whether the specified bean is eligible for inclusion in the LiveBeansView JSON snapshot.
        beanName - the name of the bean
        bd - the corresponding bean definition
        bf - the containing bean factory
        true if the bean is to be included; false otherwise
      • getEscapedResourceDescription

        protected java.lang.String getEscapedResourceDescription(BeanDefinition bd)
        Determine a resource description for the given bean definition and apply basic JSON escaping (backslashes, double quotes) to it.
        bd - the bean definition to build the resource description for
        the JSON-escaped resource description