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 theRunnableinterface 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)
Constructor Summary
Constructors Constructor Description MethodInvokingRunnable()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.protected StringgetInvocationFailureMessage()Build a message for an invocation failure exception.protected Class<?>resolveClassName(String className)Resolve the given class name into a Class.voidrun()voidsetBeanClassLoader(ClassLoader classLoader)Callback that supplies the beanclass loaderto 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:BeanClassLoaderAwareCallback that supplies the beanclass loaderto a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean'sInitializingBean.afterPropertiesSet()method or a custom init-method.- Specified by:
setBeanClassLoaderin interfaceBeanClassLoaderAware- Parameters:
classLoader- the owning class loader; may benullin which case a defaultClassLoadermust be used, for example theClassLoaderobtained viaClassUtils.getDefaultClassLoader()
resolveClassName
protected Class<?> resolveClassName(String className) throws ClassNotFoundException
Description copied from class:MethodInvokerResolve the given class name into a Class.The default implementations uses
ClassUtils.forName, using the thread context class loader.- Overrides:
resolveClassNamein 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:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.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:
afterPropertiesSetin interfaceInitializingBean- Throws:
ClassNotFoundExceptionNoSuchMethodException
getInvocationFailureMessage
protected String getInvocationFailureMessage()
Build a message for an invocation failure exception.- Returns:
- the error message, including the target method name etc