Skip to content
A simple project to demonstrate how to configure multiple mappers attacking multiple databases using Spring Boot and MyBatis
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Initial load Feb 6, 2018
.gitignore Initial load Feb 6, 2018
LICENSE Initial commit Feb 6, 2018
README.md Just to clarify this is about Spring Boot Feb 6, 2018
Screenshot.PNG Added screenshot to show the results Feb 6, 2018
pom.xml Initial load Feb 6, 2018

README.md

Multi-MyBatis-Demo

This is a simple Spring Boot project to demonstrate how to configure MyBatis with multiple mappers pointing to different databases.

It basically contains the configuration files that set up two different connections to two different databases (an in-memory H2 instance and and in-memory HSQLDB instance), creates two datasources and configures two different mappers where each one uses a different database from the other. I added a simple controller that queries each database with vendor specifig SQL to display the name and the version of the database to demonstrate that each mapper points fo a different database.

After you build and run this project, this is the result you should get when you point your browser to http://localhost:8080/test_mappers:

enter image description here

This project was created as a hands-down demonstration of the tip explained in the blog entry "Spring Boot, MyBatis, multiple datasources and multiple mappers, all together holding hands"

You can’t perform that action at this time.