Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Java
  3. MapStruct

MapStruct

NOASSERTIONJava1.6.3

A Java annotation processor for generating type-safe, high-performance bean mappers at compile time.

Visit WebsiteGitHubGitHub
7.6k stars1.0k forks0 contributors

What is MapStruct?

MapStruct is a Java annotation processor that generates type-safe and high-performance mappers for Java bean classes, including support for Java 16+ records. It automates the tedious process of writing mapping code between objects, reducing errors and improving maintainability. By operating at compile time, it ensures that mappings are correct and efficient, integrating seamlessly into modern Java projects.

Target Audience

Java developers working on applications that require frequent mapping between different object models, such as converting entities to DTOs, handling API payloads, or managing data transformations in layered architectures.

Value Proposition

Developers choose MapStruct for its compile-time type safety, which catches mapping errors early, and its high performance due to the use of plain method invocations instead of reflection. It eliminates runtime dependencies and generates debuggable code, offering a robust alternative to manual mapping or runtime-based frameworks.

Overview

An annotation processor for generating type-safe bean mappers

Use Cases

Best For

  • Converting JPA entities to data transfer objects (DTOs) in Spring Boot applications
  • Mapping between complex domain models and API request/response objects
  • Reducing boilerplate code in microservices that frequently transform data
  • Ensuring type-safe mappings in large-scale Java projects with many object layers
  • Improving performance in applications where reflection-based mapping is a bottleneck
  • Handling mappings involving Java records and modern Java features

Not Ideal For

  • Applications requiring runtime modification of mapping logic without recompilation
  • Projects with only a few simple object conversions where annotation processor setup overhead isn't worthwhile
  • Teams deeply reliant on reflection-based frameworks like Jackson's ObjectMapper for dynamic, ad-hoc mappings

Pros & Cons

Pros

Compile-Time Type Safety

Catches mapping errors during build with clear error reports for incomplete or incorrect mappings, preventing runtime failures as highlighted in the README.

High Performance Mappings

Uses plain method invocations instead of reflection, resulting in fast execution compared to runtime-based frameworks, a key advantage noted in the features.

Zero Runtime Dependencies

Generates self-contained code with no runtime libraries, keeping applications lightweight and reducing dependency bloat.

Debuggable Generated Code

Produces readable Java source code that can be manually edited or debugged, improving maintainability and troubleshooting, as emphasized in the README.

Cons

Build Configuration Complexity

Requires precise annotation processor setup in Maven or Gradle, which can be error-prone for newcomers or in multi-module projects, despite the provided examples.

Static Mapping Generation

Mappings are fixed at compile time and cannot be altered dynamically, making it unsuitable for scenarios where mappings need to change without recompilation.

IDE Plugin Dependencies

Full IDE support, especially for Eclipse, relies on plugins that are still in development or require additional configuration, potentially hindering the developer experience.

Frequently Asked Questions

Quick Stats

Stars7,646
Forks1,016
Contributors0
Open Issues461
Last commit4 days ago
CreatedSince 2012

Tags

#object-mapping#annotation-processor#type-safety#java#mapping#code-generation#performance#compile-time

Built With

M
Maven
J
Java
G
Gradle

Links & Resources

Website

Included in

Java47.5k
Auto-fetched 1 day ago

Related Projects

ModelMapperModelMapper

Intelligent object mapping

Stars2,351
Forks348
Last commit5 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub