Class SimpleAsyncTaskSchedulerBuilder

java.lang.Object
org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder

public class SimpleAsyncTaskSchedulerBuilder extends Object
Builder that can be used to configure and create a SimpleAsyncTaskScheduler. Provides convenience methods to set common SimpleAsyncTaskScheduler settings. For advanced configuration, consider using SimpleAsyncTaskSchedulerCustomizer.

In a typical auto-configured Spring Boot application this builder is available as a bean and can be injected whenever a SimpleAsyncTaskScheduler is needed.

Since:
3.2.0
  • Constructor Details

    • SimpleAsyncTaskSchedulerBuilder

      public SimpleAsyncTaskSchedulerBuilder()
  • Method Details

    • threadNamePrefix

      public SimpleAsyncTaskSchedulerBuilder threadNamePrefix(String threadNamePrefix)
      Set the prefix to use for the names of newly created threads.
      Parameters:
      threadNamePrefix - the thread name prefix to set
      Returns:
      a new builder instance
    • concurrencyLimit

      public SimpleAsyncTaskSchedulerBuilder concurrencyLimit(Integer concurrencyLimit)
      Set the concurrency limit.
      Parameters:
      concurrencyLimit - the concurrency limit
      Returns:
      a new builder instance
    • virtualThreads

      public SimpleAsyncTaskSchedulerBuilder virtualThreads(Boolean virtualThreads)
      Set whether to use virtual threads.
      Parameters:
      virtualThreads - whether to use virtual threads
      Returns:
      a new builder instance
    • customizers

      Set the customizers that should be applied to the SimpleAsyncTaskScheduler. Customizers are applied in the order that they were added after builder configuration has been applied. Setting this value will replace any previously configured customizers.
      Parameters:
      customizers - the customizers to set
      Returns:
      a new builder instance
      See Also:
    • customizers

      Set the customizers that should be applied to the SimpleAsyncTaskScheduler. Customizers are applied in the order that they were added after builder configuration has been applied. Setting this value will replace any previously configured customizers.
      Parameters:
      customizers - the customizers to set
      Returns:
      a new builder instance
      See Also:
    • additionalCustomizers

      public SimpleAsyncTaskSchedulerBuilder additionalCustomizers(SimpleAsyncTaskSchedulerCustomizer... customizers)
      Add customizers that should be applied to the SimpleAsyncTaskScheduler. Customizers are applied in the order that they were added after builder configuration has been applied.
      Parameters:
      customizers - the customizers to add
      Returns:
      a new builder instance
      See Also:
    • additionalCustomizers

      public SimpleAsyncTaskSchedulerBuilder additionalCustomizers(Iterable<? extends SimpleAsyncTaskSchedulerCustomizer> customizers)
      Add customizers that should be applied to the SimpleAsyncTaskScheduler. Customizers are applied in the order that they were added after builder configuration has been applied.
      Parameters:
      customizers - the customizers to add
      Returns:
      a new builder instance
      See Also:
    • build

      public org.springframework.scheduling.concurrent.SimpleAsyncTaskScheduler build()
      Build a new SimpleAsyncTaskScheduler instance and configure it using this builder.
      Returns:
      a configured SimpleAsyncTaskScheduler instance.
      See Also:
    • configure

      public <T extends org.springframework.scheduling.concurrent.SimpleAsyncTaskScheduler> T configure(T taskScheduler)
      Configure the provided SimpleAsyncTaskScheduler instance using this builder.
      Type Parameters:
      T - the type of task scheduler
      Parameters:
      taskScheduler - the SimpleAsyncTaskScheduler to configure
      Returns:
      the task scheduler instance
      See Also: