Class ApplicationBeans

java.lang.Object
de.hybris.platform.integrationservices.util.ApplicationBeans

public final class ApplicationBeans extends Object
A utility for retrieving Spring beans defined in the application context.
  • Method Details

    • getBean

      public static <T> T getBean(String id, Class<T> type)
      Retrieves a bean defined in the application context
      Type Parameters:
      T - expected type of Spring bean in the application context
      Parameters:
      id - ID or name of the Spring in the application context
      type - expected type of Spring bean in the application context
      Returns:
      bean instance defined in the Spring application context.
      Throws:
      org.springframework.beans.factory.NoSuchBeanDefinitionException - if the bean of the specified type and ID does not exist.
    • getFreshBean

      public static <T> T getFreshBean(String id, Class<T> type)
      Retrieves a session bean defined in the application context. If retrieved bean is not the expected type and an exception is thrown, destroys scoped bean and tries to regenerate and retrieve it again.
      Type Parameters:
      T - expected type of Spring bean in the application context
      Parameters:
      id - ID or name of the Spring bean in the application context
      type - expected type of Spring bean in the application context
      Returns:
      bean instance defined in the Spring application context.