4.6. カスタムの Camel コンテキスト設定
Camel auto-configuration によって作成された CamelContext
Bean で操作を実行するには、次のように CamelContextConfiguration
インスタンスを Spring コンテキストに登録する必要があります。
@Configuration public class MyAppConfig { ... @Bean CamelContextConfiguration contextConfiguration() { return new CamelContextConfiguration() { @Override void beforeApplicationStart(CamelContext context) { // your custom configuration goes here } }; } }
注記
Spring コンテキストの開始前に CamelContextConfiguration
メソッドおよび beforeApplicationStart (CamelContext)
メソッドが呼び出されるため、このコールバックに渡される CamelContext
インスタンスは完全に自動設定されます。複数のインスタンスの CamelContextConfiguration
を Spring コンテキストに追加でき、すべてが実行されます。