Skip to content

Commit 669909e

Browse files
committed
Remove use of Security's FieldUtils
Closes gh-45322
1 parent 24c9dd6 commit 669909e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -48,7 +48,6 @@
4848
import org.springframework.context.annotation.Configuration;
4949
import org.springframework.core.task.AsyncTaskExecutor;
5050
import org.springframework.core.task.SimpleAsyncTaskExecutor;
51-
import org.springframework.core.task.TaskExecutor;
5251
import org.springframework.messaging.converter.CompositeMessageConverter;
5352
import org.springframework.messaging.converter.MessageConverter;
5453
import org.springframework.messaging.converter.SimpleMessageConverter;
@@ -61,7 +60,6 @@
6160
import org.springframework.messaging.simp.stomp.StompSession;
6261
import org.springframework.messaging.simp.stomp.StompSessionHandler;
6362
import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter;
64-
import org.springframework.security.util.FieldUtils;
6563
import org.springframework.stereotype.Controller;
6664
import org.springframework.web.client.RestTemplate;
6765
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
@@ -139,27 +137,25 @@ void customizedConverterTypesMatchDefaultConverterTypes() {
139137
}
140138

141139
@Test
142-
void predefinedThreadExecutorIsSelectedForInboundChannel() throws Throwable {
140+
void predefinedThreadExecutorIsSelectedForInboundChannel() {
143141
AsyncTaskExecutor expectedExecutor = new SimpleAsyncTaskExecutor();
144142
ChannelRegistration registration = new ChannelRegistration();
145143
WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration(
146144
new ObjectMapper(),
147145
Map.of(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, expectedExecutor));
148146
configuration.configureClientInboundChannel(registration);
149-
TaskExecutor executor = (TaskExecutor) FieldUtils.getFieldValue(registration, "executor");
150-
assertThat(executor).isEqualTo(expectedExecutor);
147+
assertThat(registration).extracting("executor").isEqualTo(expectedExecutor);
151148
}
152149

153150
@Test
154-
void predefinedThreadExecutorIsSelectedForOutboundChannel() throws Throwable {
151+
void predefinedThreadExecutorIsSelectedForOutboundChannel() {
155152
AsyncTaskExecutor expectedExecutor = new SimpleAsyncTaskExecutor();
156153
ChannelRegistration registration = new ChannelRegistration();
157154
WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration(
158155
new ObjectMapper(),
159156
Map.of(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, expectedExecutor));
160157
configuration.configureClientOutboundChannel(registration);
161-
TaskExecutor executor = (TaskExecutor) FieldUtils.getFieldValue(registration, "executor");
162-
assertThat(executor).isEqualTo(expectedExecutor);
158+
assertThat(registration).extracting("executor").isEqualTo(expectedExecutor);
163159
}
164160

165161
private List<MessageConverter> getCustomizedConverters() {

0 commit comments

Comments
 (0)