This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.18.x by this push:
     new a89f0ab6fd7 camel-jbang - Export should not fail fast due to stub 
component is shadowing the actual component which then cannot be auto 
configured.
a89f0ab6fd7 is described below

commit a89f0ab6fd78a8ebe39f1f78e1badaaa1d494af3
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Jul 27 07:49:50 2022 +0200

    camel-jbang - Export should not fail fast due to stub component is 
shadowing the actual component which then cannot be auto configured.
---
 .../src/main/java/org/apache/camel/main/KameletMain.java            | 6 ++----
 .../camel/main/download/DependencyDownloaderComponentResolver.java  | 6 ++++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index 17f8d4552cd..98f1eb87296 100644
--- 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++ 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -286,6 +286,8 @@ public class KameletMain extends MainCommandLineSupport {
         if (stub) {
             // turn off auto-wiring when running in stub mode
             mainConfigurationProperties.setAutowiredEnabled(false);
+            // and turn off fail fast as we stub components
+            mainConfigurationProperties.setAutoConfigurationFailFast(false);
         }
 
         String info = startupInfo();
@@ -413,10 +415,6 @@ public class KameletMain extends MainCommandLineSupport {
         addInitialProperty("camel.component.kamelet.location", location);
         addInitialProperty("camel.component.rest.consumerComponentName", 
"platform-http");
         addInitialProperty("camel.component.rest.producerComponentName", 
"vertx-http");
-        if (stub) {
-            // enable shadow mode on stub component
-            addInitialProperty("camel.component.stub.shadow", "true");
-        }
     }
 
     protected String startupInfo() {
diff --git 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/DependencyDownloaderComponentResolver.java
 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/DependencyDownloaderComponentResolver.java
index dce226fb808..6e405da6ae7 100644
--- 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/DependencyDownloaderComponentResolver.java
+++ 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/download/DependencyDownloaderComponentResolver.java
@@ -23,6 +23,7 @@ import org.apache.camel.Component;
 import org.apache.camel.catalog.CamelCatalog;
 import org.apache.camel.catalog.DefaultCamelCatalog;
 import org.apache.camel.component.platform.http.PlatformHttpComponent;
+import org.apache.camel.component.stub.StubComponent;
 import org.apache.camel.impl.engine.DefaultComponentResolver;
 import org.apache.camel.main.http.VertxHttpServer;
 import org.apache.camel.main.util.SuggestSimilarHelper;
@@ -62,6 +63,11 @@ public final class DependencyDownloaderComponentResolver 
extends DefaultComponen
         } else {
             answer = super.resolveComponent("stub", context);
         }
+        if (stub && answer instanceof StubComponent) {
+            StubComponent sc = (StubComponent) answer;
+            // enable shadow mode on stub component
+            sc.setShadow(true);
+        }
         if (answer instanceof PlatformHttpComponent) {
             // setup a default http server on port 8080 if not already done
             VertxHttpServer.setPlatformHttpComponent((PlatformHttpComponent) 
answer);

Reply via email to