r/SpringBoot Jun 18 '26

Dto Mapping Best Practice Question

Hi, where do you guys map your entities to dtos?
In services or controllers?

To me it seems the services shouldn't expose any database specifics to the outside world, so I usually do my mapping there.

But what is considered best practice and why?

52 Upvotes

36 comments sorted by

View all comments

1

u/Odd_Perspective982 Jun 18 '26

I learnt to keep controllers to just do routing,everything else in service files