org.springframework.scheduling.annotation

Class AsyncAnnotationBeanPostProcessor

    • Constructor Detail

      • AsyncAnnotationBeanPostProcessor

        public AsyncAnnotationBeanPostProcessor()
    • Method Detail

      • configure

        public void configure(@Nullable
                              java.util.function.Supplier<java.util.concurrent.Executor> executor,
                              @Nullable
                              java.util.function.Supplier<AsyncUncaughtExceptionHandler> exceptionHandler)
        Configure this post-processor with the given executor and exception handler suppliers, applying the corresponding default if a supplier is not resolvable.
        Since:
        5.1
      • setExecutor

        public void setExecutor(java.util.concurrent.Executor executor)
        Set the Executor to use when invoking methods asynchronously.

        If not specified, default executor resolution will apply: searching for a unique TaskExecutor bean in the context, or for an Executor bean named "taskExecutor" otherwise. If neither of the two is resolvable, a local default executor will be created within the interceptor.

        See Also:
        AsyncExecutionInterceptor.getDefaultExecutor(BeanFactory), DEFAULT_TASK_EXECUTOR_BEAN_NAME
      • setAsyncAnnotationType

        public void setAsyncAnnotationType(java.lang.Class<? extends java.lang.annotation.Annotation> asyncAnnotationType)
        Set the 'async' annotation type to be detected at either class or method level. By default, both the Async annotation and the EJB 3.1 javax.ejb.Asynchronous annotation will be detected.

        This setter property exists so that developers can provide their own (non-Spring-specific) annotation type to indicate that a method (or all methods of a given class) should be invoked asynchronously.

        Parameters:
        asyncAnnotationType - the desired annotation type