CAMEL-15270: camel-main can configure route templates from properties files.
diff --git a/examples/camel-example-routetemplate/readme.adoc b/examples/camel-example-routetemplate/readme.adoc
index 3cb8476..9d14ad5 100644
--- a/examples/camel-example-routetemplate/readme.adoc
+++ b/examples/camel-example-routetemplate/readme.adoc
@@ -4,7 +4,11 @@
which can be used for creating and adding new routes via parameters.
The route template is defined via Java or XML DSL (RouteBuilder) in the `MyRouteTemplates.java` source file.
-The `MyConfiguration.java` is used to create two routes from the template using different set of parameters.
+
+The `application.properties` is used to create two routes from the template using different set of parameters.
+
+An alternative to create routes is from Java which is done in the `MyConfiguration.java` class.
+See the `MyApplication.java` where you can change the source to use java instead of property file for the template parameters.
The example runs standalone via Camel Main in the `MyApplication.java` source file.
diff --git a/examples/camel-example-routetemplate/src/main/java/org/apache/camel/example/MyApplication.java b/examples/camel-example-routetemplate/src/main/java/org/apache/camel/example/MyApplication.java
index 955b0a2..6b9e4f4 100644
--- a/examples/camel-example-routetemplate/src/main/java/org/apache/camel/example/MyApplication.java
+++ b/examples/camel-example-routetemplate/src/main/java/org/apache/camel/example/MyApplication.java
@@ -32,7 +32,16 @@
// and add route templates via routes builder
main.configure().addRoutesBuilder(MyRouteTemplates.class);
// add configuration class which setup the routes from the route templates
- main.configure().addConfigurationClass(MyConfiguration.class);
+
+ // to configure route templates we can use java code as below from a configuration class,
+ // gives more power as its java code.
+ // or we can configure as well from application.properties,
+ // less power as its key value pair properties
+ // and you can also use both java and properties together
+
+ // in this example we use properties by default and have disabled java
+ // main.configure().addConfigurationClass(MyConfiguration.class);
+
// now keep the application running until the JVM is terminated (ctrl + c or sigterm)
main.run(args);
}
diff --git a/examples/camel-example-routetemplate/src/main/resources/application.properties b/examples/camel-example-routetemplate/src/main/resources/application.properties
index df19913..52fc3fd 100644
--- a/examples/camel-example-routetemplate/src/main/resources/application.properties
+++ b/examples/camel-example-routetemplate/src/main/resources/application.properties
@@ -19,6 +19,15 @@
# here you can configure options on camel main (see MainConfigurationProperties class)
camel.main.name = MyCoolCamel
+# create routes from the route template
+# this can also be done in Java code, see MyConfiguration.java
+camel.route-template[0].template-id = myTemplate
+camel.route-template[0].name = one
+camel.route-template[0].greeting = Hello
+camel.route-template[1].template-id = myTemplate
+camel.route-template[1].name = two
+camel.route-template[1].greeting = Bonjour
+camel.route-template[1].my-period = 5s
# application properties
hi = Hello