Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.14.4, 3.18.0, 3.19.0
-
None
-
Unknown
Description
By declaring an endpoint inside a camel context and using it via the ref: component.
The application attached does not run and fail with the following error:
*************************** APPLICATION FAILED TO START *************************** Description: The bean 'foo' could not be registered. A bean with that name has already been defined and overriding is disabled. Action: Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
I noticed that
https://github.com/apache/camel/blob/05595854aadb81ccb408c1ca8c3c28c4dc835ec3/components/camel-spring-xml/src/main/java/org/apache/camel/spring/xml/handler/CamelNamespaceHandler.java#L748 <- adds the bean into the camel-context
and https://github.com/apache/camel/blob/05595854aadb81ccb408c1ca8c3c28c4dc835ec3/components/camel-spring-xml/src/main/java/org/apache/camel/spring/xml/handler/CamelNamespaceHandler.java#L757 <- add the bean again into the camel-context, therefore the duplicate bean