public class SpringBeanFinder extends SpringFinder implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.ApplicationContextAware
SpringFinder
which uses Spring's BeanFactory
mechanism to load a prototype bean by name.
If both a BeanFactory
and a ApplicationContext
are provided,
the bean will be looked up first in the application context and then in the
bean factory.
Concurrency note: instances of this class or its subclasses can be invoked by
several threads at the same time and therefore must be thread-safe. You
should be especially careful when storing state in member variables.Constructor and Description |
---|
SpringBeanFinder()
Default constructor.
|
SpringBeanFinder(Router router,
org.springframework.beans.factory.BeanFactory beanFactory,
java.lang.String beanName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ServerResource |
create()
Creates a new instance of the
ServerResource class designated by
the "targetClass" property. |
org.springframework.context.ApplicationContext |
getApplicationContext()
Returns the parent application context.
|
org.springframework.beans.factory.BeanFactory |
getBeanFactory()
Returns the parent bean factory.
|
java.lang.String |
getBeanName()
Returns the bean name.
|
Context |
getContext() |
Router |
getRouter()
Returns the associated router.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Sets the parent application context
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Sets the parent bean factory.
|
void |
setBeanName(java.lang.String beanName)
Sets the bean name.
|
void |
setRouter(Router router)
Sets the associated router.
|
create, create
createFinder, find, getTargetClass, handle, setTargetClass, toString
createFinder, finalize, getApplication, getAuthor, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner, start, stop
public SpringBeanFinder()
public SpringBeanFinder(Router router, org.springframework.beans.factory.BeanFactory beanFactory, java.lang.String beanName)
router
- The associated router used to retrieve the context.beanFactory
- The Spring bean factory.beanName
- The bean name.public ServerResource create()
SpringFinder
ServerResource
class designated by
the "targetClass" property. This method is intended to be configured as a
lookup method in Spring.create
in class SpringFinder
public org.springframework.context.ApplicationContext getApplicationContext()
public org.springframework.beans.factory.BeanFactory getBeanFactory()
public java.lang.String getBeanName()
public Context getContext()
getContext
in class Restlet
public Router getRouter()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
applicationContext
- The parent context.public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
beanFactory
- The parent bean factory.public void setBeanName(java.lang.String beanName)
beanName
- The bean name.public void setRouter(Router router)
router
- The associated router.Copyright © 2005-2020 Restlet.