Package org.trustdeck.utils
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TMethod to get a bean from the spring bean registry.final voidsetApplicationContext(org.springframework.context.ApplicationContext appContext) This will automatically be called by spring.
-
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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
getBean
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.
-