Skip to content

Commit b06d267

Browse files
committed
Remove references to AsyncConfigurerSupport
Closes gh-27812
1 parent 8422d9d commit b06d267

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,19 +28,13 @@
2828
* {@link AsyncUncaughtExceptionHandler} instance used to process exception thrown from
2929
* async method with {@code void} return type.
3030
*
31-
* <p>Consider using {@link AsyncConfigurerSupport} providing default implementations for
32-
* both methods if only one element needs to be customized. Furthermore, backward compatibility
33-
* of this interface will be insured in case new customization options are introduced
34-
* in the future.
35-
*
3631
* <p>See @{@link EnableAsync} for usage examples.
3732
*
3833
* @author Chris Beams
3934
* @author Stephane Nicoll
4035
* @since 3.1
4136
* @see AbstractAsyncConfiguration
4237
* @see EnableAsync
43-
* @see AsyncConfigurerSupport
4438
*/
4539
public interface AsyncConfigurer {
4640

spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -218,8 +218,8 @@ public void handleExceptionWithListenableFuture() {
218218
private void assertFutureWithException(Future<Object> result,
219219
TestableAsyncUncaughtExceptionHandler exceptionHandler) {
220220
assertThatExceptionOfType(ExecutionException.class).isThrownBy(
221-
result::get)
222-
.withCauseExactlyInstanceOf(UnsupportedOperationException.class);
221+
result::get)
222+
.withCauseExactlyInstanceOf(UnsupportedOperationException.class);
223223
assertThat(exceptionHandler.isCalled()).as("handler should never be called with Future return type").isFalse();
224224
}
225225

@@ -343,7 +343,7 @@ public void execute(Runnable r) {
343343

344344
@Configuration
345345
@EnableAsync
346-
static class ConfigWithExceptionHandler extends AsyncConfigurerSupport {
346+
static class ConfigWithExceptionHandler implements AsyncConfigurer {
347347

348348
@Bean
349349
public ITestBean target() {

spring-test/src/test/java/org/springframework/test/context/event/EventPublishingTestExecutionListenerIntegrationTests.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
3131
import org.springframework.context.annotation.Bean;
3232
import org.springframework.context.annotation.Configuration;
3333
import org.springframework.scheduling.annotation.Async;
34-
import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
34+
import org.springframework.scheduling.annotation.AsyncConfigurer;
3535
import org.springframework.scheduling.annotation.EnableAsync;
3636
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
3737
import org.springframework.stereotype.Component;
@@ -73,13 +73,17 @@ public class EventPublishingTestExecutionListenerIntegrationTests {
7373
private static final CountDownLatch countDownLatch = new CountDownLatch(1);
7474

7575
private final TestContextManager testContextManager = new TestContextManager(ExampleTestCase.class);
76+
7677
private final TestContext testContext = testContextManager.getTestContext();
78+
7779
// Note that the following invocation of getApplicationContext() forces eager
7880
// loading of the test's ApplicationContext which consequently results in the
7981
// publication of all test execution events. Otherwise, TestContext#publishEvent
8082
// would never fire any events for ExampleTestCase.
8183
private final TestExecutionListener listener = testContext.getApplicationContext().getBean(TestExecutionListener.class);
84+
8285
private final Object testInstance = new ExampleTestCase();
86+
8387
private final Method traceableTestMethod = ReflectionUtils.findMethod(ExampleTestCase.class, "traceableTest");
8488

8589

@@ -127,8 +131,8 @@ public void beforeTestMethodAnnotationWithFailingCondition() throws Exception {
127131
public void beforeTestMethodAnnotationWithFailingEventListener() throws Exception {
128132
Method method = ReflectionUtils.findMethod(ExampleTestCase.class, "testWithFailingEventListener");
129133
assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
130-
testContextManager.beforeTestMethod(testInstance, method))
131-
.withMessageContaining("Boom!");
134+
testContextManager.beforeTestMethod(testInstance, method))
135+
.withMessageContaining("Boom!");
132136
verify(listener, only()).beforeTestMethod(testContext);
133137
}
134138

@@ -149,7 +153,7 @@ public void beforeTestMethodAnnotationWithFailingAsyncEventListener() throws Exc
149153

150154
verify(listener, only()).beforeTestMethod(testContext);
151155
assertThat(TrackingAsyncUncaughtExceptionHandler.asyncException.getMessage())
152-
.startsWith("Asynchronous exception for test method [" + methodName + "] in thread [" + THREAD_NAME_PREFIX);
156+
.startsWith("Asynchronous exception for test method [" + methodName + "] in thread [" + THREAD_NAME_PREFIX);
153157
}
154158

155159
@Test
@@ -211,7 +215,7 @@ public void testWithFailingAsyncEventListener() {
211215

212216
@Configuration
213217
@EnableAsync(proxyTargetClass = true)
214-
static class TestEventListenerConfiguration extends AsyncConfigurerSupport {
218+
static class TestEventListenerConfiguration implements AsyncConfigurer {
215219

216220
@Override
217221
public Executor getAsyncExecutor() {
@@ -306,7 +310,7 @@ static class AsyncTestEventComponent {
306310
public void beforeTestMethodWithAsyncFailure(BeforeTestMethodEvent event) throws Exception {
307311
this.listener.beforeTestMethod(event.getSource());
308312
throw new RuntimeException(String.format("Asynchronous exception for test method [%s] in thread [%s]",
309-
event.getTestContext().getTestMethod().getName(), Thread.currentThread().getName()));
313+
event.getTestContext().getTestMethod().getName(), Thread.currentThread().getName()));
310314
}
311315

312316
}

0 commit comments

Comments
 (0)