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;
}
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);
}
}
}
Aggregations