Return-Path: Delivered-To: apmail-activemq-camel-dev-archive@locus.apache.org Received: (qmail 77262 invoked from network); 25 Sep 2007 14:59:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Sep 2007 14:59:47 -0000 Received: (qmail 13963 invoked by uid 500); 25 Sep 2007 14:59:38 -0000 Delivered-To: apmail-activemq-camel-dev-archive@activemq.apache.org Received: (qmail 13942 invoked by uid 500); 25 Sep 2007 14:59:37 -0000 Mailing-List: contact camel-dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-dev@activemq.apache.org Delivered-To: mailing list camel-dev@activemq.apache.org Received: (qmail 13933 invoked by uid 99); 25 Sep 2007 14:59:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Sep 2007 07:59:37 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Sep 2007 15:02:00 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CF6F07141F2 for ; Tue, 25 Sep 2007 07:59:23 -0700 (PDT) Message-ID: <9221975.1190732363845.JavaMail.jira@brutus> Date: Tue, 25 Sep 2007 07:59:23 -0700 (PDT) From: "Hadrian Zbarcea (JIRA)" To: camel-dev@activemq.apache.org Subject: [jira] Assigned: (CAMEL-154) Improper wiring of camel context using Spring In-Reply-To: <2351959.1190644403593.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/CAMEL-154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hadrian Zbarcea reassigned CAMEL-154: ------------------------------------- Assignee: Hadrian Zbarcea > Improper wiring of camel context using Spring > --------------------------------------------- > > Key: CAMEL-154 > URL: https://issues.apache.org/activemq/browse/CAMEL-154 > Project: Apache Camel > Issue Type: Bug > Components: camel-spring > Affects Versions: 1.2.0 > Reporter: Hadrian Zbarcea > Assignee: Hadrian Zbarcea > > When using spring to wire camel components, the whole magic is driven by org.springframework.context.support.AbstractApplicationContext.refresh(). > At about line 327 the xml file is read and at some point AbstractApplicationContext.doParse is called. What is notable is that we use parseUsingJaxb (line 135) instead of the spring way of doing things, and then we still use > BeanDefinitionParser(s) to build the BeanDefinition(s). > On a sample context definition like the one in the unit tests: > > > > > > > > > > The jaxb parser instantiates the BeanPostProcessor, endpoints, the RouteType, From/ToTypes properly, but the BeanPostProcessor is not injected with the camelContext and applicationContext, obviously. > Later on in AbstractApplicationContext.refresh() during the registerBeanPostProcessors() call (line 337) spring figures out that it needs to instantiate the BeanPostProcessor first and use it before it initializes the other beans. So far so good, but in doing so there are 2 major problems. > 1. It uses the BeanDefinition instead of the instance already created during jaxb parsing. > 2. There is a chicken and egg situation; while it initializes "camel:beanPostProcessor", it looks for a "camel" bean which isn't registered yet. The model for it does exist though, so a new instance of the CamelContextFactoryBean gets instantiated (and the id now is null instead of "camel" as in the spring xml). > I wrestled with this and couldn't figure out a solution. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.