Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18331

camel-spring-xml - <endpoint> bean added via beans.xml are parsed twice

    XMLWordPrintableJSON

Details

    • 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

      Attachments

        1. ref_reproducer.zip
          15.26 MB
          Federico Mariani

        Activity

          People

            ldemasi Luigi De Masi
            Federico Mariani Federico Mariani
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: