Project can be used as an example of how to add Mapstruct to the project and how can be used.
Next, Project for demonstrating how can be added unit tests for Mapstruct Mappers with SpringBoot.
Also, it is used to show the problems in testing mappers with SpringBootTest
in post
In general, we can see, how Mapstruct can help us to map complicated POJOs, here we have next POJO:
public class StudentDTO {
private Long id;
private String name;
private List<LectureDTO> lectures;
private List<LecturerDTO> lecturers;
}
// with LectureDTO
public class LectureDTO {
private Long id;
private String name;
}
//and LecturerDTO
public class LecturerDTO {
private Long id;
private String name;
}
Mapstruct helps us to map it to models and back without creating a lot of code for it.
public class StudentModel {
private Long id;
private String name;
private List<LectureModel> lectures;
private List<LecturerModel> lecturers;
}
//with LectureModel
public class LectureModel {
private Long id;
private String name;
}
//and LecturerModel
public class LecturerModel {
private Long id;
private String name;
}
mvn clean package
...
Please, follow RELEASE_NOTES.
- Roman Beskrovnyi - romankh3
...
Please, follow Contributing page.
Please, follow Code of Conduct page.
This project is Apache License 2.0 - see the LICENSE file for details