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


The following commit(s) were added to refs/heads/main by this push:
     new 45d560a  CAMEL-17569: camel-jbang and java-dsl: Support loading camel 
configuration classes, and servicies (BindToRegistry).
45d560a is described below

commit 45d560adc851e0a953cb40d026176873f83678f7
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Feb 2 07:00:08 2022 +0100

    CAMEL-17569: camel-jbang and java-dsl: Support loading camel configuration 
classes, and servicies (BindToRegistry).
---
 .../resources/archetype-resources/src/main/java/MyApplication.java | 7 +------
 .../archetype-resources/src/main/java/MyConfiguration.java         | 6 ++++--
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/archetypes/camel-archetype-main/src/main/resources/archetype-resources/src/main/java/MyApplication.java
 
b/archetypes/camel-archetype-main/src/main/resources/archetype-resources/src/main/java/MyApplication.java
index fca6f3f..2d4ad79 100644
--- 
a/archetypes/camel-archetype-main/src/main/resources/archetype-resources/src/main/java/MyApplication.java
+++ 
b/archetypes/camel-archetype-main/src/main/resources/archetype-resources/src/main/java/MyApplication.java
@@ -28,12 +28,7 @@ public final class MyApplication {
 
     public static void main(String[] args) throws Exception {
         // use Camels Main class
-        Main main = new Main();
-        // lets use a configuration class (you can specify multiple classes)
-        // (properties are automatic loaded from application.properties)
-        main.configure().addConfigurationClass(MyConfiguration.class);
-        // and add the routes (you can specify multiple classes)
-        main.configure().addRoutesBuilder(MyRouteBuilder.class);
+        Main main = new Main(MyApplication.class);
         // now keep the application running until the JVM is terminated (ctrl 
+ c or sigterm)
         main.run(args);
     }
diff --git 
a/archetypes/camel-archetype-main/src/main/resources/archetype-resources/src/main/java/MyConfiguration.java
 
b/archetypes/camel-archetype-main/src/main/resources/archetype-resources/src/main/java/MyConfiguration.java
index 1d48dee..f50e3db 100644
--- 
a/archetypes/camel-archetype-main/src/main/resources/archetype-resources/src/main/java/MyConfiguration.java
+++ 
b/archetypes/camel-archetype-main/src/main/resources/archetype-resources/src/main/java/MyConfiguration.java
@@ -17,12 +17,14 @@
 package ${package};
 
 import org.apache.camel.BindToRegistry;
+import org.apache.camel.CamelContext;
 import org.apache.camel.PropertyInject;
+import org.apache.camel.main.CamelConfiguration;
 
 /**
  * Class to configure the Camel application.
  */
-public class MyConfiguration {
+public class MyConfiguration implements CamelConfiguration {
 
     @BindToRegistry
     public MyBean myBean(@PropertyInject("hi") String hi, 
@PropertyInject("bye") String bye) {
@@ -30,7 +32,7 @@ public class MyConfiguration {
         return new MyBean(hi, bye);
     }
 
-    public void configure() {
+    public void configure(CamelContext camelContext) {
         // this method is optional and can be removed if no additional 
configuration is needed.
     }
 

Reply via email to