Class AsyncExecutorConfiguration
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.config.BeanFactoryPostProcessor,org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor,org.springframework.context.EnvironmentAware,org.springframework.scheduling.annotation.AsyncConfigurer
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 its 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.
- Since:
- 2.0.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.aop.interceptor.AsyncUncaughtExceptionHandlervoidpostProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) voidpostProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) voidsetAsyncPropertiesLoader(AsyncPropertiesLoader asyncPropertiesLoader) Setter for the properties loaded.voidsetEnvironment(org.springframework.core.env.Environment environment)
-
Field Details
-
ASYNC_TIMEOUT_EXECUTOR
Async (task) timeout executor bean name.- See Also:
-
-
Constructor Details
-
AsyncExecutorConfiguration
public AsyncExecutorConfiguration()
-
-
Method Details
-
postProcessBeanDefinitionRegistry
public void postProcessBeanDefinitionRegistry(@NonNull org.springframework.beans.factory.support.BeanDefinitionRegistry registry) - Specified by:
postProcessBeanDefinitionRegistryin interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
-
postProcessBeanFactory
public void postProcessBeanFactory(@NonNull org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) Configured method names are aliased to their corresponding executor, such that bean lookup works.
- Specified by:
postProcessBeanFactoryin interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor- Specified by:
postProcessBeanFactoryin interfaceorg.springframework.beans.factory.config.BeanFactoryPostProcessor
-
getAsyncExecutor
- Specified by:
getAsyncExecutorin interfaceorg.springframework.scheduling.annotation.AsyncConfigurer- Returns:
- the default executor.
-
getAsyncUncaughtExceptionHandler
public org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler()- Specified by:
getAsyncUncaughtExceptionHandlerin interfaceorg.springframework.scheduling.annotation.AsyncConfigurer- Returns:
- null, i.e. use the Spring default
-
setEnvironment
public void setEnvironment(@NonNull org.springframework.core.env.Environment environment) Use the environment to obtain the location of the configuration file.
- Specified by:
setEnvironmentin interfaceorg.springframework.context.EnvironmentAware
-
setAsyncPropertiesLoader
Setter for the properties loaded.Added for testability.
- Parameters:
asyncPropertiesLoader- the loader
-