All Known Implementing Classes:
JndiObjectFactoryBean, MethodInvokingTimerTaskFactoryBean, HessianProxyFactoryBean, ScheduledExecutorFactoryBean, PropertiesFactoryBean, SharedEntityManagerBean, JotmFactoryBean, HttpInvokerProxyFactoryBean, JaxWsPortProxyFactoryBean, ObjectFactoryCreatingFactoryBean, SimpleHttpServerFactoryBean, LocalStatelessSessionProxyFactoryBean, ProxyFactoryBean, AbstractEntityManagerFactoryBean, CommonsLogFactoryBean, LocalPersistenceManagerFactoryBean, EhCacheManagerFactoryBean, WebSphereTransactionManagerFactoryBean, JmsInvokerProxyFactoryBean, FieldRetrievingFactoryBean, LocalSessionFactoryBean, TransactionAwarePersistenceManagerFactoryProxy, LocalSessionFactoryBean, ConnectorServerFactoryBean, LocalContainerEntityManagerFactoryBean, TransactionAwareSessionAdapter, MapFactoryBean, AbstractSessionFactoryBean, WebLogicServerTransactionManagerFactoryBean, SetFactoryBean, ServiceFactoryBean, ScheduledExecutorFactoryBean, WebSphereMBeanServerFactoryBean, ServletContextAttributeFactoryBean, LocalJaxWsServiceFactoryBean, SqlMapClientFactoryBean, AbstractFactoryBean, FreeMarkerConfigurationFactoryBean, ServletContextParameterFactoryBean, WebLogicJndiMBeanServerFactoryBean, JndiRmiProxyFactoryBean, EhCacheFactoryBean, ResourceFactoryBean, SmartFactoryBean, SchedulerFactoryBean, BeanReferenceFactoryBean, MBeanServerFactoryBean, ResourceMapFactoryBean, MethodInvokingFactoryBean, AnnotationSessionFactoryBean, ResourceAdapterFactoryBean, FilterDefinitionFactoryBean, SqlMapFactoryBean, RmiRegistryFactoryBean, ListFactoryBean, MBeanProxyFactoryBean, TransactionProxyFactoryBean, SimpleRemoteStatelessSessionProxyFactoryBean, AbstractServiceLoaderBasedFactoryBean, LocalEntityManagerFactoryBean, RmiProxyFactoryBean, ServiceListFactoryBean, ServiceLocatorFactoryBean, MBeanServerConnectionFactoryBean, MethodInvokingJobDetailFactoryBean, BurlapProxyFactoryBean, LocalJaxRpcServiceFactoryBean, AbstractSingletonProxyFactoryBean, ServiceLoaderFactoryBean, WebLogicMBeanServerFactoryBean, LocalSessionFactoryBean, LocalConnectionFactoryBean, MethodLocatingFactoryBean, ServletContextFactoryBean, PropertyPathFactoryBean, TimerManagerFactoryBean, VelocityEngineFactoryBean, TimerFactoryBean, ScopedProxyFactoryBean, JaxRpcPortProxyFactoryBean
NB: A bean that implements this interface cannot be used as a normal bean. A FactoryBean is defined in a bean style, but the object exposed for bean references (#getObject() is always the object that it creates.
FactoryBeans can support singletons and prototypes, and can either create objects lazily on demand or eagerly on startup. The SmartFactoryBean interface allows for exposing more fine-grained behavioral metadata.
This interface is heavily used within the framework itself, for example for the AOP org.springframework.aop.framework.ProxyFactoryBean or the org.springframework.jndi.JndiObjectFactoryBean . It can be used for application components as well; however, this is not common outside of infrastructure code.
NOTE: FactoryBean objects participate in the containing BeanFactory's synchronization of bean creation. There is usually no need for internal synchronization other than for purposes of lazy initialization within the FactoryBean itself (or the like).
Rod - JohnsonJuergen - Hoeller08.03.2003 - | Method from org.springframework.beans.factory.FactoryBean Summary: |
|---|
| getObject, getObjectType, isSingleton |
| Method from org.springframework.beans.factory.FactoryBean Detail: |
|---|
As with a BeanFactory , this allows support for both the Singleton and Prototype design pattern. If this FactoryBean is not fully initialized yet at the time of the call (for example because it is involved in a circular reference), throw a corresponding FactoryBeanNotInitializedException . As of Spring 2.0, FactoryBeans are allowed to return |
null if not known in advance.
This allows one to check for specific types of beans without instantiating objects, for example on autowiring. In the case of implementations that are creating a singleton object, this method should try to avoid singleton creation as far as possible; it should rather estimate the type in advance. For prototypes, returning a meaningful type here is advisable too. This method can be called before this FactoryBean has been fully initialized. It must not rely on state created during initialization; of course, it can still use such state if available. NOTE: Autowiring will simply ignore FactoryBeans that return
|
NOTE: If a FactoryBean indicates to hold a singleton object,
the object returned from The singleton status of the FactoryBean itself will generally be provided by the owning BeanFactory; usually, it has to be defined as singleton there. NOTE: This method returning |