1.3. Spring Boot 自动配置
当在 Spring Boot 中使用 spring-boot 时,请确保使用以下 Maven 依赖项支持自动配置:
<dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-spring-boot-starter</artifactId> <version>3.14.2.redhat-00054</version> <!-- use the same version as your Camel core version --> </dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>3.14.2.redhat-00054</version> <!-- use the same version as your Camel core version -->
</dependency>
1.3.1. 自动配置 Camel 上下文 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Camel 自动配置中最重要的功能是 CamelContext
实例。Camel 自动配置为您创建一个 SpringCamelContext
,并负责处理该上下文的正确初始化和关闭。创建的 Camel 上下文也在 Spring 应用程序上下文中注册(在 camelContext
bean 名称下),因此您可以像任何其他 Springan 一样访问它。