From 7f39ccc8e629835160ae7535fa8e77a50c3e687d Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Thu, 3 Oct 2024 16:01:24 +0300 Subject: [PATCH] Improve comment on why properties need to also be set in doStartup --- .../java/io/quarkus/deployment/steps/MainClassBuildStep.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java index 9b5a17a380853..94edce4e414e9 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java @@ -240,8 +240,9 @@ void build(List staticInitTasks, createAppCDS.returnValue(null); } - // very first thing is to set system props (for run time, which use substitutions for a different - // storage from build-time) + // Make sure we set properties in doStartup as well. This is necessary because setting them in the static-init + // sets them at build-time, on the host JVM, while SVM has substitutions for System. get/ setProperty at + // run-time which will never see those properties unless we also set them at run-time. for (SystemPropertyBuildItem i : properties) { mv.invokeStaticMethod(ofMethod(System.class, "setProperty", String.class, String.class, String.class), mv.load(i.getKey()), mv.load(i.getValue()));