Search in sources :

Example 1 with EventComponent

use of org.apache.camel.component.event.EventComponent in project camel by apache.

the class EventComponentAutoConfiguration method configureEventComponent.

@Lazy
@Bean(name = "spring-event-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(EventComponent.class)
public EventComponent configureEventComponent(CamelContext camelContext) throws Exception {
    EventComponent component = new EventComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : EventComponent(org.apache.camel.component.event.EventComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with EventComponent

use of org.apache.camel.component.event.EventComponent in project camel by apache.

the class SpringCamelContext method setApplicationContext.

public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    this.applicationContext = applicationContext;
    ClassLoader cl;
    // set the application context classloader
    if (applicationContext != null && applicationContext.getClassLoader() != null) {
        cl = applicationContext.getClassLoader();
    } else {
        LOG.warn("Cannot find the class loader from application context, using the thread context class loader instead");
        cl = Thread.currentThread().getContextClassLoader();
    }
    LOG.debug("Set the application context classloader to: {}", cl);
    this.setApplicationContextClassLoader(cl);
    if (applicationContext instanceof ConfigurableApplicationContext) {
        // only add if not already added
        if (hasComponent("spring-event") == null) {
            eventComponent = new EventComponent(applicationContext);
            addComponent("spring-event", eventComponent);
        }
    }
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) EventComponent(org.apache.camel.component.event.EventComponent)

Aggregations

EventComponent (org.apache.camel.component.event.EventComponent)2 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1 Bean (org.springframework.context.annotation.Bean)1 Lazy (org.springframework.context.annotation.Lazy)1