Tag

AbstractRoutingDataSource

0 views collected around this technical thread.

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.

AbstractRoutingDataSourceDatabaseDynamicDataSource
0 likes · 14 min read
Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and 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.

AOPAbstractRoutingDataSourceDatabase
0 likes · 14 min read
Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource
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.

AbstractRoutingDataSourceDatabaseDynamicDataSource
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.

AbstractRoutingDataSourceDynamic DataSourceJava
0 likes · 15 min read
Implementing Dynamic Data Source Switching in Spring Boot Using ThreadLocal and AbstractRoutingDataSource
Selected Java Interview Questions
Selected Java Interview Questions
Apr 18, 2023 · Backend Development

Dynamic Multi-DataSource Management and Transaction Handling in Spring

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.

AOPAbstractRoutingDataSourceDynamic DataSource
0 likes · 13 min read
Dynamic Multi-DataSource Management and Transaction Handling in Spring
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.

AbstractRoutingDataSourceDynamicDataSourceJava
0 likes · 16 min read
Dynamic Multi‑DataSource Management and Transaction Handling in Spring
Full-Stack Internet Architecture
Full-Stack Internet Architecture
May 10, 2021 · Backend Development

Implementing Read‑Write Splitting in Spring with AbstractRoutingDataSource and AOP

This article explains how to achieve database read‑write separation in a Spring application by using AbstractRoutingDataSource for routing, ThreadLocal for context, AOP interceptors for automatic switching, and provides a complete example with configuration, service code, and test cases.

AOPAbstractRoutingDataSourceDatabase
0 likes · 17 min read
Implementing Read‑Write Splitting in Spring with AbstractRoutingDataSource and AOP
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.

AOPAbstractRoutingDataSourceDataSource Routing
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.

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