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