org.mule.config.spring.util
Class SpringBeanLookup
java.lang.Object
org.mule.object.AbstractObjectFactory
org.mule.config.spring.util.SpringBeanLookup
- All Implemented Interfaces:
- Disposable, Initialisable, ObjectFactory, org.springframework.context.ApplicationContextAware
public class SpringBeanLookup
- extends AbstractObjectFactory
- implements org.springframework.context.ApplicationContextAware
This is an implementation of the ObjectFactory interface which simply delegates to
the Spring ApplicationContext. Since the delegation happens each time a call to
getOrCreate() is made, this will correctly handle Spring beans which are
non-singletons (factory beans, etc.)
Singleton usage:
Non-singleton usage:
Method Summary |
void |
dispose()
A lifecycle method where implementor should free up any resources. |
String |
getBean()
|
Object |
getInstance()
Creates an initialized object instance based on the class and sets any properties. |
Class |
getObjectClass()
Returns the class of the object to be instantiated without actually creating
an instance. |
void |
initialise()
Method used to perform any initialisation work. |
boolean |
isSingleton()
Returns true if the ObjectFactory implementation always returns the same object
instance. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
|
void |
setBean(String bean)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SpringBeanLookup
public SpringBeanLookup()
initialise
public void initialise()
throws InitialisationException
- Description copied from interface:
Initialisable
- Method used to perform any initialisation work. If a fatal error occurs during
initialisation an
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.
- Specified by:
initialise
in interface Initialisable
- Overrides:
initialise
in class AbstractObjectFactory
- Throws:
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdown
RecoverableException
- if an error occurs that can be recovered from
dispose
public void dispose()
- Description copied from interface:
Disposable
- A lifecycle method where implementor should free up any resources. If an
exception is thrown it should just be logged and processing should continue.
This method should not throw Runtime exceptions.
- Specified by:
dispose
in interface Disposable
- Overrides:
dispose
in class AbstractObjectFactory
getObjectClass
public Class getObjectClass()
- Description copied from interface:
ObjectFactory
- Returns the class of the object to be instantiated without actually creating
an instance. This may not be logical or even possible depending on the
implementation.
- Specified by:
getObjectClass
in interface ObjectFactory
- Overrides:
getObjectClass
in class AbstractObjectFactory
getInstance
public Object getInstance()
throws Exception
- Description copied from class:
AbstractObjectFactory
- Creates an initialized object instance based on the class and sets any properties.
- Specified by:
getInstance
in interface ObjectFactory
- Overrides:
getInstance
in class AbstractObjectFactory
- Throws:
Exception
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
getBean
public String getBean()
setBean
public void setBean(String bean)
isSingleton
public boolean isSingleton()
- Description copied from interface:
ObjectFactory
- Returns true if the ObjectFactory implementation always returns the same object
instance.
- Specified by:
isSingleton
in interface ObjectFactory
- Overrides:
isSingleton
in class AbstractObjectFactory
- Returns:
Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.