ShardingSphere 提供 JDBC 驱动,开发者可以在 Spring 中配置 ShardingSphereDriver 来使用 ShardingSphere。
<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-jdbc</artifactId>
    <version>${shardingsphere.version}</version>
</dependency>
| 名称 | 类型 | 说明 | 
|---|---|---|
| driverClass | 属性 | 数据库 Driver,这里需要指定使用 ShardingSphereDriver | 
| url | 属性 | YAML 配置文件路径 | 
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           http://www.springframework.org/schema/beans/spring-beans.xsd">
    
    <bean id="shardingDataSource" class="com.zaxxer.hikari.HikariDataSource">
        <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" />
        <property name="url" value="jdbc:shardingsphere:classpath:xxx.yaml" />
    </bean>
</beans>
使用方式同 Spring Boot。
