Tagged articles
16 articles
Page 1 of 1
Java Companion
Java Companion
Feb 5, 2026 · Backend Development

Elegant Dynamic Data Source Switching in SpringBoot Using ThreadLocal and AbstractRoutingDataSource

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.

Runtime DataSource RegistrationSpringBootThreadLocal
0 likes · 16 min read
Elegant Dynamic Data Source Switching in SpringBoot Using ThreadLocal and AbstractRoutingDataSource
Architect's Guide
Architect's Guide
Jul 7, 2025 · Backend Development

Dynamic Data Source Switching in Spring Boot Using ThreadLocal & AbstractRoutingDataSource

This tutorial explains how to implement dynamic data source switching in Spring Boot by combining ThreadLocal with AbstractRoutingDataSource, covering custom context holders, configuration, annotation‑driven switching, dynamic addition of data sources, and complete code examples with test results.

Dynamic Data SourceSpring BootThreadLocal
0 likes · 16 min read
Dynamic Data Source Switching in Spring Boot Using ThreadLocal & AbstractRoutingDataSource
Selected Java Interview Questions
Selected Java Interview Questions
Mar 13, 2025 · Backend Development

Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource

This article demonstrates how to build a dynamic data source switching mechanism in Spring Boot by leveraging ThreadLocal for thread‑scoped context and AbstractRoutingDataSource for routing, covering manual implementation, annotation‑driven switching, and runtime addition of new data sources.

DynamicDataSourceMyBatisPlusSpringBoot
0 likes · 14 min read
Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource
Architect
Architect
Mar 12, 2025 · Backend Development

DataSource Switching in Spring Boot with ThreadLocal & AbstractRoutingDataSource

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.

JavaSpring BootThreadLocal
0 likes · 18 min read
DataSource Switching in Spring Boot with ThreadLocal & AbstractRoutingDataSource
Architect's Guide
Architect's Guide
Sep 6, 2024 · Backend Development

Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource

This article demonstrates how to implement dynamic data source switching in a Spring Boot application by leveraging ThreadLocal and AbstractRoutingDataSource, providing step‑by‑step code examples for context holders, custom routing, annotation‑driven switching, and runtime addition of new data sources.

DynamicDataSourceMyBatis-PlusSpringBoot
0 likes · 14 min read
Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource
Java High-Performance Architecture
Java High-Performance Architecture
Apr 8, 2024 · Backend Development

Dynamic Multi-DataSource Switching & Transaction Management in Spring

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.

JavaMulti-Database Transactionabstractroutingdatasource
0 likes · 15 min read
Dynamic Multi-DataSource Switching & Transaction Management in Spring
Architect
Architect
Dec 18, 2023 · Backend Development

Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource

This article demonstrates how to build a custom dynamic data‑source solution for Spring Boot by using ThreadLocal to store the current datasource key, extending AbstractRoutingDataSource for routing, configuring multiple datasources in application.yml, and optionally adding annotation‑driven switching and runtime datasource registration.

DynamicDataSourceJavaMyBatisPlus
0 likes · 15 min read
Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource
IT Xianyu
IT Xianyu
Dec 12, 2023 · Backend Development

Implementing Dynamic Data Source Switching in Spring Boot Using ThreadLocal and AbstractRoutingDataSource

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.

BackendThreadLocalabstractroutingdatasource
0 likes · 15 min read
Implementing Dynamic Data Source Switching in Spring Boot Using ThreadLocal and AbstractRoutingDataSource
Top Architect
Top Architect
Apr 10, 2023 · Databases

Dynamic Multi‑DataSource Management and Transaction Handling in Spring

The article explains how to dynamically manage multiple data sources and ensure transaction consistency in Spring applications by extending AbstractRoutingDataSource, using configuration‑file or database‑table approaches, and applying AOP‑based switching with custom transaction management.

DynamicDataSourceJavaabstractroutingdatasource
0 likes · 16 min read
Dynamic Multi‑DataSource Management and Transaction Handling in Spring
Java Architect Essentials
Java Architect Essentials
Oct 28, 2020 · Backend Development

Implementing Read/Write Splitting with Spring's AbstractRoutingDataSource

This article demonstrates how to implement read/write splitting in a Spring Boot application by configuring multiple data sources, using AbstractRoutingDataSource for dynamic routing, and applying AOP and custom annotations to direct read operations to slave databases and write operations to the master, with full Maven and MyBatis setup.

DataSource RoutingMyBatisSpring Boot
0 likes · 17 min read
Implementing Read/Write Splitting with Spring's AbstractRoutingDataSource
Architecture Digest
Architecture Digest
Feb 29, 2020 · Backend Development

Implementing Read‑Write Splitting in Spring Boot with AbstractRoutingDataSource

This article demonstrates how to achieve read‑write splitting in a Spring Boot application by configuring multiple data sources, creating a custom AbstractRoutingDataSource, using AOP to switch between master and slave databases, and integrating the routing data source with MyBatis for transparent database operations.

DataSource RoutingMyBatisSpring Boot
0 likes · 15 min read
Implementing Read‑Write Splitting in Spring Boot with AbstractRoutingDataSource