This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 72dcb90f8a862f6cfeb8cd4a67f86c788bcc9ab6 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Mar 19 08:36:41 2022 +0100 CAMEL-17815: camel-jbang - In modeline mode then eager discover routes and pre-load modeline to allow properties to be used during bootstrap. --- .../dsl/yaml/IntegrationConfigurationPropertiesSource.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/IntegrationConfigurationPropertiesSource.java b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/IntegrationConfigurationPropertiesSource.java index b420507..14d270f 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/IntegrationConfigurationPropertiesSource.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/IntegrationConfigurationPropertiesSource.java @@ -63,7 +63,7 @@ public class IntegrationConfigurationPropertiesSource implements PropertiesSourc if (line.contains("=")) { String key = StringHelper.before(line, "=").trim(); String value = StringHelper.after(line, "=").trim(); - properties.setProperty(key, value); + setProperty(key, value); } else { if (ResourceHelper.hasScheme(line)) { // it is a properties file so load resource @@ -74,7 +74,7 @@ public class IntegrationConfigurationPropertiesSource implements PropertiesSourc String v = prop.getProperty(k); String key = k.trim(); String value = v.trim(); - properties.setProperty(key, value); + setProperty(key, value); } } catch (Exception e) { // ignore @@ -83,6 +83,14 @@ public class IntegrationConfigurationPropertiesSource implements PropertiesSourc } } + protected void setProperty(String key, String value) { + properties.setProperty(key, value); + if (!camelContext.isStarted()) { + // if we are bootstrapping then also set as initial property, so it can be used there as well + camelContext.getPropertiesComponent().addInitialProperty(key, value); + } + } + @Override public String toString() { return "camel-yaml-dsl";