6.5. Spring Boot の Camel コンテキストの自動設定

Camel Spring Boot auto-configuration は、CamelContext インスタンスを提供し、SpringCamelContext を作成します。また、コンテキストの初期化およびシャットダウンを実行します。この Camel コンテキストは、camelContext Bean 名で Spring アプリケーションコンテキストに登録され、他の Spring Bean と同様にアクセスできます。camelContext には次のようにアクセスできます。

@Configuration
public class MyAppConfig {

  @Autowired
  CamelContext camelContext;

  @Bean
  MyService myService() {
    return new DefaultMyService(camelContext);
  }

}