Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.6.0
-
None
-
Unknown
Description
DefaultConfigurerResolver uses a special fallback for configurer names containing the string CamelContext, that tries to resolve a configurer against ExtendedCamelContext FQCN, that usually results into a ExtendedCamelContextConfigurer.
In some cases this can lead to ClassCastException due to an explicit cast to ExtendedCamelContext in ExtendedCamelContextConfigurer.configure, for example when using PropertyBindingSupport.
Trying to to bind a target bean whose FQCN contains CamelContext (eg my.package.ClassNameWithCamelContextInside) fails with the following exception:
Caused by: java.lang.ClassCastException: class my.package.ClassNameWithCamelContextInside cannot be cast to class org.apache.camel.ExtendedCamelContext (my.package.ClassNameWithCamelContextInside and org.apache.camel.ExtendedCamelContext are in unnamed module of loader 'app') at org.apache.camel.impl.ExtendedCamelContextConfigurer.configure(ExtendedCamelContextConfigurer.java:94) at org.apache.camel.support.PropertyBindingSupport.setSimplePropertyViaConfigurer(PropertyBindingSupport.java:847)
The problem seems to be in the following snippet
if (name.contains("CamelContext")) { // fallback special for camel context itself as we have an extended configurer type = findConfigurer(ExtendedCamelContext.class.getName(), context); }
Attachments
Issue Links
- links to