|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface to be implemented by objects used within a BeanFactory that are themselves factories. If a bean implements this interface, it is used as a factory, not directly as a bean.
NB: A bean that implements this interface cannot be used as a normal bean.
FactoryBeans can support singletons and prototypes.
BeanFactory
Method Summary | |
java.lang.Object |
getObject()
Return an instance (possibly shared or independent) of the object managed by this factory. |
java.lang.Class |
getObjectType()
Return the type of object that this FactoryBean creates, or null if not known in advance. |
boolean |
isSingleton()
Is the bean managed by this factory a singleton or a prototype? |
Method Detail |
public java.lang.Object getObject() throws java.lang.Exception
java.lang.Exception
- in case of creation errorspublic java.lang.Class getObjectType()
For a singleton, this can simply return getObject().getClass(), or even null, as autowiring will always check the actual objects for singletons. For prototypes, returning a meaningful type here is highly advisable, as autowiring will simply ignore them else.
ListableBeanFactory.getBeansOfType(java.lang.Class, boolean, boolean)
public boolean isSingleton()
The singleton status of the FactoryBean itself will generally be provided by the owning BeanFactory.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |