org.springframework.beans.factory
Interface ObjectFactory


public interface ObjectFactory

Interface defining a factory which can return an Object instance (possibly shared or independent) when invoked.

This interface is typically used to encapsulate a generic factory which returns a new instance (prototype) on each invocation. It is similar to FactoryBean, but implementations of the latter interface are normally meant to be defined as instances by the user in a BeanFactory, while implementations of this class are normally meant to be fed as a property to other beans. As such, the getObject method has different exception handling behavior.

Since:
2004-5-11
Author:
Colin Sampaleanu
See Also:
FactoryBean

Method Summary
 Object getObject()
          Return an instance (possibly shared or independent) of the object managed by this factory.
 

Method Detail

getObject

public Object getObject()
                 throws BeansException
Return an instance (possibly shared or independent) of the object managed by this factory.

Returns:
an instance of the bean (should never be null)
Throws:
BeansException - in case of creation errors


Copyright (C) 2003-2004 The Spring Framework Project.