Skip to main content

What is the best practice of copying Entity to DTO? 

Post link: https://www.facebook.com/groups/jugbd/posts/3282022541844408/

Muhammad Shakhawat Hossain Safat: I recommend Mapstruct. Few good reasons to choose Mapstruct over other converters –

  1. Good performance: Traditional converters are XML config and reflection based. Mapstruct generates the implementation during compile time. So, its performance is the same as hand-crafted converters.
  2. Clean and concise code: It’s annotation-based. You need to define a mapper interface and the necessary annotations.
  3. Extensible: Easy to add a custom conversion logic.
  4. Growing community: There are many good resources to learn to help debug.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.