搜索

7.8. 配置自定义 Camel 上下文

download PDF

要在 CamelContext bean 上由 Camel Spring Boot auto-configuration 创建操作,请在 Spring 上下文中注册 CamelContextConfiguration 实例。

流程

  • 在 Spring 上下文中注册 CamelContextConfiguration 实例,如下所示。

    @Configuration
    public class MyAppConfig {
    
      ...
    
      @Bean
      CamelContextConfiguration contextConfiguration() {
        return new CamelContextConfiguration() {
          @Override
          void beforeApplicationStart(CamelContext context) {
            // your custom configuration goes here
          }
        };
      }
    
    }

在启动 Spring 上下文之前调用 CamelContextConfigurationbeforeApplicationStart(CamelContext) 方法,因此传递给这个回调的 CamelContext 实例将完全自动配置。您可以将许多 CamelContextConfiguration 实例添加到 Spring 上下文,并将执行所有这些实例。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.