Package com.epam.ta.reportportal
Class ApplicationContextAwareFactoryBean<T>
- java.lang.Object
-
- com.epam.ta.reportportal.ApplicationContextAwareFactoryBean<T>
-
- Type Parameters:
T- - type of bean
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.FactoryBean<T>,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
public abstract class ApplicationContextAwareFactoryBean<T> extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<T>, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBeanFactoryBeanwith access toApplicationContextwith lazy initialization
-
-
Constructor Summary
Constructors Constructor Description ApplicationContextAwareFactoryBean()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()Instantiates supplier for bean to be created.protected abstract TcreateInstance()Template method that subclasses must override to construct the object returned by this factory.protected org.springframework.context.ApplicationContextgetApplicationContext()TgetObject()booleanisSingleton()voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)voidsetSingleton(boolean singleton)
-
-
-
Method Detail
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
getObject
public T getObject() throws java.lang.Exception
- Specified by:
getObjectin interfaceorg.springframework.beans.factory.FactoryBean<T>- Throws:
java.lang.Exception
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingletonin interfaceorg.springframework.beans.factory.FactoryBean<T>
-
setSingleton
public void setSingleton(boolean singleton)
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.ExceptionInstantiates supplier for bean to be created. This mades possible lazy-initialization- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
getApplicationContext
protected org.springframework.context.ApplicationContext getApplicationContext()
-
createInstance
protected abstract T createInstance()
Template method that subclasses must override to construct the object returned by this factory.Invoked on initialization of this FactoryBean in case of a singleton; else, on each
getObject()call.- Returns:
- the object returned by this factory
- See Also:
getObject()
-
-