@Configuration @EnableAsync public class AsyncExecutorConfiguration extends Object implements BeanDefinitionRegistryPostProcessor, AsyncConfigurer, EnvironmentAware
The loaded configuration properties are themselves registered as a bean, so they may be in other classes
needing them, see EXECUTOR_CONFIGURATION_PROPERTIES
.
For each configured task a bean DelegatingExecutor
with the name {system_name}.{task_name}
is created. The
task's configured executor is set in the DelegatingExecutor
as it's delegate.
A method annotated with Async
can specify its full task name,
i.e. {system_name}.{task_name}
as the annotation value. The corresponding delegating executor bean will be retrieved by this
name.
NOTE: each async task MUST be specified in the configuration, otherwise an exception will be raised.
Constructor and Description |
---|
AsyncExecutorConfiguration() |
Modifier and Type | Method and Description |
---|---|
Executor |
getAsyncExecutor() |
AsyncUncaughtExceptionHandler |
getAsyncUncaughtExceptionHandler() |
void |
postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) |
void |
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) |
void |
setEnvironment(Environment environment) |
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException
postProcessBeanDefinitionRegistry
in interface BeanDefinitionRegistryPostProcessor
BeansException
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
Configured method names are aliased to their corresponding executor, such that bean lookup works.
postProcessBeanFactory
in interface BeanFactoryPostProcessor
BeansException
public Executor getAsyncExecutor()
getAsyncExecutor
in interface AsyncConfigurer
isDefaultExecutor(ExecutorProperties)
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler()
getAsyncUncaughtExceptionHandler
in interface AsyncConfigurer
public void setEnvironment(Environment environment)
Use the environment to obtain the location of the configuration file.
setEnvironment
in interface EnvironmentAware