60.8. Spring Boot Auto-Configuration
当在 Spring Boot 中使用 spring-batch
时,使用以下 Maven 依赖项来启用对自动配置的支持:
<dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-spring-batch-starter</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency>
组件支持 5 个选项,如下所列。
Name | 描述 | 默认值 | 类型 |
---|---|---|---|
camel.component.spring-batch.autowired-enabled | 是否启用自动关闭。这用于自动关闭选项(选项必须标记为 autowired),方法是在 registry 中查找查找是否有单个匹配类型实例,然后在组件上配置。这可以用于自动配置 JDBC 数据源、JMS 连接工厂、AWS 客户端等。 | true | 布尔值 |
camel.component.spring-batch.enabled | 是否启用 spring-batch 组件的自动配置。这默认是启用的。 | 布尔值 | |
camel.component.spring-batch.job-launcher | 明确指定要使用的 JobLauncher。选项是一个 org.springframework.batch.core.launch.JobLauncher 类型。 | JobLauncher | |
camel.component.spring-batch.job-registry | 明确指定要使用的 JobRegistry。选项是一个 org.springframework.batch.core.configuration.JobRegistry 类型。 | JobRegistry | |
camel.component.spring-batch.lazy-start-producer | 生成者是否应懒惰启动 (在第一个消息中)。通过懒惰启动,您可以使用此选项来允许 CamelContext 和路由在生成者启动期间启动,并导致路由启动失败。通过懒惰启动,启动失败可以在路由信息时通过 Camel 的路由错误处理程序进行处理。请注意,在处理第一个消息时,创建并启动生成者可能需要稍等时间,并延长处理的总处理时间。 | false | 布尔值 |