How to use DTOs in spring, and the relationship between DTOs and entity

Source: Internet
Author: User

1. DTOs are the data structures used to transform the background data structure (JavaBean) into a user-friendly representation, while at the same time preventing the potential danger of back-office traffic being delivered directly to the foreground.

2. The converter interface provided by the Springbot framework can be used: Org.springframework.core.convert.converter.Converter, to implement conversion of entity classes and DTOs

3. DTOs are reasonable allocations should be: an entity corresponds to two dtos, 01. The DTO for the list listing page is for display only, and the DTO for the 02 newly edited page has a more complete and entity-like data structure used to store the foreground

4. When you need to use another entity for the current page, first use the other person's existing DTO

5. The conveter of DTOs should include 2, dto-entity, entity-dto

How to use DTOs in spring, and the relationship between DTOs and entity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.