Spring Boot Rest API with MyBatis and PostgreSQL

Eric Anicet
4 min readJul 4, 2022

In this story, we’ll implement a sample REST API that uses Spring Boot with MyBatis and PostgreSQL.

Prerequisites

This is the list of all the prerequisites:

  • Spring Boot 2.6.5
  • Gradle
  • Java 17
  • PostgreSQL

Overview

What is MyBatis?

MyBatis is a first-class persistence framework with support for custom SQL, stored procedures, and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces, and Java POJOs (Plain Old Java Objects) to database records.

Why Mybatis?

MyBatis is a fork of iBATIS 3.0 and is maintained by a team that includes the original creators of iBATIS.

MyBatis comes with the following design philosophies −

  • Open source− MyBatis is free and open-source software.
  • Supports ORM − MyBatis supports many of the same features as an ORM tool, such as lazy loading, join fetching, caching, runtime code generation, and inheritance.

--

--

Responses (1)