Class LazyBean<T>


  • public final class LazyBean<T>
    extends Object
    Avoids calling the expensive BeanFactory.getBean(Class) many times or throwing an exception.

    Note: This is an internal class to sleuth and must not be used by external code.

    • Method Detail

      • create

        public static <T> LazyBean<T> create​(org.springframework.context.ConfigurableApplicationContext springContext,
                                             Class<T> requiredType)
      • get

        @Nullable
        public T get()
        Attempts to provision from the underlying bean factory, if not already provisioned.
        Returns:
        the bean value or null if there was an exception getting it.
      • getOrError

        public T getOrError()
        Attempts to provision from the underlying bean factory, if not already provisioned.
        Returns:
        the bean value. This variant does not catch exception.