...
camel-spring-boot
jar comes with the spring.factories
file, so as soon as you add that dependency into your classpath, Spring Boot will automatically auto-configure the Camel for you.
Auto-configured Camel context
The most important piece of functionality provided by the Camel auto-configuration is CamelContext
instance. Camel auto-configuration creates 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
bean name), so you can access it just as the any other Spring bean.
...
Code Block |
---|
|
@Configuration
public class MyRouterConfiguration {
@Bean
RoutesBuilder myRouter() {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("jms:invoices").to("file:/invoices");
}
};
} |
Custom Camel context configuration
If you would like to perform some operations on CamelContext
bean created by Camel auto-configuration, register CamelContextConfiguration
instance in your Spring context:
Code Block |
---|
|
@Configuration
public class MyAppConfig {
...
@Bean
CamelContextConfiguration contextConfiguration() {
return new CamelContextConfiguration() {
@Override
void postConfiguration(CamelContext context) {
// your custom configuration goes here
}
}
}
} |
Disabling JMX
To disable JMX of the auto-configured CamelContext
use camel.springboot.jmxEnabled
property (JMX is enabled by default). For example you could add the following property to your application.properties
file:
Code Block |
---|
|
camel.springboot.jmxEnabled = false |
Include Page |
---|
| Endpoint See Also |
---|
| Endpoint See Also |
---|
|