sharding jdbc 2.x系列详解参见https://www.cnblogs.com/zhjh256/p/9221634.html。
最近将sharding jdbc的配置从xml切换到了spring boot。首先引入依赖:
<dependency> <groupId>io.shardingsphere</groupId> <artifactId>sharding-jdbc-spring-boot-starter</artifactId> <version>3.1.0</version> </dependency>
然后按照https://shardingsphere.apache.org/document/legacy/3.x/document/en/manual/sharding-jdbc/configuration/config-spring-boot/配置即可,基本上和xml配置是一样的。
参考:
3.1.0系列:https://shardingsphere.apache.org/document/legacy/3.x/document/en/manual/sharding-jdbc/configuration/config-spring-boot/
4.0系列:https://shardingsphere.apache.org/document/current/cn/manual/sharding-jdbc/configuration/config-spring-boot/