* @return A new {@link CamelContext}.
*/
@Bean(destroyMethod = "stop")
public DefaultCamelContext camelContext(final ApplicationContext applicationContext) {
notNull(applicationContext, "The application's context is required.");
Environment env = applicationContext.getEnvironment();
final DefaultCamelContext camelContext = new DefaultCamelContext(
new ApplicationContextRegistry(applicationContext));
// Runtime configuration
Long delayer = env.getProperty("camel.delayer", Long.class);
camelContext.setDelayer(delayer);
Boolean handleFault = env.getProperty("camel.handleFault", Boolean.class, Boolean.FALSE);
camelContext.setHandleFault(handleFault);
String shutdownRoute = env.getProperty("camel.shutdownRoute", ShutdownRoute.Default.name());
camelContext.setShutdownRoute(ShutdownRoute.valueOf(shutdownRoute));
String shutdownRunningTask = env.getProperty("camel.shutdownRunningTask",
ShutdownRunningTask.CompleteCurrentTaskOnly.name());
camelContext.setShutdownRunningTask(ShutdownRunningTask.valueOf(shutdownRunningTask));
Boolean streamCaching = env.getProperty("camel.streamCaching", Boolean.class, Boolean.FALSE);
camelContext.setStreamCaching(streamCaching);
Boolean tracing = env.getProperty("camel.tracing", Boolean.class, Boolean.FALSE);
camelContext.setTracing(tracing);
camelContext.addComponent("properties", camelProperties(applicationContext));
return camelContext;