Skip to content

Commit bc139fb

Browse files
Changes following review
1 parent 6133678 commit bc139fb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void setImportMetadata(AnnotationMetadata importMetadata) {
7070
* Collect any {@link AsyncConfigurer} beans through autowiring.
7171
*/
7272
@Autowired
73-
void setConfigurers(ObjectProvider<AsyncConfigurer> configurers, ObjectProvider<AsyncConfigurerExecutorCustomizer> customizers) {
73+
void setConfigurers(ObjectProvider<AsyncConfigurer> configurers, ObjectProvider<AsyncConfigurerExecutorCustomizer> customizer) {
7474
Supplier<AsyncConfigurer> configurer = SingletonSupplier.of(() -> {
7575
List<AsyncConfigurer> candidates = configurers.stream().collect(Collectors.toList());
7676
if (CollectionUtils.isEmpty(candidates)) {
@@ -82,7 +82,12 @@ void setConfigurers(ObjectProvider<AsyncConfigurer> configurers, ObjectProvider<
8282
return candidates.get(0);
8383
});
8484
Supplier<Executor> adaptedExecutor = adapt(configurer, AsyncConfigurer::getAsyncExecutor);
85-
customizers.ifAvailable(customizer -> this.executor = () -> customizer.customize(adaptedExecutor.get()));
85+
AsyncConfigurerExecutorCustomizer executorCustomizer = customizer.getIfAvailable();
86+
if (executorCustomizer == null) {
87+
this.executor = adaptedExecutor;
88+
} else {
89+
this.executor = () -> executorCustomizer.customize(adaptedExecutor.get());
90+
}
8691
this.exceptionHandler = adapt(configurer, AsyncConfigurer::getAsyncUncaughtExceptionHandler);
8792
}
8893

0 commit comments

Comments
 (0)