J-Fall 2021: Joris Kuipers – Get Set Go! An intro to MapStruct
Organisation: Please excuse us for the lack of camera shots of the speaker MapStruct is a bean mapping tool. Doesn’t sound exciting? That might be because writing bean mapping code is, in fact, tedious even though it’s an important part of many enterprise Java applications. Be it between generated OpenAPI types and domain objects, between domain objects and JPA entities or in DDD anti-corruption layers, mapping state between similar but different types is a common concern. MapStruct is a tool that helps to automate this process as much as possible: not by using slow reflective code that fails at runtime, but by using code generation at compile time that produces readable, optimized code which can warn or even fail at build time when there are mismatches. This results not only in less work than hand-writing mapping code, but also in a safety net that will tell you when your types go out of sync. In this byte-size talk, Joris will explain how MapStruct works and cover several real-world use cases that will show why MapStruct should be your weapon of choice when it comes to bean mapping!