DTOs are used to encapsulate data that is exchanged between the controller and service layers, or between the service layer and the persistence layer. This is one of the spring boot interview questions for 5 years experience.