In Spring, DTO (Data Transfer Object) is an object that carries data between services. The client will send requests, and for sending any data client will not send it directly to the Entity(which is the persistence class).
So, the client will send or receive data through DTO. This way, it carries data. To hold, this data DTO is there. For this, we’ll create one extra DTO class/DTO layer in our application. So in this video, we will explain DTO with a sample project in Spring.
Data transfer object in Spring:
https://www.geeksforgeeks.org/data-transfer-object-dto-in-spring-mvc-with-example/