This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch hv in repository https://gitbox.apache.org/repos/asf/camel.git
commit b0b1fe08fa145572409562b019ee02ae68c5a24b Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Dec 17 12:49:06 2024 +0100 CAMEL-21553: camel-jbang - Should init vault eager before routes with modeline that has custom beans. --- .../vault/HashicorpVaultPropertiesFunction.java | 3 ++- .../java/org/apache/camel/main/BaseMainSupport.java | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java index d5d41101ea9..d4efea00e33 100644 --- a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java +++ b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java @@ -184,7 +184,8 @@ public class HashicorpVaultPropertiesFunction extends ServiceSupport implements try { returnValue = getSecretFromSource(key, subkey, defaultValue, version); } catch (Exception e) { - throw new RuntimeCamelException("Something went wrong while recovering " + key + " from vault"); + throw new RuntimeCamelException( + "Error getting secret from vault using key: " + key + " due to: " + e.getMessage(), e); } } diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java index e10ca74ef01..e65778b347b 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java @@ -539,15 +539,6 @@ public abstract class BaseMainSupport extends BaseService { }); recorder.endStep(step); - if (mainConfigurationProperties.isModeline()) { - camelContext.setModeline(true); - } - // eager load properties from modeline by scanning DSL sources and gather properties for auto configuration - // also load other non-route related configuration (e.g., beans) - step = recorder.beginStep(BaseMainSupport.class, "modelineRoutes", "Auto Configure"); - modelineRoutes(camelContext); - recorder.endStep(step); - step = recorder.beginStep(BaseMainSupport.class, "autoConfigurationMainConfiguration", "Auto Configure"); autoConfigurationMainConfiguration(camelContext, mainConfigurationProperties, autoConfiguredProperties); recorder.endStep(step); @@ -566,6 +557,17 @@ public abstract class BaseMainSupport extends BaseService { doConfigureCamelContextFromMainConfiguration(camelContext, mainConfigurationProperties, autoConfiguredProperties); recorder.endStep(step); + if (mainConfigurationProperties.isAutoConfigurationEnabled()) { + if (mainConfigurationProperties.isModeline()) { + camelContext.setModeline(true); + } + // eager load properties from modeline by scanning DSL sources and gather properties for auto configuration + // also load other non-route related configuration (e.g., beans) + step = recorder.beginStep(BaseMainSupport.class, "modelineRoutes", "Auto Configure"); + modelineRoutes(camelContext); + recorder.endStep(step); + } + // try to load custom beans/configuration classes via package scanning step = recorder.beginStep(BaseMainSupport.class, "configurePackageScan", "Auto Configure"); configurePackageScan(camelContext);