public class MethodInvokingRunnable extends ArgumentConvertingMethodInvoker implements Runnable, BeanClassLoaderAware, InitializingBean
Runnable
interface as a configurable
method invocation based on Spring's MethodInvoker.
Inherits common configuration properties from
MethodInvoker
.
ScheduledTimerTask.setRunnable(Runnable)
,
Executor.execute(Runnable)
Constructor and Description |
---|
MethodInvokingRunnable() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
protected String |
getInvocationFailureMessage()
Build a message for an invocation failure exception.
|
protected Class |
resolveClassName(String className)
Resolve the given class name into a Class.
|
void |
run() |
void |
setBeanClassLoader(ClassLoader classLoader)
Callback that supplies the bean
class loader to
a bean instance. |
doFindMatchingMethod, findMatchingMethod, getDefaultTypeConverter, getTypeConverter, registerCustomEditor, setTypeConverter
getArguments, getPreparedMethod, getTargetClass, getTargetMethod, getTargetObject, getTypeDifferenceWeight, invoke, isPrepared, prepare, setArguments, setStaticMethod, setTargetClass, setTargetMethod, setTargetObject
protected final Log logger
public void setBeanClassLoader(ClassLoader classLoader)
BeanClassLoaderAware
class loader
to
a bean instance.
Invoked after the population of normal bean properties but
before an initialization callback such as
InitializingBean's
InitializingBean.afterPropertiesSet()
method or a custom init-method.
setBeanClassLoader
in interface BeanClassLoaderAware
classLoader
- the owning class loader; may be null
in
which case a default ClassLoader
must be used, for example
the ClassLoader
obtained via
ClassUtils.getDefaultClassLoader()
protected Class resolveClassName(String className) throws ClassNotFoundException
MethodInvoker
The default implementations uses ClassUtils.forName
,
using the thread context class loader.
resolveClassName
in class MethodInvoker
className
- the class name to resolveClassNotFoundException
- if the class name was invalidpublic void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
ClassNotFoundException
NoSuchMethodException
protected String getInvocationFailureMessage()