1.2.3. 自动配置的 Camel 上下文
Camel 自动配置提供的最重要功能是 CamelContext 实例。Camel 自动配置为您创建 SpringCamelContext,并处理该上下文的正确初始化和关闭。在 Spring 应用程序上下文中也注册了创建的 Camel 上下文(在 camelContext bean 名称下),因此您可以像任何其他 Spring bean 一样访问它。
@Configuration
public class MyAppConfig {
@Autowired
CamelContext camelContext;
@Bean
MyService myService() {
return new DefaultMyService(camelContext);
}
}