You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Federico Mariani (Jira)" <ji...@apache.org> on 2022/08/01 13:02:00 UTC

[jira] [Created] (CAMEL-18331) Endpoint bean added via beans.xml are parsed twice

Federico Mariani created CAMEL-18331:
----------------------------------------

             Summary: Endpoint bean added via beans.xml are parsed twice
                 Key: CAMEL-18331
                 URL: https://issues.apache.org/jira/browse/CAMEL-18331
             Project: Camel
          Issue Type: Bug
          Components: camel-spring, camel-spring-boot
    Affects Versions: 3.18.0, 3.14.4, 3.19.0
            Reporter: Federico Mariani
            Assignee: Luigi De Masi
             Fix For: 3.18.1, 3.19.0
         Attachments: ref_reproducer.zip

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:
{code:java}
***************************
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 {code}

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



--
This message was sent by Atlassian Jira
(v8.20.10#820010)