Skip to content

A simple project to demonstrate how to configure multiple mappers attacking multiple databases using Spring Boot and MyBatis

License

Notifications You must be signed in to change notification settings

Verdoso/multi-mybatis-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

A simple project to demonstrate how to configure multiple mappers attacking multiple databases using Spring Boot and MyBatis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages