Class SpringBeanLocator

java.lang.Object
org.trustdeck.utils.SpringBeanLocator
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Component public class SpringBeanLocator extends Object implements org.springframework.context.ApplicationContextAware
This class offers a way to access spring beans that are otherwise unaccessible.
Author:
Armin Müller
  • Constructor Details

    • SpringBeanLocator

      public SpringBeanLocator()
  • Method Details

    • setApplicationContext

      public final void setApplicationContext(org.springframework.context.ApplicationContext appContext)
      This will automatically be called by spring.
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
    • getBean

      public static <T> T getBean(Class<T> type)
      Method to get a bean from the spring bean registry.
      Type Parameters:
      T - the type parameter
      Parameters:
      type - the class for which the bean should be retrieved.
      Returns:
      the bean for the provided class.