[Open Source] Possibly the Simplest and Most Powerful Java Bean Conversion Tool, Making Conversions More Convenient and Elegant
![[Open Source] Possibly the Simplest and Most Powerful Java Bean Conversion Tool, Making Conversions More Convenient and Elegant](https://yy123.ink/api/img/1782596008777-vn1fi4.jpg)
1. Project Overview
MapStructPlus
Possibly the Simplest and Most Powerful Java Bean Conversion Tool
MapStruct Plus is an enhanced tool for MapStruct. Building on MapStruct, it provides automatic generation of Mapper interfaces and enhances certain features, making Java type conversion more convenient and elegant.
2. Open Source License
Licensed under Apache-2.0
3. Screenshots

4. Feature Overview
MapStruct Plus is an enhancement to the MapStruct framework. It adds functionality without modifying the original framework. With a single annotation, it can automatically generate conversion operations between two classes, eliminating the need to manually define MapStruct interfaces and making Java type conversion more convenient and elegant.
Goal: Build the Simplest and Most Powerful Type Conversion Tool
Features
Fast
Converting between Java classes requires only one additional annotation, reducing tedious and error-prone development tasks.
Efficient
Based on annotation processing, all code generation is completed at compile time.
Conversion
Property conversion is based on getter/setter methods in classes.
Compatible
Supports JDK 8–17 and Spring Boot 2–3.
Multiple Class Conversions
Supports configuring multiple type conversions for a single class.
Map to Object
More Powerful Map-to-Object Conversion
5. Tech Stack
Quick Start
The following example demonstrates how to use MapStruct Plus to map two objects.
Suppose there are two classes, UserDto and User, representing the data layer object and business layer object, respectively:
-
UserDto
-
User
Add Dependencies
Import
Add the mapstruct-plus-spring-boot-starter dependency:
Specify Object Mapping Relationships
Add the @AutoMapper annotation to either User or UserDto and set targetType to the other class.
For example:
Testing
Summary
After adding the dependency, using MapStruct Plus is very straightforward.
-
Add the AutoMapper annotation to the classes that need conversion.
-
Get the Converter instance and call the convert method.