org.springframework.beans.factory.SmartFactoryBean<T> |
Known Indirect Subclasses |
Extension of the FactoryBean
interface. Implementations may
indicate whether they always return independent instances, for the
case where their isSingleton()
implementation returning
false
does not clearly indicate independent instances.
Plain FactoryBean
implementations which do not implement
this extended interface are simply assumed to always return independent
instances if their isSingleton()
implementation returns
false
; the exposed object is only accessed on demand.
NOTE: This interface is a special purpose interface, mainly for
internal use within the framework and within collaborating frameworks.
In general, application-provided FactoryBeans should simply implement
the plain FactoryBean
interface. New methods might be added
to this extended interface even in point releases.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Does this FactoryBean expect eager initialization, that is,
eagerly initialize itself as well as expect eager initialization
of its singleton object (if any)?
A standard FactoryBean is not expected to initialize eagerly:
Its | |||||||||||
Is the object managed by this factory a prototype? That is,
will
getObject() always return an independent instance?
The prototype status of the FactoryBean itself will generally
be provided by the owning |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.beans.factory.FactoryBean
|
Does this FactoryBean expect eager initialization, that is, eagerly initialize itself as well as expect eager initialization of its singleton object (if any)?
A standard FactoryBean is not expected to initialize eagerly:
Its getObject()
will only be called for actual access, even
in case of a singleton object. Returning true
from this
method suggests that getObject()
should be called eagerly,
also applying post-processors eagerly. This may make sense in case
of a singleton
object, in particular if
post-processors expect to be applied on startup.
Is the object managed by this factory a prototype? That is,
will getObject()
always return an independent instance?
The prototype status of the FactoryBean itself will generally
be provided by the owning BeanFactory
; usually, it has to be
defined as singleton there.
This method is supposed to strictly check for independent instances;
it should not return true
for scoped objects or other
kinds of non-singleton, non-independent objects. For this reason,
this is not simply the inverted form of isSingleton()
.