diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupportModelConfigurer.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupportModelConfigurer.java index 31d2ae28d9b32..f2f23ef642acf 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupportModelConfigurer.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupportModelConfigurer.java @@ -101,6 +101,10 @@ static void setVariableProperties( id = "route"; key = key.substring(6); key = StringHelper.replaceFirst(key, ".", ":"); + } else if (key.startsWith("global.")) { + id = "global"; + key = key.substring(7); + key = StringHelper.replaceFirst(key, ".", ":"); } VariableRepository repo = camelContext.getCamelContextExtension().getContextPlugin(VariableRepositoryFactory.class) .getVariableRepository(id); diff --git a/core/camel-main/src/test/java/org/apache/camel/main/MainVariableTest.java b/core/camel-main/src/test/java/org/apache/camel/main/MainVariableTest.java index 1202db74721f6..40a1fd0fbb8e2 100644 --- a/core/camel-main/src/test/java/org/apache/camel/main/MainVariableTest.java +++ b/core/camel-main/src/test/java/org/apache/camel/main/MainVariableTest.java @@ -31,7 +31,7 @@ public class MainVariableTest { public void testMainVariableParameters() throws Exception { Main main = new Main(); - main.addInitialProperty("camel.variable.global:greeting", "Random number"); + main.addInitialProperty("camel.variable.global.greeting", "Random number"); // global is default main.addInitialProperty("camel.variable.random", "999");