net.sf.seaf.factory.impl
Class SpringFactory

java.lang.Object
  extended by net.sf.seaf.factory.impl.SpringFactory
All Implemented Interfaces:
Factory

public class SpringFactory
extends Object
implements Factory

Gets instances from a Spring ListableBeanFactory.

A bean is retrieved from the Spring bean factory when there is exactly one instance defined for the requested type.


Constructor Summary
SpringFactory(org.springframework.beans.factory.ListableBeanFactory springFactory)
          Initialize the SpringFactory with an instance of Spring ListableBeanFactory.
 
Method Summary
<Type> Type
getInstanceOf(Class<Type> type)
          Return a bean of the specified type from Spring bean factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringFactory

public SpringFactory(org.springframework.beans.factory.ListableBeanFactory springFactory)
Initialize the SpringFactory with an instance of Spring ListableBeanFactory.

Parameters:
springFactory -
Method Detail

getInstanceOf

public <Type> Type getInstanceOf(Class<Type> type)
                   throws SeafRuntimeException
Return a bean of the specified type from Spring bean factory.

Specified by:
getInstanceOf in interface Factory
Parameters:
type - The type of the requested bean
Returns:
The bean instance
Throws:
SeafTypeResolvingException - Thrown when there are multiple instances or no instance of the requested type defined
SeafRuntimeException - Thrown when the instance cannot be retrieved


Copyright © 2008-2012 SEAF. All Rights Reserved.