diff --git a/build.gradle b/build.gradle index 3a651ab10b..5ab55041da 100644 --- a/build.gradle +++ b/build.gradle @@ -109,12 +109,12 @@ ext { servletApiVersion = '6.1.0' smackVersion = '4.4.8' springAmqpVersion = '3.2.5' - springDataVersion = '2025.0.0' + springDataVersion = '2025.1.0-SNAPSHOT' springGraphqlVersion = '1.4.0' springKafkaVersion = '3.3.6' springRetryVersion = '2.0.12' - springSecurityVersion = '6.5.0' - springVersion = '6.2.7' + springSecurityVersion = '7.0.0-SNAPSHOT' + springVersion = '7.0.0-SNAPSHOT' springWsVersion = '4.1.0' testcontainersVersion = '1.21.1' tomcatVersion = '11.0.7' diff --git a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinEnricherSpec.kt b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinEnricherSpec.kt index 7cd1dd43c1..4155065f64 100644 --- a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinEnricherSpec.kt +++ b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinEnricherSpec.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ class KotlinEnricherSpec(override val delegate: EnricherSpec) this.delegate.requestPayloadExpression(requestPayloadExpression) } - fun

requestPayload(function: (Message

) -> Any) { + fun requestPayload(function: (Message

) -> Any) { this.delegate.requestPayload(function) } @@ -93,7 +93,7 @@ class KotlinEnricherSpec(override val delegate: EnricherSpec) this.delegate.propertyExpression(key, expression) } - fun

propertyFunction(key: String, function: (Message

) -> Any) { + fun propertyFunction(key: String, function: (Message

) -> Any) { this.delegate.propertyFunction(key, function) } @@ -105,7 +105,7 @@ class KotlinEnricherSpec(override val delegate: EnricherSpec) this.delegate.header(name, expression, overwrite) } - fun

headerFunction(name: String, function: (Message

) -> Any, overwrite: Boolean?) { + fun headerFunction(name: String, function: (Message

) -> Any, overwrite: Boolean?) { this.delegate.header(name, function, overwrite) } diff --git a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt index ab352120b8..294a273dca 100644 --- a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt +++ b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt @@ -901,7 +901,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * the `org.springframework.integration.handler.LoggingHandler` * as a default logging category and function for the log message. */ - fun

log(function: (Message

) -> Any) { + fun log(function: (Message

) -> Any) { this.delegate.log(function) } @@ -948,7 +948,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * the `org.springframework.integration.handler.LoggingHandler` * as a default logging category and function for the log message. */ - fun

log(level: LoggingHandler.Level, function: (Message

) -> Any) { + fun log(level: LoggingHandler.Level, function: (Message

) -> Any) { this.delegate.log(level, function) } @@ -958,7 +958,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * [LoggingHandler.Level] logging level, * the provided logging category and function for the log message. */ - fun

log(category: String, function: (Message

) -> Any) { + fun log(category: String, function: (Message

) -> Any) { this.delegate.log(category, function) } @@ -968,7 +968,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * [LoggingHandler.Level] logging level, logging category * and function for the log message. */ - fun

log(level: LoggingHandler.Level, category: String, function: (Message

) -> Any) { + fun log(level: LoggingHandler.Level, category: String, function: (Message

) -> Any) { this.delegate.log(level, category, function) } @@ -1075,7 +1075,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * wrap it to a [Flux], apply provided function via [Flux.transform] * and emit the result to one more [FluxMessageChannel], subscribed in the downstream flow. */ - fun fluxTransform(fluxFunction: (Flux>) -> Publisher) { + fun fluxTransform(fluxFunction: (Flux>) -> Publisher) { this.delegate.fluxTransform(fluxFunction) } diff --git a/spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/KotlinDslTests.kt b/spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/KotlinDslTests.kt index cd9ef1e839..9fa2d92183 100644 --- a/spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/KotlinDslTests.kt +++ b/spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/KotlinDslTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2024 the original author or authors. + * Copyright 2020-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -197,7 +197,7 @@ class KotlinDslTests { val receive = replyChannel.receive(10_000) assertThat(receive?.payload).isNotNull().isEqualTo("TEST") - assertThat(receive.headers).doesNotContain("headerToRemove", null) + assertThat(receive?.headers).isNotNull().doesNotContain("headerToRemove", null) assertThat(this.wireTapChannel.receive(10_000)?.payload).isNotNull().isEqualTo("test") } diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/aot/HttpRuntimeHints.java b/spring-integration-http/src/main/java/org/springframework/integration/http/aot/HttpRuntimeHints.java index 759d19908a..b70455341b 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/aot/HttpRuntimeHints.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/aot/HttpRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.springframework.integration.http.aot; +import org.jspecify.annotations.Nullable; + import org.springframework.aot.hint.MemberCategory; import org.springframework.aot.hint.ReflectionHints; import org.springframework.aot.hint.RuntimeHints; @@ -34,7 +36,7 @@ import org.springframework.web.server.WebHandler; class HttpRuntimeHints implements RuntimeHintsRegistrar { @Override - public void registerHints(RuntimeHints hints, ClassLoader classLoader) { + public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { ReflectionHints reflectionHints = hints.reflection(); reflectionHints.registerType(WebHandler.class, MemberCategory.INVOKE_PUBLIC_METHODS); diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/aot/package-info.java b/spring-integration-http/src/main/java/org/springframework/integration/http/aot/package-info.java index 0722aa47c7..969673b788 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/aot/package-info.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/aot/package-info.java @@ -1,6 +1,5 @@ /** * Provides classes to support Spring AOT. */ -@org.springframework.lang.NonNullApi -@org.springframework.lang.NonNullFields +@org.jspecify.annotations.NullMarked package org.springframework.integration.http.aot; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java index 00ae424fa5..06b755cfbf 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,12 +19,13 @@ package org.springframework.integration.http.dsl; import java.net.URI; import java.util.function.Function; +import org.jspecify.annotations.Nullable; + import org.springframework.expression.Expression; import org.springframework.expression.common.LiteralExpression; import org.springframework.integration.expression.FunctionExpression; import org.springframework.integration.http.inbound.HttpRequestHandlingController; import org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway; -import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.util.Assert; import org.springframework.web.client.RestTemplate; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java index 8ec2def8c7..c5120d0e08 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the original author or authors. + * Copyright 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,8 @@ import java.util.Map; import java.util.function.Consumer; import java.util.function.Function; +import org.jspecify.annotations.Nullable; + import org.springframework.core.ResolvableType; import org.springframework.expression.Expression; import org.springframework.http.HttpEntity; @@ -36,7 +38,6 @@ import org.springframework.integration.http.inbound.CrossOrigin; import org.springframework.integration.http.inbound.RequestMapping; import org.springframework.integration.http.support.DefaultHttpHeaderMapper; import org.springframework.integration.mapping.HeaderMapper; -import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.validation.Validator; import org.springframework.web.bind.annotation.RequestMethod; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpMessageHandlerSpec.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpMessageHandlerSpec.java index ad1dc45c27..a7bf50f2d6 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpMessageHandlerSpec.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpMessageHandlerSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 the original author or authors. + * Copyright 2016-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,14 @@ package org.springframework.integration.http.dsl; import java.net.URI; import java.util.Arrays; +import org.jspecify.annotations.Nullable; + import org.springframework.expression.Expression; import org.springframework.expression.common.LiteralExpression; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.integration.expression.ValueExpression; import org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler; -import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.RestTemplate; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/package-info.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/package-info.java index f0bab4f1ed..feda4257bd 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/package-info.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/package-info.java @@ -1,6 +1,5 @@ /** * Provides HTTP Components support for Spring Integration Java DSL. */ -@org.springframework.lang.NonNullApi -@org.springframework.lang.NonNullFields +@org.jspecify.annotations.NullMarked package org.springframework.integration.http.dsl; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java index 4bc452027b..34d255f082 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/BaseHttpInboundEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the original author or authors. + * Copyright 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,8 @@ import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; +import org.jspecify.annotations.Nullable; + import org.springframework.core.ResolvableType; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; @@ -36,7 +38,6 @@ import org.springframework.integration.gateway.MessagingGatewaySupport; import org.springframework.integration.http.support.DefaultHttpHeaderMapper; import org.springframework.integration.http.support.IntegrationWebExchangeBindException; import org.springframework.integration.mapping.HeaderMapper; -import org.springframework.lang.Nullable; import org.springframework.messaging.MessageHeaders; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java index 194e46e77b..c22d818080 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,9 +130,9 @@ public class HttpRequestHandlingMessagingGateway extends HttpRequestHandlingEndp HttpHeaders outputHeaders = response.getHeaders(); HttpHeaders entityHeaders = responseEntity.getHeaders(); - entityHeaders.entrySet() + entityHeaders.headerSet() .stream() - .filter(entry -> !outputHeaders.containsKey(entry.getKey())) + .filter(entry -> !outputHeaders.containsHeader(entry.getKey())) .forEach(entry -> outputHeaders.put(entry.getKey(), entry.getValue())); } diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/AbstractHttpRequestExecutingMessageHandler.java b/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/AbstractHttpRequestExecutingMessageHandler.java index 32daf0ff41..ce88e69e20 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/AbstractHttpRequestExecutingMessageHandler.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/AbstractHttpRequestExecutingMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the original author or authors. + * Copyright 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,8 @@ import java.util.concurrent.locks.ReentrantLock; import javax.xml.transform.Source; +import org.jspecify.annotations.Nullable; + import org.springframework.beans.factory.BeanFactory; import org.springframework.core.ParameterizedTypeReference; import org.springframework.expression.EvaluationContext; @@ -51,7 +53,6 @@ import org.springframework.integration.http.support.DefaultHttpHeaderMapper; import org.springframework.integration.mapping.HeaderMapper; import org.springframework.integration.support.AbstractIntegrationMessageBuilder; import org.springframework.integration.support.MessageBuilderFactory; -import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java b/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java index b9ad0e598e..14c4176a9e 100755 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ import java.net.URI; import java.util.List; import java.util.Map; +import org.jspecify.annotations.Nullable; + import org.springframework.core.ParameterizedTypeReference; import org.springframework.expression.Expression; import org.springframework.expression.common.LiteralExpression; @@ -29,7 +31,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.integration.expression.ValueExpression; -import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHandlingException; import org.springframework.util.Assert; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/package-info.java b/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/package-info.java index 63a84c612a..4ec5c0b89c 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/package-info.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/outbound/package-info.java @@ -1,6 +1,5 @@ /** * Provides classes supporting outbound endpoints. */ -@org.springframework.lang.NonNullApi -@org.springframework.lang.NonNullFields +@org.jspecify.annotations.NullMarked package org.springframework.integration.http.outbound; diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java b/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java index 066d0fe606..2753575591 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jspecify.annotations.Nullable; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; @@ -51,7 +52,6 @@ import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.integration.mapping.HeaderMapper; import org.springframework.integration.support.utils.IntegrationUtils; -import org.springframework.lang.Nullable; import org.springframework.messaging.MessageHeaders; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; @@ -773,7 +773,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper, BeanF this.logger.debug("inboundHeaderNames=" + Arrays.toString(this.inboundHeaderNames)); } Map target = new HashMap<>(); - Set headerNames = source.keySet(); + Set headerNames = source.headerNames(); for (String name : headerNames) { String lowerName = name.toLowerCase(Locale.ROOT); if (shouldMapInboundHeader(lowerName)) { @@ -793,7 +793,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper, BeanF String prefixedName = StringUtils.startsWithIgnoreCase(name, this.userDefinedHeaderPrefix) ? name : this.userDefinedHeaderPrefix + name; - Object value = source.containsKey(prefixedName) + Object value = source.containsHeader(prefixedName) ? getHttpHeader(source, prefixedName) : getHttpHeader(source, name); if (value != null) { diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java index db5164600c..4ab5c77a21 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/HttpProxyScenarioTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2022 the original author or authors. + * Copyright 2013-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,6 @@ import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; import org.springframework.web.context.request.RequestAttributes; @@ -129,7 +128,7 @@ public class HttpProxyScenarioTests { assertThat(httpHeaders.getFirst("If-Unmodified-Since")).isEqualTo(ifUnmodifiedSinceValue); assertThat(httpHeaders.getFirst("Connection")).isEqualTo("Keep-Alive"); - MultiValueMap responseHeaders = new LinkedMultiValueMap<>(httpHeaders); + HttpHeaders responseHeaders = HttpHeaders.copyOf(httpHeaders); responseHeaders.set("Connection", "close"); responseHeaders.set("Content-Disposition", contentDispositionValue); return new ResponseEntity<>(responseHeaders, HttpStatus.OK); @@ -190,7 +189,7 @@ public class HttpProxyScenarioTests { assertThat(((MultiValueMap) entity.getBody()).getFirst("foo")) .isEqualTo("foo".getBytes()); - MultiValueMap responseHeaders = new LinkedMultiValueMap<>(httpHeaders); + HttpHeaders responseHeaders = HttpHeaders.copyOf(httpHeaders); responseHeaders.set("Connection", "close"); responseHeaders.set("Content-Type", "text/plain"); return new ResponseEntity<>(responseHeaders, HttpStatus.OK); diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/CookieTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/CookieTests.java index 68852a6256..edbd5bbcd0 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/CookieTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/CookieTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,10 +78,10 @@ public class CookieTests { assertThat(br.readLine()).isNull(); br.close(); assertThat(allHeaders.size()).isEqualTo(3); - assertThat(allHeaders.get(0).containsKey("Cookie")).isFalse(); - assertThat(allHeaders.get(1).containsKey("Cookie")).isTrue(); + assertThat(allHeaders.get(0).containsHeader("Cookie")).isFalse(); + assertThat(allHeaders.get(1).containsHeader("Cookie")).isTrue(); assertThat(allHeaders.get(1).get("Cookie").get(0)).isEqualTo("JSESSIONID=X123"); - assertThat(allHeaders.get(2).containsKey("Cookie")).isTrue(); + assertThat(allHeaders.get(2).containsHeader("Cookie")).isTrue(); assertThat(allHeaders.get(2).get("Cookie").get(0)).isEqualTo("JSESSIONID=X124"); } @@ -92,7 +92,7 @@ public class CookieTests { public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) { return new ClientHttpRequest() { - private HttpHeaders headers = new HttpHeaders(); + private final HttpHeaders headers = new HttpHeaders(); public HttpHeaders getHeaders() { return headers; diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java index 33318a8522..86e7ce0a68 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.io.IOException; import java.io.Serializable; import java.net.URI; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; @@ -861,9 +860,9 @@ public class HttpRequestExecutingMessageHandlerTests { StepVerifier.create(httpHeadersSink.asMono()) .assertNext(headers -> - assertThat(headers) - .containsEntry(HttpHeaders.CONTENT_TYPE, - Arrays.asList(MediaType.APPLICATION_JSON_VALUE))) + assertThat(headers.headerSet()) + .contains(Map.entry(HttpHeaders.CONTENT_TYPE, + List.of(MediaType.APPLICATION_JSON_VALUE)))) .verifyComplete(); } diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageOutboundTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageOutboundTests.java index c5667f0251..7cfc4cc3fd 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageOutboundTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/support/DefaultHttpHeaderMapperFromMessageOutboundTests.java @@ -616,7 +616,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests { messageHeaders.put("abcdef", "abcdef-value"); HttpHeaders headers = new HttpHeaders(); mapper.fromHeaders(new MessageHeaders(messageHeaders), headers); - assertThat(headers).hasSize(3); + assertThat(headers.headerSet()).hasSize(3); assertThat(headers.get("1x")).isNull(); assertThat(headers.get("z1")).isNull(); assertThat(headers.get("abc")).isNull(); @@ -639,7 +639,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests { messageHeaders.put("Accept", "text/xml"); HttpHeaders headers = new HttpHeaders(); mapper.fromHeaders(new MessageHeaders(messageHeaders), headers); - assertThat(headers).hasSize(3); + assertThat(headers.headerSet()).hasSize(3); assertThat(headers.get("foobar")).hasSize(1); assertThat(headers.getFirst("foobar")).isEqualTo("abc"); assertThat(headers.getContentType().toString()).isEqualTo("text/html"); diff --git a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/inbound/StompInboundChannelAdapterWebSocketIntegrationTests.java b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/inbound/StompInboundChannelAdapterWebSocketIntegrationTests.java index 454024febe..afd078dc58 100644 --- a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/inbound/StompInboundChannelAdapterWebSocketIntegrationTests.java +++ b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/inbound/StompInboundChannelAdapterWebSocketIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerCo import org.springframework.web.socket.messaging.SessionSubscribeEvent; import org.springframework.web.socket.messaging.WebSocketStompClient; import org.springframework.web.socket.server.HandshakeInterceptor; -import org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy; +import org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy; import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.sockjs.client.SockJsClient; import org.springframework.web.socket.sockjs.client.WebSocketTransport; @@ -309,7 +309,7 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests { @Bean public DefaultHandshakeHandler handshakeHandler() { - return new DefaultHandshakeHandler(new TomcatRequestUpgradeStrategy()); + return new DefaultHandshakeHandler(new StandardWebSocketUpgradeStrategy()); } @Override diff --git a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/outbound/StompMessageHandlerWebSocketIntegrationTests.java b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/outbound/StompMessageHandlerWebSocketIntegrationTests.java index b81a705074..1eb1b16680 100644 --- a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/outbound/StompMessageHandlerWebSocketIntegrationTests.java +++ b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/outbound/StompMessageHandlerWebSocketIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBr import org.springframework.web.socket.config.annotation.StompEndpointRegistry; import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; import org.springframework.web.socket.messaging.WebSocketStompClient; -import org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy; +import org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy; import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.sockjs.client.SockJsClient; import org.springframework.web.socket.sockjs.client.WebSocketTransport; @@ -246,7 +246,7 @@ public class StompMessageHandlerWebSocketIntegrationTests { @Bean public DefaultHandshakeHandler handshakeHandler() { - return new DefaultHandshakeHandler(new TomcatRequestUpgradeStrategy()); + return new DefaultHandshakeHandler(new StandardWebSocketUpgradeStrategy()); } @Override diff --git a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/inbound/WebFluxInboundEndpoint.java b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/inbound/WebFluxInboundEndpoint.java index 8f83c82b5e..d41422e7ac 100644 --- a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/inbound/WebFluxInboundEndpoint.java +++ b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/inbound/WebFluxInboundEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the original author or authors. + * Copyright 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -384,8 +384,8 @@ public class WebFluxInboundEndpoint extends BaseHttpInboundEndpoint implements W org.springframework.http.HttpHeaders responseHeaders = exchange.getResponse().getHeaders(); if (!entityHeaders.isEmpty()) { - entityHeaders.entrySet().stream() - .filter(entry -> !responseHeaders.containsKey(entry.getKey())) + entityHeaders.headerSet().stream() + .filter(entry -> !responseHeaders.containsHeader(entry.getKey())) .forEach(entry -> responseHeaders.put(entry.getKey(), entry.getValue())); } diff --git a/spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java b/spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java index 1cfaba4502..aa5a54aa05 100644 --- a/spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java +++ b/spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 the original author or authors. + * Copyright 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,8 +100,8 @@ class WebFluxRequestExecutingMessageHandlerTests { void noContentLengthHeaderForGetMethod() { ClientHttpConnector httpConnector = new HttpHandlerConnector((request, response) -> { - assertThat(request.getHeaders()) - .doesNotContainKey(org.springframework.http.HttpHeaders.CONTENT_LENGTH); + assertThat(request.getHeaders().headerNames()) + .doesNotContain(org.springframework.http.HttpHeaders.CONTENT_LENGTH); response.setStatusCode(HttpStatus.OK); return Mono.defer(response::setComplete); }); diff --git a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java index 4f4f3efa3c..8e5665ca5b 100644 --- a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java +++ b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2024 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,7 +88,7 @@ import org.springframework.web.socket.messaging.SessionConnectedEvent; import org.springframework.web.socket.messaging.SessionSubscribeEvent; import org.springframework.web.socket.messaging.StompSubProtocolHandler; import org.springframework.web.socket.messaging.SubProtocolHandler; -import org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy; +import org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy; import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.sockjs.client.SockJsClient; import org.springframework.web.socket.sockjs.client.WebSocketTransport; @@ -473,7 +473,7 @@ public class StompIntegrationTests { @Bean public DefaultHandshakeHandler handshakeHandler() { - return new DefaultHandshakeHandler(new TomcatRequestUpgradeStrategy()); + return new DefaultHandshakeHandler(new StandardWebSocketUpgradeStrategy()); } @Override diff --git a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/dsl/WebSocketDslTests.java b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/dsl/WebSocketDslTests.java index b9731875f7..54c05ac911 100644 --- a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/dsl/WebSocketDslTests.java +++ b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/dsl/WebSocketDslTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024 the original author or authors. + * Copyright 2021-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.client.WebSocketClient; import org.springframework.web.socket.client.standard.StandardWebSocketClient; import org.springframework.web.socket.server.HandshakeHandler; -import org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy; +import org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy; import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import static org.assertj.core.api.Assertions.assertThat; @@ -155,7 +155,7 @@ public class WebSocketDslTests { @Bean public DefaultHandshakeHandler handshakeHandler() { - return new DefaultHandshakeHandler(new TomcatRequestUpgradeStrategy()); + return new DefaultHandshakeHandler(new StandardWebSocketUpgradeStrategy()); } } diff --git a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/server/WebSocketServerTests.java b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/server/WebSocketServerTests.java index a2efc74dad..69ecb650cf 100644 --- a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/server/WebSocketServerTests.java +++ b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/server/WebSocketServerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,7 +78,7 @@ import org.springframework.web.socket.handler.WebSocketHandlerDecoratorFactory; import org.springframework.web.socket.messaging.StompSubProtocolHandler; import org.springframework.web.socket.messaging.SubProtocolHandler; import org.springframework.web.socket.server.RequestUpgradeStrategy; -import org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy; +import org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy; import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.sockjs.client.SockJsClient; import org.springframework.web.socket.sockjs.client.WebSocketTransport; @@ -362,7 +362,7 @@ public class WebSocketServerTests { } - public static class MyTomcatRequestUpgradeStrategy extends TomcatRequestUpgradeStrategy implements Lifecycle { + public static class MyTomcatRequestUpgradeStrategy extends StandardWebSocketUpgradeStrategy implements Lifecycle { @Override public void start() {