Skip to main content

DTOs: Request and Response

Learn DTOs: Request and Response (REST API Development, Spring Boot) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What a DTO Is A DTO (Data Transfer Object) is a small class whose only job is to carry data across a boundary - here, between the JSON your client sees and the objects your application stores. It has fields and no business logic. The entity ( @Entity ) belongs to the database. The DTO belongs to the API. They look similar at first, which tempts people to use one class for both. That works for a demo and causes problems in a real product.

More lessons in REST API Development