DTO and Mapstruct — explanation for 5 years old

Bahaddin Ahmadov
JavaToDev
Published in
5 min readMay 18, 2021

--

If you reading this article, it seems, you have already skipped lots of articles, videos that have been written in unnecessary difficult language. Put a pillow under your neck, after 3 minutes you will have whole image about DTOs.

Let's create our Spring Boot Project with Gradle:

Figure 1 — For Gradle building tool

If You are using Maven, add dependencies aboveinto your POM.XML file.

fig 2 — application.yaml file is in resources package

DB connection parameters are set in the application.yaml file. Just make sure, you already have the “student_database” schema in your MySQL database.

fig 3 — Overall view of Path

Now let's create our layers: Controller, Service, Repository, and Entity as described on the left.

--

--