@Configuration public class CamelAutoConfiguration extends Object
Opinionated auto-configuration of the Camel context. Auto-detects Camel routes available in the Spring context and exposes the key Camel utilities (like producer template, consumer template and type converter).
The most important piece of functionality provided by the Camel starter is CamelContext instance. Fabric Camel starter
will create SpringCamelContext for your and take care of the proper initialization and shutdown of that context. Created
Camel context is also registered in the Spring application context (under camelContext name), so you can access it just
as the any other Spring bean.
@Configuration
public class MyAppConfig {
@Autowired
CamelContext camelContext;
@Bean
MyService myService() {
return new DefaultMyService(camelContext);
}
}
Camel starter collects all the `RoutesBuilder` instances from the Spring context and automatically injects
them into the provided CamelContext. It means that creating new Camel route with the Spring Boot starter is as simple as
adding the @Component annotated class into your classpath:
@Component
public class MyRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
from("jms:invoices").to("file:/invoices");
}
}
Or creating new route RoutesBuilder in your @Configuration class:
@Configuration
public class MyRouterConfiguration {
@Bean
RoutesBuilder myRouter() {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("jms:invoices").to("file:/invoices");
}
};
}
}
Copyright © 2011–2014 Red Hat. All rights reserved.