r/SpringBoot • u/ahmedzahran94 • Feb 25 '24
Map dto in controller
Hi my manager tell me that best practice is to map the returned dto from service layer in controller not in service Would any one agree with this ? My knowledge is the controller just one line and just delegate the logic to service layer and just return the response entity
23
Upvotes
4
u/mailaffy Feb 25 '24
Sole purpose of controller to get the request and hand it over to service and propagate response from service back to response handler. So managing DTO in controller can be done but not a clean practice.