326.18. Camel SQL Starter

spring-boot 用户提供了一个初学者模块。在使用初学者时,可以使用 spring-boot 属性直接配置 DataSource

# Example for a mysql datasource
spring.datasource.url=jdbc:mysql://localhost/test
spring.datasource.username=dbuser
spring.datasource.password=dbpass
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

要使用这个功能,请在 spring boot pom.xml 文件中添加以下依赖项:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-sql-starter</artifactId>
    <version>${camel.version}</version> <!-- use the same version as your Camel core version -->
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jdbc</artifactId>
    <version>${spring-boot-version}</version>
</dependency>

如果需要,您还应包含特定的数据库驱动程序。