| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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.
Method Summary | |
Object | getObject() Return an instance (possibly shared or independent) of the object managed by this factory. |
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? That is, will getObject() always return the same object? The singleton status of the FactoryBean itself will generally be provided by the owning BeanFactory. |
Method Detail |
public Object getObject()
throws java.lang.Exception
public 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.
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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |