Hi,
     Please give a "id" to the CamelContext. you can grab it using the
Spring's getBean method.
For example if you give the following camle context code inside your springs
application context xml then
you can get the "FIRST-CAMLE-CONTEXT" using the getBean() method

<camelContext id="FIRST-CAMEL-CONTEXT"
xmlns="http://camel.apache.org/schema/spring";>
        <route>
                <from uri="direct:startReading" />
                <bean ref="myBean" method="readAndPint" />
        </route>
</camelContext>

<bean id="myBean" class="com.anver.test.ReadBean" />


public static void main(String[] args) throws Exception { 
   ApplicationContext context = new
ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml");
   CamelContext camelContext = (CamelContext)
context.getBean("FIRST-CAMEL-CONTEXT");         
   System.out.println(camelContext.getEndpoints());
}


-Anver



--
View this message in context: 
http://camel.465427.n5.nabble.com/how-to-get-CamelContext-using-Spring-tp4659203p5728716.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to