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 bfb44db37c85 CAMEL-23659: camel-main - Stub mode should ignore
property bindings for stubbed components (#23681)
bfb44db37c85 is described below
commit bfb44db37c858228be6e959eb4a78cef96d38fc2
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Jun 1 22:24:52 2026 +0200
CAMEL-23659: camel-main - Stub mode should ignore property bindings for
stubbed components (#23681)
Signed-off-by: Claus Ibsen <[email protected]>
Co-authored-by: Claude <[email protected]>
---
.../src/main/java/org/apache/camel/main/BaseMainSupport.java | 10 ++++++++--
.../src/main/java/org/apache/camel/main/MainHelper.java | 3 ++-
2 files changed, 10 insertions(+), 3 deletions(-)
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 ee3e97966cfb..f83a49000d27 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
@@ -2873,12 +2873,18 @@ public abstract class BaseMainSupport extends
BaseService {
}
for (Map.Entry<PropertyOptionKey, OrderedLocationProperties> entry :
properties.entrySet()) {
+ Object instance = entry.getKey().getInstance();
+ boolean failFast =
mainConfigurationProperties.isAutoConfigurationFailFast();
+ // stubbed components do not have the same properties as the
original component
+ if ("StubComponent".equals(instance.getClass().getSimpleName())) {
+ failFast = false;
+ }
setPropertiesOnTarget(
camelContext,
- entry.getKey().getInstance(),
+ instance,
entry.getValue(),
entry.getKey().getOptionPrefix(),
- mainConfigurationProperties.isAutoConfigurationFailFast(),
+ failFast,
true,
autoConfiguredProperties);
}
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java
b/core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java
index ef05d8e4b6a5..d22967d9706a 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java
@@ -376,8 +376,9 @@ public final class MainHelper {
if (failIfNotSet) {
// enrich the error with more precise details with option
prefix and key
+ Throwable cause = e.getCause() != null ? e.getCause() : e;
throw new PropertyBindingException(
- e.getTarget(), e.getPropertyName(), e.getValue(),
optionPrefix, key, e.getCause());
+ e.getTarget(), e.getPropertyName(), e.getValue(),
optionPrefix, key, cause);
} else {
LOG.debug(
"Error configuring property ({}) with name: {}) on
bean: {} with value: {}. This exception is ignored as failIfNotSet=false.",