Tagged articles
dynamic-datasource
27 articles · Page 1 of 1

java1234Feb 6, 2026 · Backend Development
This tutorial shows how to implement graceful dynamic data source switching in SpringBoot by combining ThreadLocal with AbstractRoutingDataSource, configuring master/slave databases, adding a @DS annotation with AOP support, and enabling runtime addition of new data sources.
AOPAbstractRoutingDataSourceJava
0 likes · 17 min read

This article walks through building an elegant dynamic data‑source switch in SpringBoot by combining ThreadLocal with AbstractRoutingDataSource, covering the context holder, custom routing class, YAML configuration, testing, annotation‑driven switching, and runtime addition of new data sources.
AOPAbstractRoutingDataSourceMyBatis Plus
0 likes · 16 min read

This guide walks through two approaches for configuring multiple databases in a Spring Boot and MyBatis project—native multi‑data‑source beans and the dynamic‑datasource‑spring‑boot‑starter—covering project structure, Maven dependencies, Java configuration, mapper setup, usage examples, common pitfalls, and a concise summary of when to choose each method.
JavaMulti-DataSourceMyBatis
0 likes · 9 min read

Dynamic‑datasource 4.3.1 offers a powerful AOP‑based, annotation‑driven solution for seamless multi‑database routing, read‑write separation, and load‑balancing in Spring Boot applications, while addressing common pitfalls such as transaction boundaries, connection‑pool configuration, health‑check failures, and version compatibility.
Multi-DataSourcedynamic-datasourcehealth check
0 likes · 18 min read

This guide shows how to combine MyBatis-Plus dynamic data source routing with ShardingSphere-JDBC for horizontal sharding and read‑write splitting, including Maven dependencies, YAML configuration, Spring bean setup, and a custom load‑balancing algorithm to keep @DS annotations functional.
Custom Load BalancerMyBatis PlusShardingSphere
0 likes · 14 min read

This article demonstrates how to use SpringBoot 3.0.4 with AOP and a custom @DataSource annotation to dynamically switch between MySQL master and slave databases, ensuring high availability by automatically falling back to the master when a slave fails, and provides configuration and code examples for multiple data sources.
AOPDatabase SwitchingMySQL
0 likes · 14 min read

This article walks through the complete process of implementing dynamic data source switching in a SpringBoot application, covering the core concepts of thread‑local context, abstract routing, custom annotations with AOP, configuration, code examples, and important considerations such as transaction management and performance.
AOPJavaSpringBoot
0 likes · 6 min read

This tutorial explains how to use SpringBoot, AOP, and a custom @DataSource annotation to dynamically switch between MySQL master and slave databases—covering configuration, code implementation, multiple slave handling, and an Oracle example—to ensure high availability and flexible data source management.
AOPJavaMaster‑Slave
0 likes · 13 min read

This article explains how to use SpringBoot, AOP, and a custom @DataSource annotation to dynamically switch between MySQL master and slave databases, automatically falling back to the master when a slave fails, thereby achieving high availability for backend services.
AOPJavaMySQL
0 likes · 14 min read

Facing the need to query multiple databases in a Spring Boot application, this guide walks through building a custom dynamic datasource solution using ThreadLocal and AbstractRoutingDataSource, covering core implementations, annotation‑based switching, dynamic datasource addition, configuration, and comprehensive test results.
AbstractRoutingDataSourceJavaMyBatis Plus
0 likes · 18 min read

This tutorial explains how to implement dynamic master‑slave MySQL switching in a SpringBoot 3.0.4 project using AOP and a custom @DataSource annotation, covering configuration, enum definitions, utility classes, aspect handling, and usage examples for both single and multiple data sources, including Oracle integration.
AOPJavaMySQL
0 likes · 15 min read

Learn how to implement dynamic MySQL master‑slave switching in a SpringBoot project using AOP and custom annotations, ensuring automatic failover to the master when a slave fails, with detailed configuration, code examples, and guidance for multiple data sources and Oracle integration.
AOPDatabase FailoverMaster‑Slave
0 likes · 15 min read

This article explains how to integrate Spring Boot with MyBatis, configure a single Druid data source, implement a dynamic routing data source for multiple databases, and use custom annotations and AOP to switch databases at runtime, including full code examples and transaction management.
JavaMultiple Data SourcesMyBatis
0 likes · 16 min read

This tutorial explains how to combine Spring Boot, MyBatis, and multiple databases using Druid connection pools, dynamic routing data sources, custom annotations, and AOP, providing complete configuration examples, code snippets, and best‑practice guidance for backend developers.
JavaMulti-DataSourceSpring Boot
0 likes · 17 min read

This article explores solutions for managing multiple data sources in a Spring application, covering dynamic routing with AbstractRoutingDataSource, configuration‑file and database‑table approaches, AOP‑based source switching, and custom multi‑transaction handling to ensure consistency across heterogeneous databases.
AbstractRoutingDataSourceJavaMulti-Database Transaction
0 likes · 15 min read

This guide shows how to configure Spring Boot, MyBatis‑Plus and the dynamic‑datasource starter to connect to MySQL, SQL Server and PostgreSQL, add and remove data sources at runtime, verify their availability, and perform manual switching using a utility class and functional interfaces.
HikariCPJavaMultiple DataSource
0 likes · 14 min read


IT NiukeJan 8, 2024 · Backend Development
This article walks through implementing dynamic data‑source switching in SpringBoot by combining ThreadLocal with AbstractRoutingDataSource, covering manual code, configuration, annotation‑driven AOP, and runtime addition of new data sources, complete with test cases and sample code.
AOPAbstractRoutingDataSourceMyBatis Plus
0 likes · 17 min read

This article explains how to build a custom dynamic data‑source solution for Spring Boot by leveraging ThreadLocal and AbstractRoutingDataSource, provides complete Java code for context holders, routing datasource, configuration, annotation‑driven switching, and runtime addition of new data sources.
AbstractRoutingDataSourceBackendMyBatis Plus
0 likes · 15 min read

This guide explains how to implement read‑write separation in Spring Boot applications by configuring master and slave databases, creating dynamic routing data sources, using custom annotations and AOP, integrating HikariCP and MyBatis, and handling thread‑local context for optimal performance.
HikariCPMyBatisMySQL
0 likes · 10 min read

This article explains how to dynamically manage multiple Spring data sources, switch them at runtime using AbstractRoutingDataSource, and ensure transactional consistency across databases by implementing custom AOP, connection proxies, and multi‑transaction annotations.
AOPAbstractRoutingDataSourceJava
0 likes · 13 min read

This article explains how to dynamically manage multiple data sources and ensure transaction consistency across them in Spring applications, covering both configuration‑file and database‑table approaches, custom AOP switching, and a bespoke multi‑database transaction mechanism.
JavaSpringbackend development
0 likes · 14 min read

This article introduces Robustdb, a lightweight client‑side read‑write splitting framework built with only a dozen classes, explains its architecture, routing logic, method‑level transaction handling, dynamic data‑source management, and presents performance comparisons with the legacy Atlas proxy.
JavaSpringdatabase routing
0 likes · 17 min read

This article explains how a company built Robustdb, a lightweight client‑side read/write splitting solution to replace Atlas, detailing its background, routing core, method‑level control, dynamic data source management, performance gains, and providing code examples for implementation.
AtlasRobustdbSpring Boot
0 likes · 17 min read

This article explains how to integrate Spring Boot with MyBatis, configure a single Druid data source, implement multi‑data‑source support using Spring's AbstractRoutingDataSource, create a dynamic data source with ThreadLocal, and wire everything together with custom annotations, aspects, and transaction management for backend Java applications.
BackendMulti-DataSourceMyBatis
0 likes · 18 min read

This guide explains how to configure a Spring Boot application with MySQL and SQL Server data sources, use Nginx to expose capture‑server images as URLs, and implement Vue components for on‑demand photo preview of traffic‑violation records.
MySQLSpring BootVue
0 likes · 3 min read

This tutorial walks through designing and implementing a Spring Boot‑based SaaS platform that supports multiple tenants by dynamically switching databases or schemas, covering architecture overview, tenant identification, data‑source routing, Maven setup, entity and repository definitions, interceptor configuration, and a simple login test.
HibernateSaaSSpring Boot
0 likes · 27 min read

This tutorial walks through creating a SaaS application with Spring Boot that supports multiple tenants by using independent or shared databases with separate schemas, covering tenant identification, dynamic DataSource routing, Hibernate multi‑tenancy configuration, and a complete code example including Maven setup, entity definitions, interceptors, and a login test.
HibernateJavaSaaS
0 likes · 26 min read
