Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 254A297F5 for ; Wed, 18 Apr 2012 06:34:30 +0000 (UTC) Received: (qmail 13904 invoked by uid 500); 18 Apr 2012 06:34:29 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 13878 invoked by uid 500); 18 Apr 2012 06:34:29 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 13861 invoked by uid 99); 18 Apr 2012 06:34:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2012 06:34:29 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.217.173 as permitted sender) Received: from [209.85.217.173] (HELO mail-lb0-f173.google.com) (209.85.217.173) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2012 06:34:21 +0000 Received: by lboi15 with SMTP id i15so2131044lbo.32 for ; Tue, 17 Apr 2012 23:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=w/xSD0rW7lAVAlM98Otm3rBhB0wP7mo1rIYMtwVFtK0=; b=xULRVD8a556TMGwih00pkLj80rrsIj88LLmcH/Y4TYxQqO/qy+mkihy9xIWNW5ee7V 2a7Zhy6u8Yi7CopqOl5rQCKRJLUWOA/7D/KSuLNqxiP47EDNXCeJ1kDe0zPhQeP6Fdrf liT+wn5iQywdEM6mBjHzK6DnQjRMMgm+XlalWLeZ48HQoKfY+SETofZ3JRGtohPt9T1S DEiYxjZVovsWs6wmCcdv8cwN8DtY+XVC6hiwTOA+xUVLHH9vKLs3ufKO3dWiu2mIdqRU LcVh7f5ZmwxDLtUD+QxkvWnFuGL+gX92ODtMqRfFwZHsUV7tvdheeUv2RJq4VwoY99Qm Ga8w== Received: by 10.152.127.136 with SMTP id ng8mr977588lab.16.1334730841469; Tue, 17 Apr 2012 23:34:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.75.130 with HTTP; Tue, 17 Apr 2012 23:33:41 -0700 (PDT) In-Reply-To: <1334585888763-5643943.post@n5.nabble.com> References: <1334585888763-5643943.post@n5.nabble.com> From: Claus Ibsen Date: Wed, 18 Apr 2012 08:33:41 +0200 Message-ID: Subject: Re: Spring context and camel context in the same time To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The XML file is just a standard Spring XML file. So whatever Spring supports to use both its annotation and to load beans from a XML file, that is your answer. You can also create a SpringCamelContext yourself from Java code, to get Camel. Then you may not need the XML file. On Mon, Apr 16, 2012 at 4:18 PM, Hugo wrote: > Hello everyone, > > Is it possible to use a camel context and a spring context (more precisel= y > an AnnotationConfigApplicationContext) in a same application ? > > I explained myself : I'm trying to do 2 "simple" things. > - get beans (created by spring through the annotation @Named) file from a > java class (without injection) > - scan packages to create beans from annotation (@Named) > > I am not achieving do that neither using > neither creating a new spring context... > > I would like to create something like that (in addition of the existing > camelcontext defined in the xml file camel-context.xml) : > > public MyClass { > =A0AnnotationConfigApplicationContext currentApplicationContext =3D new > AnnotationConfigApplicationContext(); > =A0currentApplicationContext.register(BeanSpring.class); > =A0currentApplicationContext.refresh(); > } > > and my config file : > > @Configuration > @ComponentScan("com.francetelecom.prototyperoutes") > public class BeanSpring { > > =A0 =A0 =A0 =A0String MANDATORY_PROFILE =3D "test"; > > =A0 =A0 =A0 =A0String getProp() { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return MANDATORY_PROFILE; > =A0 =A0 =A0 =A0} > } > > In my xml, I've just got : > > =A0 class=3D"com.francetelecom.prototyperoutes.PrototypeRoutes"/> > > =A0 > =A0 =A0 > =A0 > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Spring-co= ntext-and-camel-context-in-the-same-time-tp5643943p5643943.html > Sent from the Camel - Users mailing list archive at Nabble.com. --=20 Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cibsen@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/