CAMEL-14272: Configuring endpoint with bean reference should fail if no such bean found when using source code generated configurer.
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/component/PropertyConfigurerSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/component/PropertyConfigurerSupport.java
index bf5f772..4cdc655 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/component/PropertyConfigurerSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/component/PropertyConfigurerSupport.java
@@ -17,6 +17,7 @@
package org.apache.camel.support.component;
import org.apache.camel.CamelContext;
+import org.apache.camel.NoSuchBeanException;
/**
* Base class used by the camel-apt compiler plugin when it generates source code for fast
@@ -43,6 +44,9 @@
Object obj = camelContext.getRegistry().lookupByName(ref);
if (obj != null) {
value = obj;
+ } else {
+ // no bean found so throw an exception
+ throw new NoSuchBeanException(ref, type.getName());
}
}
}