[ https://issues.apache.org/jira/browse/CAMEL-18331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on CAMEL-18331 started by Luigi De Masi. --------------------------------------------- > 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.14.4, 3.18.0, 3.19.0 > Reporter: Federico Mariani > Assignee: Luigi De Masi > Priority: Major > 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)