Search in sources :

Example 26 with SpringCamelContext

use of org.apache.camel.spring.SpringCamelContext in project camel by apache.

the class JavaSpaceTransportSendReceiveTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    spring = new ClassPathXmlApplicationContext("org/apache/camel/component/javaspace/spring.xml");
    SpringCamelContext ctx = SpringCamelContext.springCamelContext(spring);
    return ctx;
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext)

Example 27 with SpringCamelContext

use of org.apache.camel.spring.SpringCamelContext in project camel by apache.

the class AbstractMongoDbTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    applicationContext = new AnnotationConfigApplicationContext(EmbedMongoConfiguration.class);
    CamelContext ctx = new SpringCamelContext(applicationContext);
    PropertiesComponent pc = new PropertiesComponent("classpath:mongodb.test.properties");
    ctx.addComponent("properties", pc);
    return ctx;
}
Also used : CamelContext(org.apache.camel.CamelContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent)

Example 28 with SpringCamelContext

use of org.apache.camel.spring.SpringCamelContext in project camel by apache.

the class SpelExpression method createEvaluationContext.

private EvaluationContext createEvaluationContext(Exchange exchange) {
    StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new RootObject(exchange));
    if (exchange.getContext() instanceof SpringCamelContext) {
        // Support references (like @foo) in expressions to beans defined in the Registry/ApplicationContext
        ApplicationContext applicationContext = ((SpringCamelContext) exchange.getContext()).getApplicationContext();
        evaluationContext.setBeanResolver(new BeanFactoryResolver(applicationContext));
    }
    return evaluationContext;
}
Also used : BeanFactoryResolver(org.springframework.context.expression.BeanFactoryResolver) ApplicationContext(org.springframework.context.ApplicationContext) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext)

Example 29 with SpringCamelContext

use of org.apache.camel.spring.SpringCamelContext in project camel by apache.

the class CxfEndpointUtils method createBus.

/**
     * Create a CXF bus with either BusFactory or SpringBusFactory if Camel Context
     * is SpringCamelContext.  In the latter case, this method updates the bus 
     * configuration with the applicationContext which SpringCamelContext holds 
     * 
     * @param context - the Camel Context
     */
public static Bus createBus(CamelContext context) {
    BusFactory busFactory = BusFactory.newInstance();
    if (context instanceof SpringCamelContext) {
        SpringCamelContext springCamelContext = (SpringCamelContext) context;
        ApplicationContext applicationContext = springCamelContext.getApplicationContext();
        busFactory = new SpringBusFactory(applicationContext);
    }
    return busFactory.createBus();
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) BusFactory(org.apache.cxf.BusFactory) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory)

Example 30 with SpringCamelContext

use of org.apache.camel.spring.SpringCamelContext in project bamboobsc by billchen198318.

the class TestHelloCamelStartForContextInitialized method execute.

@Override
public void execute(ServletContextEvent event) throws Exception {
    CamelContext context = new SpringCamelContext(AppContext.getApplicationContext());
    context.start();
}
Also used : CamelContext(org.apache.camel.CamelContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext)

Aggregations

SpringCamelContext (org.apache.camel.spring.SpringCamelContext)30 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)12 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)5 DoToSpringCamelContextsStrategy (org.apache.camel.test.spring.CamelSpringTestHelper.DoToSpringCamelContextsStrategy)5 Method (java.lang.reflect.Method)4 LinkedList (java.util.LinkedList)4 CamelContext (org.apache.camel.CamelContext)4 ProducerTemplate (org.apache.camel.ProducerTemplate)4 PropertiesComponent (org.apache.camel.component.properties.PropertiesComponent)4 Breakpoint (org.apache.camel.spi.Breakpoint)4 Test (org.junit.Test)3 Properties (java.util.Properties)2 TimeUnit (java.util.concurrent.TimeUnit)2 Route (org.apache.camel.Route)2 DefaultDebugger (org.apache.camel.impl.DefaultDebugger)2 InterceptSendToMockEndpointStrategy (org.apache.camel.impl.InterceptSendToMockEndpointStrategy)2 Debugger (org.apache.camel.spi.Debugger)2 ApplicationContext (org.springframework.context.ApplicationContext)2 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)2 Channel (org.apache.camel.Channel)1