diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index 136ac025bf7884..2c4b35a2937692 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -865,10 +865,15 @@ private void setupTcpHttpServer(HttpServer httpServer, HttpServerOptions options clearHttpProperty = true; schema = "http"; } - System.setProperty( - launchMode == LaunchMode.TEST ? "quarkus." + schema + ".test-port" - : "quarkus." + schema + ".port", - String.valueOf(actualPort)); + String portPropertyValue = String.valueOf(actualPort); + String portPropertyName = (launchMode == LaunchMode.TEST ? "quarkus." + schema + ".test-port" + : "quarkus." + schema + ".port"); + System.setProperty(portPropertyName, portPropertyValue); + if (launchMode.isDevOrTest()) { + // set the profile property as well to make sure we don't have any inconsistencies + System.setProperty("%" + launchMode.getDefaultProfile() + "." + portPropertyName, + portPropertyValue); + } // Set in HttpOptions to output the port in the Timing class options.setPort(actualPort); } diff --git a/integration-tests/spring-web/src/main/resources/application.properties b/integration-tests/spring-web/src/main/resources/application.properties index 3f44daa1d2e17d..24fb66ecc39d48 100644 --- a/integration-tests/spring-web/src/main/resources/application.properties +++ b/integration-tests/spring-web/src/main/resources/application.properties @@ -2,3 +2,4 @@ quarkus.security.users.file.enabled=true quarkus.security.users.file.users=test-users.properties quarkus.security.users.file.roles=test-roles.properties quarkus.security.users.file.plain-text=true +%test.quarkus.http.test-port=0