Class MethodInvokingRunnable
- java.lang.Object
- org.springframework.util.MethodInvoker
- org.springframework.beans.support.ArgumentConvertingMethodInvoker
- org.springframework.scheduling.support.MethodInvokingRunnable
- All Implemented Interfaces:
Runnable
,Aware
,BeanClassLoaderAware
,InitializingBean
public class MethodInvokingRunnable extends ArgumentConvertingMethodInvoker implements Runnable, BeanClassLoaderAware, InitializingBean
Adapter that implements theRunnable
interface as a configurable method invocation based on Spring's MethodInvoker.Inherits common configuration properties from
MethodInvoker
.- Since:
- 1.2.4
- Author:
- Juergen Hoeller
- See Also:
Executor.execute(Runnable)
Field Summary
Fields inherited from class org.springframework.util.MethodInvoker
targetClass
Constructor Summary
Constructors Constructor Description MethodInvokingRunnable()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.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 beanclass loader
to a bean instance.Methods inherited from class org.springframework.beans.support.ArgumentConvertingMethodInvoker
doFindMatchingMethod, findMatchingMethod, getDefaultTypeConverter, getTypeConverter, registerCustomEditor, setTypeConverter
Methods inherited from class org.springframework.util.MethodInvoker
getArguments, getPreparedMethod, getTargetClass, getTargetMethod, getTargetObject, getTypeDifferenceWeight, invoke, isPrepared, prepare, setArguments, setStaticMethod, setTargetClass, setTargetMethod, setTargetObject
Constructor Detail
MethodInvokingRunnable
public MethodInvokingRunnable()
Method Detail
setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)
Description copied from interface:BeanClassLoaderAware
Callback that supplies the beanclass 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.- Specified by:
setBeanClassLoader
in interfaceBeanClassLoaderAware
- Parameters:
classLoader
- the owning class loader
resolveClassName
protected Class<?> resolveClassName(String className) throws ClassNotFoundException
Description copied from class:MethodInvoker
Resolve the given class name into a Class.The default implementations uses
ClassUtils.forName
, using the thread context class loader.- Overrides:
resolveClassName
in classMethodInvoker
- Parameters:
className
- the class name to resolve- Returns:
- the resolved Class
- Throws:
ClassNotFoundException
- if the class name was invalid
afterPropertiesSet
public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException
Description copied from interface:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
ClassNotFoundException
NoSuchMethodException
getInvocationFailureMessage
protected String getInvocationFailureMessage()
Build a message for an invocation failure exception.- Returns:
- the error message, including the target method name etc