第 6 章 在 Spring Boot 中运行 Apache Camel 应用程序
Apache Camel Spring Boot 组件自动为 Spring Boot 配置 Camel 上下文。Camel 上下文的自动配置自动检测 Spring 上下文中提供的 Camel 路由,并注册主要 Camel 实用程序,如制作者模板、消费者模板以及 type converter 作为 Bean。Apache Camel 组件包含一个 Spring Boot starter 模块,它允许您使用 starters 开发 Spring Boot 应用程序。
6.1. Camel Spring Boot 组件介绍
每个 Camel Spring Boot 应用程序都必须使用项目的 pom.xml
中的 dependencyManagement
元素来指定依赖项的产品化版本。这些依赖项在 Red Hat Fuse BOM 中定义,并受 Red Hat Fuse 的特定版本的支持。您可以省略 additional starters 的版本号属性,以便不要覆盖 BOM 中的版本。如需更多信息 ,请参阅 Quickstart pom。
示例
<dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>fuse-springboot-bom</artifactId> <version>${fuse.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
注意
camel-spring-boot
jar 包含 spring.factories
文件,该文件可让您将依赖关系添加到类路径中,以便 Spring Boot 自动配置 Camel 上下文。