Class BeanInitializationTimeMonitor

  • All Implemented Interfaces:
    org.springframework.beans.factory.config.BeanFactoryPostProcessor

    public class BeanInitializationTimeMonitor
    extends Object
    implements org.springframework.beans.factory.config.BeanFactoryPostProcessor
    Hook into the bean post-processing lifecycle and record bean initialization time.
    Author:
    poirigui
    • Constructor Detail

      • BeanInitializationTimeMonitor

        public BeanInitializationTimeMonitor()
    • Method Detail

      • getInstantiationTime

        public long getInstantiationTime​(String beanName,
                                         TimeUnit timeUnit)
        Obtain the time spent instantiating a bean.
      • getInitializationTime

        public long getInitializationTime​(String beanName,
                                          TimeUnit timeUnit)
        Obtain the time spent initializing a bean.
      • getTotalTime

        public Long getTotalTime​(String beanName,
                                 TimeUnit timeUnit)
        Obtain the total time spent instantiating and initializing a bean.
      • getTotalTime

        public long getTotalTime​(TimeUnit timeUnit)
        Obtain the total time spent instantiating and initializing beans.
      • reset

        public void reset()
        Reset recorded times.
      • postProcessBeanFactory

        public void postProcessBeanFactory​(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
                                    throws org.springframework.beans.BeansException
        Specified by:
        postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
        Throws:
        org.springframework.beans.BeansException