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-examples.git
The following commit(s) were added to refs/heads/main by this push:
new 7d81cec CAMEL-17575: main examples - even easier
7d81cec is described below
commit 7d81cec1a199c9be4262502244a433dbf108457f
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Feb 5 09:50:09 2022 +0100
CAMEL-17575: main examples - even easier
---
.../src/main/java/org/apache/camel/example/MyApplication.java | 6 +-----
.../src/main/java/org/apache/camel/example/MyConfiguration.java | 5 +++--
examples/main-lambda/src/main/resources/application.properties | 4 ++--
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git
a/examples/main-lambda/src/main/java/org/apache/camel/example/MyApplication.java
b/examples/main-lambda/src/main/java/org/apache/camel/example/MyApplication.java
index 3646957..31197dc 100644
---
a/examples/main-lambda/src/main/java/org/apache/camel/example/MyApplication.java
+++
b/examples/main-lambda/src/main/java/org/apache/camel/example/MyApplication.java
@@ -28,11 +28,7 @@ public final class MyApplication {
public static void main(String[] args) throws Exception {
// use Camels Main class
- Main main = new Main();
- // let's use a configuration class (you can specify multiple classes)
- // (properties are automatic loaded from application.properties)
- // the configuration class has the configuration and also the routes
to be used
- main.configure().addConfiguration(MyConfiguration.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/examples/main-lambda/src/main/java/org/apache/camel/example/MyConfiguration.java
b/examples/main-lambda/src/main/java/org/apache/camel/example/MyConfiguration.java
index f5dd990..aa1d61a 100644
---
a/examples/main-lambda/src/main/java/org/apache/camel/example/MyConfiguration.java
+++
b/examples/main-lambda/src/main/java/org/apache/camel/example/MyConfiguration.java
@@ -17,14 +17,15 @@
package org.apache.camel.example;
import org.apache.camel.BindToRegistry;
+import org.apache.camel.Configuration;
import org.apache.camel.PropertyInject;
import org.apache.camel.builder.LambdaRouteBuilder;
-import org.apache.camel.CamelConfiguration;
/**
* Class to configure the Camel application.
*/
-public class MyConfiguration implements CamelConfiguration {
+@Configuration
+public class MyConfiguration {
@BindToRegistry
public MyBean myBean(@PropertyInject("hi") String hi,
@PropertyInject("bye") String bye) {
diff --git a/examples/main-lambda/src/main/resources/application.properties
b/examples/main-lambda/src/main/resources/application.properties
index 6781126..6335cf3 100644
--- a/examples/main-lambda/src/main/resources/application.properties
+++ b/examples/main-lambda/src/main/resources/application.properties
@@ -15,8 +15,8 @@
## limitations under the License.
## ---------------------------------------------------------------------------
-# to configure camel main
-# here you can configure options on camel main (see
MainConfigurationProperties class)
+# here you can configure options on camel main
+# https://camel.apache.org/components/next/others/main.html
camel.main.name = MyCoolCamel
# extended runtime statistics about bean introspection usage (java reflection)