Class LazyBean<T>

java.lang.Object
org.springframework.cloud.sleuth.internal.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 Summary

    Modifier and Type
    Method
    Description
    static <T> LazyBean<T>
    create(org.springframework.context.ConfigurableApplicationContext springContext, Class<T> requiredType)
     
    get()
    Attempts to provision from the underlying bean factory, if not already provisioned.
    Attempts to provision from the underlying bean factory, if not already provisioned.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • 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.