Dynamic Multi-DataSource Routing with MyBatis-Plus and Druid in Spring Boot

Maven Dependencies Include the required starters in your pom.xml: <dependencies> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.5</version> </dependency> <dependency> <groupId&g ...

Posted on Wed, 02 Sep 2026 16:17:10 +0000 by doublebassdanny

Integrating Spring Boot with MyBatis-Plus and MySQL Database

Build Configuration and Dependencies Initialize the project by declaring the required libraries in the Maven descriptor. This setup establishes the core web framwork, incorporates the MyBatis-Plus persistence extension, adds the official MySQL driver, and integrates the Druid connection pool for efficient resource handling. <?xml version=&qu ...

Posted on Fri, 28 Aug 2026 16:07:12 +0000 by cli_man

Configuring Multiple Data Sources with MyBatis and Druid in Spring Boot

Database Setup This example demonstrates a read-write database separation setup. The write database (mybatis1) handles write operations, while the read database (mybatis) handles read operations. Both databases share identical table structures. Write Database Schema CREATE DATABASE `mybatis1` DEFAULT CHARACTER SET utf8; CREATE TABLE `user` ( ...

Posted on Tue, 25 Aug 2026 16:15:35 +0000 by roswell

Resolving Common Issues in Spring Boot and MyBatis Integration

Integration Steps To integrate MyBatis with a Spring Boot project, start by adding necessary dependencies to your pom.xml: <dependencies> <!-- MySQL Driver --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.33</ve ...

Posted on Thu, 20 Aug 2026 16:39:17 +0000 by temidayo

Implementing Multiple Data Sources with Druid in Spring Boot

Componant Implementation DataSource Annotation DataSource.java AspectJ Implementation DataSourceAspect.java Data Source Constants DataSourceConstants.java Dynamic Data Source DynamicDataSource.java Configuration DataSourceConfig.java DataSource Annotation package com.example.datasource.config; import java.lang.annotation.*; ...

Posted on Thu, 13 Aug 2026 16:42:52 +0000 by sweetmaster

Securing Database Credentials in Spring Boot Using Druid Encryption

In production-grade software development, storing database credentials in plain text within configuration files poses a significant security risk. To mitigate this, it is standard practice to encrypt sensitive information. This article demonstrates how to leverage the Alibaba Druid connection pool to encrypt and decrypt database passwords asymm ...

Posted on Tue, 21 Jul 2026 16:49:47 +0000 by easethan

Configuring Database Connections in Spring Boot with MyBatis

Method 1: Using @Value for Property Injection Step 1: Define a properties file (e.g., jdbc.properties) jdbc.driverClassName=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://127.0.0.1:3306/leyou jdbc.username=root jdbc.password=123456 Step 2: Create a configuration class using @Value package com.caicia.config; import com.alibaba.druid.pool.Druid ...

Posted on Sun, 28 Jun 2026 16:57:31 +0000 by shatteredroses

Understanding Druid Database Connection Pool Internals and Configuration

Database connection pooling is a foundational optimization in modern Java applications, especially within Spring Boot ecosystems. Misconfigurations or misunderstandings of pool behavior frequently lead to subtle production issues — such as stale connections, timeouts, or resource exhaustion — even among seasoned developers. Why Connection Pools ...

Posted on Wed, 24 Jun 2026 18:04:01 +0000 by bcamp1973

Spring Boot with MyBatis Transaction Management Setup

Maven Dependencies Add the following dependencies to you're pom.xml: <!-- MyBatis integration for Spring Boot --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.1</version> </dependency> <!-- MySQL ...

Posted on Sun, 07 Jun 2026 16:41:13 +0000 by frost

Spring Boot Persistence with MyBatis

MyBatis is a lightweight SQL-mapping framweork that removes most JDBC boiler-plate while still giving full control over SQL. The following walkthrough shows how to integrate it into a Spring Boot project and perform common CRUD operations. Project bootstrap and data source configuration Create a new Spring Boot project with the spring-boot- ...

Posted on Wed, 20 May 2026 08:09:11 +0000 by AceE