Skip to content

Commit 66d76a3

Browse files
committed
Upgrade to Spring Framework 7.0
* Upgrade to Spring Data `2025.1.0` * Upgrade to Spring Security `7.0` * Fix all the compilation errors, including for Kotlin (not clear how they passed before upgrade to SF `7.0`)
1 parent 66de5a2 commit 66d76a3

File tree

27 files changed

+81
-78
lines changed

27 files changed

+81
-78
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ ext {
109109
servletApiVersion = '6.1.0'
110110
smackVersion = '4.4.8'
111111
springAmqpVersion = '3.2.5'
112-
springDataVersion = '2025.0.0'
112+
springDataVersion = '2025.1.0-SNAPSHOT'
113113
springGraphqlVersion = '1.4.0'
114114
springKafkaVersion = '3.3.6'
115115
springRetryVersion = '2.0.12'
116-
springSecurityVersion = '6.5.0'
117-
springVersion = '6.2.7'
116+
springSecurityVersion = '7.0.0-SNAPSHOT'
117+
springVersion = '7.0.0-SNAPSHOT'
118118
springWsVersion = '4.1.0'
119119
testcontainersVersion = '1.21.1'
120120
tomcatVersion = '11.0.7'

spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinEnricherSpec.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2023 the original author or authors.
2+
* Copyright 2020-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.
@@ -69,7 +69,7 @@ class KotlinEnricherSpec(override val delegate: EnricherSpec)
6969
this.delegate.requestPayloadExpression(requestPayloadExpression)
7070
}
7171

72-
fun <P> requestPayload(function: (Message<P>) -> Any) {
72+
fun <P: Any> requestPayload(function: (Message<P>) -> Any) {
7373
this.delegate.requestPayload(function)
7474
}
7575

@@ -93,7 +93,7 @@ class KotlinEnricherSpec(override val delegate: EnricherSpec)
9393
this.delegate.propertyExpression(key, expression)
9494
}
9595

96-
fun <P> propertyFunction(key: String, function: (Message<P>) -> Any) {
96+
fun <P: Any> propertyFunction(key: String, function: (Message<P>) -> Any) {
9797
this.delegate.propertyFunction(key, function)
9898
}
9999

@@ -105,7 +105,7 @@ class KotlinEnricherSpec(override val delegate: EnricherSpec)
105105
this.delegate.header(name, expression, overwrite)
106106
}
107107

108-
fun <P> headerFunction(name: String, function: (Message<P>) -> Any, overwrite: Boolean?) {
108+
fun <P: Any> headerFunction(name: String, function: (Message<P>) -> Any, overwrite: Boolean?) {
109109
this.delegate.header(name, function, overwrite)
110110
}
111111

spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
901901
* the `org.springframework.integration.handler.LoggingHandler`
902902
* as a default logging category and function for the log message.
903903
*/
904-
fun <P> log(function: (Message<P>) -> Any) {
904+
fun <P: Any> log(function: (Message<P>) -> Any) {
905905
this.delegate.log(function)
906906
}
907907

@@ -948,7 +948,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
948948
* the `org.springframework.integration.handler.LoggingHandler`
949949
* as a default logging category and function for the log message.
950950
*/
951-
fun <P> log(level: LoggingHandler.Level, function: (Message<P>) -> Any) {
951+
fun <P: Any> log(level: LoggingHandler.Level, function: (Message<P>) -> Any) {
952952
this.delegate.log(level, function)
953953
}
954954

@@ -958,7 +958,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
958958
* [LoggingHandler.Level] logging level,
959959
* the provided logging category and function for the log message.
960960
*/
961-
fun <P> log(category: String, function: (Message<P>) -> Any) {
961+
fun <P: Any> log(category: String, function: (Message<P>) -> Any) {
962962
this.delegate.log(category, function)
963963
}
964964

@@ -968,7 +968,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
968968
* [LoggingHandler.Level] logging level, logging category
969969
* and function for the log message.
970970
*/
971-
fun <P> log(level: LoggingHandler.Level, category: String, function: (Message<P>) -> Any) {
971+
fun <P: Any> log(level: LoggingHandler.Level, category: String, function: (Message<P>) -> Any) {
972972
this.delegate.log(level, category, function)
973973
}
974974

@@ -1075,7 +1075,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
10751075
* wrap it to a [Flux], apply provided function via [Flux.transform]
10761076
* and emit the result to one more [FluxMessageChannel], subscribed in the downstream flow.
10771077
*/
1078-
fun <I, O> fluxTransform(fluxFunction: (Flux<Message<I>>) -> Publisher<O>) {
1078+
fun <I: Any, O> fluxTransform(fluxFunction: (Flux<Message<I>>) -> Publisher<O>) {
10791079
this.delegate.fluxTransform(fluxFunction)
10801080
}
10811081

spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/KotlinDslTests.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2024 the original author or authors.
2+
* Copyright 2020-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.
@@ -197,7 +197,7 @@ class KotlinDslTests {
197197

198198
val receive = replyChannel.receive(10_000)
199199
assertThat(receive?.payload).isNotNull().isEqualTo("TEST")
200-
assertThat(receive.headers).doesNotContain("headerToRemove", null)
200+
assertThat(receive?.headers).isNotNull().doesNotContain("headerToRemove", null)
201201
assertThat(this.wireTapChannel.receive(10_000)?.payload).isNotNull().isEqualTo("test")
202202
}
203203

spring-integration-http/src/main/java/org/springframework/integration/http/aot/HttpRuntimeHints.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 the original author or authors.
2+
* Copyright 2022-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.
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.integration.http.aot;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.aot.hint.MemberCategory;
2022
import org.springframework.aot.hint.ReflectionHints;
2123
import org.springframework.aot.hint.RuntimeHints;
@@ -34,7 +36,7 @@
3436
class HttpRuntimeHints implements RuntimeHintsRegistrar {
3537

3638
@Override
37-
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
39+
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
3840
ReflectionHints reflectionHints = hints.reflection();
3941
reflectionHints.registerType(WebHandler.class, MemberCategory.INVOKE_PUBLIC_METHODS);
4042

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Provides classes to support Spring AOT.
33
*/
4-
@org.springframework.lang.NonNullApi
5-
@org.springframework.lang.NonNullFields
4+
@org.jspecify.annotations.NullMarked
65
package org.springframework.integration.http.aot;

spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 the original author or authors.
2+
* Copyright 2016-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.
@@ -19,12 +19,13 @@
1919
import java.net.URI;
2020
import java.util.function.Function;
2121

22+
import org.jspecify.annotations.Nullable;
23+
2224
import org.springframework.expression.Expression;
2325
import org.springframework.expression.common.LiteralExpression;
2426
import org.springframework.integration.expression.FunctionExpression;
2527
import org.springframework.integration.http.inbound.HttpRequestHandlingController;
2628
import org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway;
27-
import org.springframework.lang.Nullable;
2829
import org.springframework.messaging.Message;
2930
import org.springframework.util.Assert;
3031
import org.springframework.web.client.RestTemplate;

spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2024 the original author or authors.
2+
* Copyright 2017-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.
@@ -22,6 +22,8 @@
2222
import java.util.function.Consumer;
2323
import java.util.function.Function;
2424

25+
import org.jspecify.annotations.Nullable;
26+
2527
import org.springframework.core.ResolvableType;
2628
import org.springframework.expression.Expression;
2729
import org.springframework.http.HttpEntity;
@@ -36,7 +38,6 @@
3638
import org.springframework.integration.http.inbound.RequestMapping;
3739
import org.springframework.integration.http.support.DefaultHttpHeaderMapper;
3840
import org.springframework.integration.mapping.HeaderMapper;
39-
import org.springframework.lang.Nullable;
4041
import org.springframework.util.Assert;
4142
import org.springframework.validation.Validator;
4243
import org.springframework.web.bind.annotation.RequestMethod;

spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpMessageHandlerSpec.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 the original author or authors.
2+
* Copyright 2016-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.
@@ -19,13 +19,14 @@
1919
import java.net.URI;
2020
import java.util.Arrays;
2121

22+
import org.jspecify.annotations.Nullable;
23+
2224
import org.springframework.expression.Expression;
2325
import org.springframework.expression.common.LiteralExpression;
2426
import org.springframework.http.client.ClientHttpRequestFactory;
2527
import org.springframework.http.converter.HttpMessageConverter;
2628
import org.springframework.integration.expression.ValueExpression;
2729
import org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler;
28-
import org.springframework.lang.Nullable;
2930
import org.springframework.util.Assert;
3031
import org.springframework.web.client.ResponseErrorHandler;
3132
import org.springframework.web.client.RestTemplate;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Provides HTTP Components support for Spring Integration Java DSL.
33
*/
4-
@org.springframework.lang.NonNullApi
5-
@org.springframework.lang.NonNullFields
4+
@org.jspecify.annotations.NullMarked
65
package org.springframework.integration.http.dsl;

spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2024 the original author or authors.
2+
* Copyright 2017-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.
@@ -21,6 +21,8 @@
2121
import java.util.Map;
2222
import java.util.concurrent.atomic.AtomicInteger;
2323

24+
import org.jspecify.annotations.Nullable;
25+
2426
import org.springframework.core.ResolvableType;
2527
import org.springframework.expression.EvaluationContext;
2628
import org.springframework.expression.Expression;
@@ -36,7 +38,6 @@
3638
import org.springframework.integration.http.support.DefaultHttpHeaderMapper;
3739
import org.springframework.integration.http.support.IntegrationWebExchangeBindException;
3840
import org.springframework.integration.mapping.HeaderMapper;
39-
import org.springframework.lang.Nullable;
4041
import org.springframework.messaging.MessageHeaders;
4142
import org.springframework.util.Assert;
4243
import org.springframework.util.ClassUtils;

spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-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.
@@ -130,9 +130,9 @@ public final void handleRequest(HttpServletRequest servletRequest, HttpServletRe
130130
HttpHeaders outputHeaders = response.getHeaders();
131131
HttpHeaders entityHeaders = responseEntity.getHeaders();
132132

133-
entityHeaders.entrySet()
133+
entityHeaders.headerSet()
134134
.stream()
135-
.filter(entry -> !outputHeaders.containsKey(entry.getKey()))
135+
.filter(entry -> !outputHeaders.containsHeader(entry.getKey()))
136136
.forEach(entry -> outputHeaders.put(entry.getKey(), entry.getValue()));
137137
}
138138

spring-integration-http/src/main/java/org/springframework/integration/http/outbound/AbstractHttpRequestExecutingMessageHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2024 the original author or authors.
2+
* Copyright 2017-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.
@@ -31,6 +31,8 @@
3131

3232
import javax.xml.transform.Source;
3333

34+
import org.jspecify.annotations.Nullable;
35+
3436
import org.springframework.beans.factory.BeanFactory;
3537
import org.springframework.core.ParameterizedTypeReference;
3638
import org.springframework.expression.EvaluationContext;
@@ -51,7 +53,6 @@
5153
import org.springframework.integration.mapping.HeaderMapper;
5254
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
5355
import org.springframework.integration.support.MessageBuilderFactory;
54-
import org.springframework.lang.Nullable;
5556
import org.springframework.messaging.Message;
5657
import org.springframework.util.Assert;
5758
import org.springframework.util.ClassUtils;

spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-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.
@@ -20,6 +20,8 @@
2020
import java.util.List;
2121
import java.util.Map;
2222

23+
import org.jspecify.annotations.Nullable;
24+
2325
import org.springframework.core.ParameterizedTypeReference;
2426
import org.springframework.expression.Expression;
2527
import org.springframework.expression.common.LiteralExpression;
@@ -29,7 +31,6 @@
2931
import org.springframework.http.client.ClientHttpRequestFactory;
3032
import org.springframework.http.converter.HttpMessageConverter;
3133
import org.springframework.integration.expression.ValueExpression;
32-
import org.springframework.lang.Nullable;
3334
import org.springframework.messaging.Message;
3435
import org.springframework.messaging.MessageHandlingException;
3536
import org.springframework.util.Assert;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Provides classes supporting outbound endpoints.
33
*/
4-
@org.springframework.lang.NonNullApi
5-
@org.springframework.lang.NonNullFields
4+
@org.jspecify.annotations.NullMarked
65
package org.springframework.integration.http.outbound;

spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-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.
@@ -39,6 +39,7 @@
3939

4040
import org.apache.commons.logging.Log;
4141
import org.apache.commons.logging.LogFactory;
42+
import org.jspecify.annotations.Nullable;
4243

4344
import org.springframework.beans.BeansException;
4445
import org.springframework.beans.factory.BeanFactory;
@@ -51,7 +52,6 @@
5152
import org.springframework.http.MediaType;
5253
import org.springframework.integration.mapping.HeaderMapper;
5354
import org.springframework.integration.support.utils.IntegrationUtils;
54-
import org.springframework.lang.Nullable;
5555
import org.springframework.messaging.MessageHeaders;
5656
import org.springframework.util.Assert;
5757
import org.springframework.util.CollectionUtils;
@@ -773,7 +773,7 @@ public Map<String, Object> toHeaders(HttpHeaders source) {
773773
this.logger.debug("inboundHeaderNames=" + Arrays.toString(this.inboundHeaderNames));
774774
}
775775
Map<String, Object> target = new HashMap<>();
776-
Set<String> headerNames = source.keySet();
776+
Set<String> headerNames = source.headerNames();
777777
for (String name : headerNames) {
778778
String lowerName = name.toLowerCase(Locale.ROOT);
779779
if (shouldMapInboundHeader(lowerName)) {
@@ -793,7 +793,7 @@ private void populateUserDefinedHeader(HttpHeaders source, Map<String, Object> t
793793
String prefixedName = StringUtils.startsWithIgnoreCase(name, this.userDefinedHeaderPrefix)
794794
? name
795795
: this.userDefinedHeaderPrefix + name;
796-
Object value = source.containsKey(prefixedName)
796+
Object value = source.containsHeader(prefixedName)
797797
? getHttpHeader(source, prefixedName)
798798
: getHttpHeader(source, name);
799799
if (value != null) {

spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2022 the original author or authors.
2+
* Copyright 2013-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.
@@ -44,7 +44,6 @@
4444
import org.springframework.test.annotation.DirtiesContext;
4545
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
4646
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
47-
import org.springframework.util.LinkedMultiValueMap;
4847
import org.springframework.util.MultiValueMap;
4948
import org.springframework.web.client.RestTemplate;
5049
import org.springframework.web.context.request.RequestAttributes;
@@ -129,7 +128,7 @@ public void testHttpProxyScenario() throws Exception {
129128
assertThat(httpHeaders.getFirst("If-Unmodified-Since")).isEqualTo(ifUnmodifiedSinceValue);
130129
assertThat(httpHeaders.getFirst("Connection")).isEqualTo("Keep-Alive");
131130

132-
MultiValueMap<String, String> responseHeaders = new LinkedMultiValueMap<>(httpHeaders);
131+
HttpHeaders responseHeaders = HttpHeaders.copyOf(httpHeaders);
133132
responseHeaders.set("Connection", "close");
134133
responseHeaders.set("Content-Disposition", contentDispositionValue);
135134
return new ResponseEntity<>(responseHeaders, HttpStatus.OK);
@@ -190,7 +189,7 @@ public void testHttpMultipartProxyScenario() throws Exception {
190189
assertThat(((MultiValueMap<String, ?>) entity.getBody()).getFirst("foo"))
191190
.isEqualTo("foo".getBytes());
192191

193-
MultiValueMap<String, String> responseHeaders = new LinkedMultiValueMap<>(httpHeaders);
192+
HttpHeaders responseHeaders = HttpHeaders.copyOf(httpHeaders);
194193
responseHeaders.set("Connection", "close");
195194
responseHeaders.set("Content-Type", "text/plain");
196195
return new ResponseEntity<>(responseHeaders, HttpStatus.OK);

0 commit comments

Comments
 (0)