This is an automated email from the ASF dual-hosted git repository.

Croway pushed a commit to branch camel-spring-boot-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git

commit d8e158113a5dfe66bce11d8a618950120c8bb895
Author: Croway <[email protected]>
AuthorDate: Mon May 4 17:23:22 2026 +0200

    chore: use WebAsyncTask, fix @LocalServerPort, revert generated file
---
 .../PlatformHttpComponentAutoConfiguration.java    |  9 ++++-----
 .../springboot/SpringBootPlatformHttpConsumer.java | 22 +++++++++++++++++-----
 .../springboot/PlatformHttpBinaryUploadTest.java   | 10 +++++-----
 .../http/springboot/PlatformHttpStreamingTest.java | 10 +++++-----
 .../SpringBootPlatformHttpBridgedEndpointTest.java | 10 +++++-----
 ...pringBootPlatformHttpCamelIntegrationsTest.java | 10 +++++-----
 .../SpringBootPlatformHttpCertificationTest.java   | 10 +++++-----
 .../SpringBootPlatformHttpContextPathTest.java     | 10 +++++-----
 .../SpringBootPlatformHttpCookiesTest.java         | 10 +++++-----
 .../SpringBootPlatformHttpCorsCredentialsTest.java | 10 +++++-----
 .../springboot/SpringBootPlatformHttpCorsTest.java | 10 +++++-----
 .../SpringBootPlatformHttpEngineTest.java          | 10 +++++-----
 ...ngBootPlatformHttpHeaderFilterStrategyTest.java | 10 +++++-----
 ...SpringBootPlatformHttpJacksonConverterTest.java | 10 +++++-----
 .../SpringBootPlatformHttpOptionsTest.java         | 10 +++++-----
 .../SpringBootPlatformHttpProxyTest.java           | 10 +++++-----
 .../SpringBootPlatformHttpResponseCodeTest.java    | 10 +++++-----
 ...atformHttpServerRequestValidationFalseTest.java | 10 +++++-----
 ...latformHttpServerRequestValidationTrueTest.java | 10 +++++-----
 .../SpringBootPlatformHttpSessionTest.java         | 10 +++++-----
 .../SpringBootPlatformHttpTypeConverterTest.java   | 10 +++++-----
 .../SpringBootPlatformHttpValidationTest.java      | 10 +++++-----
 22 files changed, 121 insertions(+), 110 deletions(-)

diff --git 
a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/PlatformHttpComponentAutoConfiguration.java
 
b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/PlatformHttpComponentAutoConfiguration.java
index f007401dea6..36fc0bcb4db 100644
--- 
a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/PlatformHttpComponentAutoConfiguration.java
+++ 
b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/PlatformHttpComponentAutoConfiguration.java
@@ -33,7 +33,6 @@ import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.beans.factory.ObjectProvider;
 import org.springframework.context.annotation.Lazy;
 
 /**
@@ -48,13 +47,13 @@ public class PlatformHttpComponentAutoConfiguration {
 
     @Autowired
     private ApplicationContext applicationContext;
-    private final ObjectProvider<CamelContext> camelContextProvider;
+    private final CamelContext camelContext;
     @Autowired
     private PlatformHttpComponentConfiguration configuration;
 
     public PlatformHttpComponentAutoConfiguration(
-            ObjectProvider<CamelContext> camelContextProvider) {
-        this.camelContextProvider = camelContextProvider;
+            org.apache.camel.CamelContext camelContext) {
+        this.camelContext = camelContext;
     }
 
     @Lazy
@@ -63,7 +62,7 @@ public class PlatformHttpComponentAutoConfiguration {
         return new ComponentCustomizer() {
             @Override
             public void configure(String name, Component target) {
-                
CamelPropertiesHelper.copyProperties(camelContextProvider.getObject(), 
configuration, target);
+                CamelPropertiesHelper.copyProperties(camelContext, 
configuration, target);
             }
             @Override
             public boolean isEnabled(String name, Component target) {
diff --git 
a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpConsumer.java
 
b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpConsumer.java
index 14325b4a5ba..9d9f5189294 100644
--- 
a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpConsumer.java
+++ 
b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpConsumer.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.platform.http.springboot;
 
-import java.util.concurrent.Callable;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 
@@ -40,8 +39,11 @@ import org.apache.camel.http.common.HttpHelper;
 import org.apache.camel.support.DefaultConsumer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.task.AsyncTaskExecutor;
+import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
 import org.springframework.web.bind.annotation.CookieValue;
 import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.context.request.async.WebAsyncTask;
 
 public class SpringBootPlatformHttpConsumer extends DefaultConsumer implements 
PlatformHttpConsumer, Suspendable, SuspendableService {
 
@@ -84,11 +86,14 @@ public class SpringBootPlatformHttpConsumer extends 
DefaultConsumer implements P
     /**
      * This method is invoked by Spring Boot when invoking Camel via 
platform-http.
      *
-     * Returns a Callable to integrate with Spring MVC async request lifecycle.
+     * Returns a WebAsyncTask to integrate with Spring MVC async lifecycle 
while preserving the custom executor.
      */
     @ResponseBody
-    public Callable<Void> service(HttpServletRequest request, 
HttpServletResponse response) {
-        return () -> {
+    public WebAsyncTask<Void> service(HttpServletRequest request, 
HttpServletResponse response) {
+        AsyncTaskExecutor asyncExecutor = (executor instanceof 
AsyncTaskExecutor ate)
+                ? ate
+                : new ConcurrentTaskExecutor(executor);
+        WebAsyncTask<Void> task = new WebAsyncTask<>(null, asyncExecutor, () 
-> {
             LOG.trace("Service: {}", request);
             try {
                 handleService(request, response);
@@ -104,7 +109,14 @@ public class SpringBootPlatformHttpConsumer extends 
DefaultConsumer implements P
                 }
             }
             return null;
-        };
+        });
+        task.onTimeout(() -> {
+            if (!response.isCommitted()) {
+                response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+            }
+            return null;
+        });
+        return task;
     }
 
     protected void handleService(HttpServletRequest request, 
HttpServletResponse response) throws Exception {
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/PlatformHttpBinaryUploadTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/PlatformHttpBinaryUploadTest.java
index b01b2f7ca11..0688d090317 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/PlatformHttpBinaryUploadTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/PlatformHttpBinaryUploadTest.java
@@ -26,7 +26,8 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import 
org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -56,9 +57,8 @@ public class PlatformHttpBinaryUploadTest {
 
     static final String FILE_NAME = "example.pdf";
     static Path uploadDir;
-
-    @LocalServerPort
-    private int port;
+    @Autowired
+    private Environment environment;
 
     @BeforeAll
     public static void createUploadDir() throws IOException {
@@ -73,7 +73,7 @@ public class PlatformHttpBinaryUploadTest {
 
     @BeforeEach
     public void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Test
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/PlatformHttpStreamingTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/PlatformHttpStreamingTest.java
index 056292714b9..8bafaa663bd 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/PlatformHttpStreamingTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/PlatformHttpStreamingTest.java
@@ -28,7 +28,8 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -52,13 +53,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
         SpringBootPlatformHttpTest.class, 
PlatformHttpStreamingTest.TestConfiguration.class,
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class })
 public class PlatformHttpStreamingTest {
-
-    @LocalServerPort
-    private int port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     public void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Test
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBridgedEndpointTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBridgedEndpointTest.java
index 003f44a548d..2b6a6747224 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBridgedEndpointTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpBridgedEndpointTest.java
@@ -29,7 +29,8 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.wiremock.spring.ConfigureWireMock;
@@ -46,9 +47,8 @@ import static org.hamcrest.Matchers.containsString;
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class, 
HttpComponentAutoConfiguration.class})
 @EnableWireMock(@ConfigureWireMock(portProperties = "customPort"))
 public class SpringBootPlatformHttpBridgedEndpointTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
@@ -83,7 +83,7 @@ public class SpringBootPlatformHttpBridgedEndpointTest {
 
     @Test
     public void bridgedEndpointTest() {
-        final var proxyURI = "http://localhost:%s/mock".formatted(port);
+        final var proxyURI = 
"http://localhost:%s/mock".formatted(Integer.parseInt(environment.getRequiredProperty("local.server.port")));
 
         given()
                 .contentType(ContentType.JSON)
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCamelIntegrationsTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCamelIntegrationsTest.java
index 0cf28e0c0e6..a56f78da738 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCamelIntegrationsTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCamelIntegrationsTest.java
@@ -30,7 +30,8 @@ import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2Clien
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -48,13 +49,12 @@ public class SpringBootPlatformHttpCamelIntegrationsTest {
 
     @Autowired
     CamelContext camelContext;
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Configuration
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCertificationTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCertificationTest.java
index 261d62dba88..2cdf80546f5 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCertificationTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCertificationTest.java
@@ -54,7 +54,8 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -73,13 +74,12 @@ public class SpringBootPlatformHttpCertificationTest 
extends PlatformHttpBase {
 
     private static final String postRouteId = 
"SpringBootPlatformHttpRestDSLTest_mypost";
     private static final String getRouteId = 
"SpringBootPlatformHttpRestDSLTest_myget";
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Configuration
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpContextPathTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpContextPathTest.java
index d1c139008c8..f3bd0760c6f 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpContextPathTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpContextPathTest.java
@@ -26,7 +26,8 @@ import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import 
org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -44,13 +45,12 @@ import static org.hamcrest.Matchers.equalTo;
                 SpringBootPlatformHttpAutoConfiguration.class },
         properties = { "server.servlet.context-path=/test", 
"camel.rest.context-path=/api" })
 public class SpringBootPlatformHttpContextPathTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Configuration
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCookiesTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCookiesTest.java
index 0708967e6e7..7a67753b5f0 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCookiesTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCookiesTest.java
@@ -34,7 +34,8 @@ import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2Clien
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -56,13 +57,12 @@ public class SpringBootPlatformHttpCookiesTest {
 
     @Autowired
     CamelContext camelContext;
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Configuration
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCorsCredentialsTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCorsCredentialsTest.java
index 7ec0a7383ac..08acb76bc80 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCorsCredentialsTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCorsCredentialsTest.java
@@ -27,7 +27,8 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -40,13 +41,12 @@ import static org.hamcrest.Matchers.*;
         SpringBootPlatformHttpCorsCredentialsTest.class, 
SpringBootPlatformHttpCorsCredentialsTest.TestConfiguration.class,
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class, })
 public class SpringBootPlatformHttpCorsCredentialsTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
     }
 
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCorsTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCorsTest.java
index 8cc096efd5b..eac284291e0 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCorsTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpCorsTest.java
@@ -27,7 +27,8 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -42,13 +43,12 @@ import static org.hamcrest.Matchers.not;
         SpringBootPlatformHttpCorsTest.class, 
SpringBootPlatformHttpCorsTest.TestConfiguration.class,
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class, })
 public class SpringBootPlatformHttpCorsTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
     }
 
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpEngineTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpEngineTest.java
index c90ae75d25c..c407ba4277f 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpEngineTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpEngineTest.java
@@ -34,7 +34,8 @@ import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2Clien
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -66,13 +67,12 @@ public class SpringBootPlatformHttpEngineTest {
 
     @Autowired
     CamelContext camelContext;
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     private static final List<String> attachmentIds = new ArrayList<>();
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpHeaderFilterStrategyTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpHeaderFilterStrategyTest.java
index 388eef956dd..48decc1e71a 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpHeaderFilterStrategyTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpHeaderFilterStrategyTest.java
@@ -25,7 +25,8 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import 
org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -41,13 +42,12 @@ import static org.hamcrest.Matchers.equalTo;
         SpringBootPlatformHttpHeaderFilterStrategyTest.TestConfiguration.class,
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class })
 public class SpringBootPlatformHttpHeaderFilterStrategyTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Test
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpJacksonConverterTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpJacksonConverterTest.java
index bf369ad8f44..d9703d77d62 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpJacksonConverterTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpJacksonConverterTest.java
@@ -30,7 +30,8 @@ import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2Clien
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -49,13 +50,12 @@ public class SpringBootPlatformHttpJacksonConverterTest {
 
     @Autowired
     CamelContext camelContext;
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Configuration
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpOptionsTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpOptionsTest.java
index 086b158a904..cdce798712e 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpOptionsTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpOptionsTest.java
@@ -26,7 +26,8 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -39,13 +40,12 @@ import static org.hamcrest.Matchers.*;
         SpringBootPlatformHttpOptionsTest.class, 
SpringBootPlatformHttpOptionsTest.TestConfiguration.class,
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class, })
 public class SpringBootPlatformHttpOptionsTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
     }
 
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpProxyTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpProxyTest.java
index 056c3fe37f2..c0b59e7bc20 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpProxyTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpProxyTest.java
@@ -33,7 +33,8 @@ import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2Clien
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.wiremock.spring.ConfigureWireMock;
@@ -59,13 +60,12 @@ public class SpringBootPlatformHttpProxyTest {
 
     @Autowired
     CamelContext camelContext;
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
         WireMock.stubFor(get(urlPathEqualTo("/"))
                 .willReturn(aResponse()
                         .withBody(
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpResponseCodeTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpResponseCodeTest.java
index d2d4faff884..30ae935addc 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpResponseCodeTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpResponseCodeTest.java
@@ -25,7 +25,8 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import 
org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -41,13 +42,12 @@ import static org.hamcrest.Matchers.equalTo;
         SpringBootPlatformHttpResponseCodeTest.TestConfiguration.class,
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class })
 public class SpringBootPlatformHttpResponseCodeTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Test
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpServerRequestValidationFalseTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpServerRequestValidationFalseTest.java
index daed19ea36b..30cbe093200 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpServerRequestValidationFalseTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpServerRequestValidationFalseTest.java
@@ -27,7 +27,8 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -40,13 +41,12 @@ import static org.hamcrest.Matchers.is;
         SpringBootPlatformHttpServerRequestValidationFalseTest.class, 
SpringBootPlatformHttpServerRequestValidationFalseTest.TestConfiguration.class,
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class,})
 public class SpringBootPlatformHttpServerRequestValidationFalseTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     // *************************************
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpServerRequestValidationTrueTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpServerRequestValidationTrueTest.java
index 0f9c6a68d8a..a2842c25ff7 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpServerRequestValidationTrueTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpServerRequestValidationTrueTest.java
@@ -27,7 +27,8 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration;
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -40,13 +41,12 @@ import static org.hamcrest.Matchers.is;
         SpringBootPlatformHttpServerRequestValidationTrueTest.class, 
SpringBootPlatformHttpServerRequestValidationTrueTest.TestConfiguration.class,
         PlatformHttpComponentAutoConfiguration.class, 
SpringBootPlatformHttpAutoConfiguration.class,})
 public class SpringBootPlatformHttpServerRequestValidationTrueTest {
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     // *************************************
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpSessionTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpSessionTest.java
index b52e764dcb4..42480030c56 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpSessionTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpSessionTest.java
@@ -31,7 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.security.config.Customizer;
@@ -57,13 +58,12 @@ public class SpringBootPlatformHttpSessionTest {
 
     @Autowired
     CamelContext camelContext;
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Configuration
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpTypeConverterTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpTypeConverterTest.java
index 66cf1def32a..eb05d26c7e5 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpTypeConverterTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpTypeConverterTest.java
@@ -29,7 +29,8 @@ import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2Clien
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -54,13 +55,12 @@ public class SpringBootPlatformHttpTypeConverterTest {
 
     @Autowired
     CamelContext camelContext;
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Configuration
diff --git 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpValidationTest.java
 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpValidationTest.java
index 9418e9a376b..e6b3d27d09e 100644
--- 
a/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpValidationTest.java
+++ 
b/components-starter/camel-platform-http-starter/src/test/java/org/apache/camel/component/platform/http/springboot/SpringBootPlatformHttpValidationTest.java
@@ -35,7 +35,8 @@ import 
org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2Clien
 import 
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -58,13 +59,12 @@ public class SpringBootPlatformHttpValidationTest {
 
     @Autowired
     CamelContext camelContext;
-
-    @LocalServerPort
-    private Integer port;
+    @Autowired
+    private Environment environment;
 
     @BeforeEach
     void setUp() {
-        RestAssured.port = port;
+        RestAssured.port = 
Integer.parseInt(environment.getRequiredProperty("local.server.port"));
     }
 
     @Configuration


Reply via email to