Tagged articles
MapStruct
67 articles · Page 1 of 1
This article identifies five common MapStruct misuses — complex logic in @Mapping expressions, missing bidirectional relationship handling, over-mapping in hot paths, injecting business services into mappers, and naive PATCH updates — and shows correct Java alternatives for each case.
Code MaintainabilityJPAJava
0 likes · 11 min read

The article walks through creating a SpringBoot project from scratch, covering IDE setup pain points, project initialization, version compatibility between SpringBoot, Spring Cloud and Kafka, Maven dependency management, core scaffold classes such as global exception handling, logging aspect, CORS and Swagger configuration, and recommends useful tools like embedded Redis, MariaDB, Hutool, MyBatis‑Plus, MapStruct and Redisson.
KafkaMapStructMaven
0 likes · 11 min read

This article presents a comprehensive production-grade approach to API version management in Spring Boot, covering version identification strategies, custom routing via RequestCondition, DTO isolation with MapStruct, deprecation interceptors with Prometheus metrics, gateway-level traffic splitting using Spring Cloud Gateway and Nginx, and a lifecycle state machine with automated retirement rules.
API versioningMapStructOpenAPI
0 likes · 18 min read

This article presents eight ready‑to‑use Spring Boot 3.5.0 code snippets—including MapStruct converters, embeddable collections, i18n helpers, secure random generators, custom runtime exceptions, type‑safe configuration properties, JPA auditing, and custom validation annotations—each illustrated with concrete examples and runnable code.
MapStructconfiguration-propertiescustom-exception
0 likes · 13 min read

By benchmarking manual mapping, MapStruct, and JPQL projection across simple and relational scenarios, the article shows that JPQL is slightly faster in raw tests, but the real performance impact stems from N+1 queries, making query strategy the key factor rather than the mapping technique itself.
DTOEntity MappingMapStruct
0 likes · 8 min read

The article shows how Spring Boot projects can replace repetitive, error‑prone Entity‑DTO‑VO conversion code with a concise MapStruct and Lombok combo, detailing setup, simple and advanced mappings, and the measurable productivity gains it brings.
DTO mappingJavaLombok
0 likes · 6 min read

A Spring Boot 3.4.2 tutorial compares four entity‑to‑DTO conversion strategies—manual mapping, MapStruct, JPQL DTO projection, and JPQL record projection—using JMH benchmarks on an H2 in‑memory database, revealing that JPQL projection is roughly three times faster than the other approaches.
DTOJMHJPA
0 likes · 9 min read

This article examines the drawbacks of using Lombok in Java projects, demonstrates how replacing Lombok annotations with Java Records, explicit constructors, and MapStruct improves code readability, IDE support, and runtime safety, and shares the measurable benefits of the migration.
JavaLombokMapStruct
0 likes · 5 min read

This guide introduces MapStruct, a Java annotation‑based mapper that outperforms BeanUtils by providing fast, type‑safe conversions between PO, VO, DTO and nested objects, supporting collections, custom logic, dependency injection, constants, expressions, and exception handling within Spring Boot applications.
DTOMapStructObject Mapping
0 likes · 17 min read

BeanUtils.copyProperties, a convenient Apache Commons utility for Java bean copying, harbors multiple hidden pitfalls—including reflection overhead, unsafe type conversion, null‑value overwrites, shallow copy issues, and limited depth—so developers should evaluate modern alternatives like MapStruct, Dozer, or manual mapping for better performance and safety.
BeanUtilsDeep CopyJava
0 likes · 7 min read

MapStruct is a compile‑time Java annotation processor that generates type‑safe mapping code, offering concise, high‑performance conversions with features such as expressions, qualifiedByName methods, null‑value strategies, and decorators, illustrated through detailed code examples and usage guidelines.
DecoratorJavaMapStruct
0 likes · 7 min read

This article introduces MapStruct, a compile‑time Java bean‑mapping framework, and demonstrates advanced features such as expression‑based mappings, qualifiedByName for custom conversions, nullValueMappingStrategy for handling nulls, and the use of Decorator classes to apply global post‑processing logic.
DecoratorJavaMapStruct
0 likes · 6 min read

This article examines the drawbacks of Lombok, demonstrates how replacing Lombok annotations with Java Records and MapStruct improves readability, type safety, and debugging, and shows the concrete benefits of reducing boilerplate and achieving compile‑time safety in Java backend projects.
Java RecordsLombokMapStruct
0 likes · 6 min read

This article examines the drawbacks of Lombok—such as reduced readability, IDE instability, and debugging challenges—and demonstrates how replacing Lombok annotations with Java Records, explicit constructors, and MapStruct for mapping yields cleaner, type‑safe, and maintainable code while eliminating boilerplate.
Java RecordsLombokMapStruct
0 likes · 5 min read

MapStruct is a compile‑time Java annotation processor that automates bean mapping, offering concise, high‑performance, type‑safe conversions, and advanced features such as expression mapping, qualifiedByName methods, null‑value strategies, and decorators, with full IDE support and illustrative code examples.
Annotation ProcessorJavaMapStruct
0 likes · 7 min read

This article introduces MapStruct, a compile‑time Java bean mapping framework, and demonstrates advanced features such as expression‑based mappings, qualifiedByName custom converters, nullValueMappingStrategy handling, and decorator‑based post‑processing with concrete code examples for Spring‑based projects.
Annotation ProcessingJavaMapStruct
0 likes · 6 min read

This article compares the performance of several Java bean‑mapping utilities—including Spring BeanUtils, Apache BeanUtils, Orika, Cglib BeanCopier, ModelMapper, MapStruct, and manual getter/setter code—by converting a sample Entity to a DTO 10,000 times and summarizing the results and best‑use recommendations.
CGLIBDTOMapStruct
0 likes · 10 min read

The article analyzes common Java property‑copy utilities, showing how tools like Spring BeanUtils, CGLIB BeanCopier and MapStruct can suffer from poor performance and runtime type‑conversion errors, and recommends using explicit converters generated by IDE plugins to avoid hidden bugs.
BeanUtilsJavaMapStruct
0 likes · 9 min read

This article introduces MapStruct, a compile‑time Java bean mapping framework, and walks through its key features, expression mapping, qualifiedByName custom methods, null‑value strategies, and decorator usage, providing code examples for each advanced scenario.
Annotation ProcessingMapStructbean-mapping
0 likes · 7 min read

This article clarifies the purpose of Java classes ending with “O”—BO, DTO, VO, PO—explains their proper usage in a typical front‑end/back‑end workflow, and compares mapping solutions like Spring BeanUtils and MapStruct with code examples.
BODTOJava
0 likes · 6 min read

This article introduces MapStruct, a compile‑time Java bean‑mapping framework, and demonstrates advanced features such as expression mapping, qualifiedByName for custom conversions, null‑value handling strategies, and the use of decorators to extend mapper behavior, complete with code examples.
DecoratorJavaMapStruct
0 likes · 7 min read

This article explains the drawbacks of manual property copying and traditional bean utilities, introduces MapStruct as a compile‑time, high‑performance mapper with type‑safety, deep‑copy support, collection handling, and customizable field‑ignoring, and shows practical Maven and Lombok integration examples.
Bean CopyJavaMapStruct
0 likes · 13 min read

This article explains why manual property copying in layered Java applications is inefficient, compares runtime copiers like BeanUtils and BeanCopier, and demonstrates how MapStruct provides compile‑time, type‑safe, high‑performance bean mapping with support for deep copy, collection mapping, field ignoring, and Lombok integration.
JavaMapStructbackend development
0 likes · 10 min read

This article explains why generic Java bean property copy utilities like Spring BeanUtils, Apache Commons BeanUtils, and CGLIB can cause runtime type conversion errors and performance issues, demonstrates the problems with code examples, and recommends using custom converters or IDE‑generated mapping code such as MapStruct for safe and efficient object transformation.
BackendBeanUtilsCGLIB
0 likes · 8 min read

MapStruct is a compile‑time Java bean‑mapping generator that, when added as an annotation processor in Maven, Gradle or an IDE, lets developers define @Mapper interfaces to automatically produce type‑safe, high‑performance implementations—including custom field mappings, nested collections, and lifecycle hooks—thereby eliminating boilerplate code and centralizing mapping logic.
Annotation ProcessorJavaMapStruct
0 likes · 17 min read

This article explains the roles of DTO, VO, and PO in Java applications, compares manual property copying with BeanUtils and MapStruct, provides complete code examples for both approaches, and offers guidance on choosing the appropriate method based on performance and project needs.
BackendBeanUtilsDTO
0 likes · 13 min read

Spring’s BeanUtils.copyProperties is error‑prone and slow due to type mismatches, primitive‑wrapper issues, null overwrites and reflection, whereas MapStruct generates compile‑time, type‑safe mapper code that avoids these pitfalls, delivers far better performance, and integrates easily with Maven and Lombok.
BeanUtilsJavaMapStruct
0 likes · 6 min read

The article explains the limitations of Spring's BeanUtils.copyProperties—such as type mismatches, null overwriting, and reflection overhead—and demonstrates how MapStruct provides a faster, compile‑time generated alternative for copying properties between Java objects, with usage examples and Maven setup.
BeanUtilsJavaMapStruct
0 likes · 6 min read

A Java backend debugging story explains how using BeanUtils.copyProperties led to a ClassCastException when a HashMap was cast to a custom class, details the investigation steps, shows the problematic code, and presents a manual assignment solution plus recommendations for safer mapping tools.
BeanUtilsClassCastExceptionCopyProperties
0 likes · 4 min read

This article explains why manual property copying in Java is inefficient, compares several runtime bean‑copy utilities, and demonstrates how MapStruct provides a compile‑time, type‑safe, high‑performance solution for shallow and deep object mapping, including handling of collections and ignored fields.
CGLIBJavaMapStruct
0 likes · 13 min read

This article reviews common Java bean‑copy utilities—including Apache BeanUtils, Spring BeanUtils, cglib BeanCopier, Hutool BeanUtil, MapStruct, and Dozer—explaining their dependencies, usage examples, shallow versus deep copy behavior, and how to choose the right tool for backend development.
DozerJavaMapStruct
0 likes · 12 min read

This article explains why manual property copying in layered Java applications is inefficient, compares traditional approaches such as manual setters, Spring BeanUtils, and CGLIB BeanCopier, and demonstrates how MapStruct provides high‑performance, type‑safe, compile‑time generated mappers with support for deep copy, collection mapping, field ignoring, and Lombok integration.
BeanMappingCodeGenerationDeepCopy
0 likes · 10 min read

This article introduces the open‑source MapStruct library, shows how to configure Maven and Lombok dependencies, defines entity and DTO classes with Lombok annotations, creates a mapper interface, and demonstrates simple, list, multi‑source, and default‑value mappings with complete code examples.
DTOEntity MappingJava
0 likes · 11 min read


政采云技术Jun 20, 2023 · Backend Development
This article examines the limitations of BeanCopy for Java DTO mapping—such as inheritance handling, recursive copying, lack of complex type support, performance overhead, and opaque assignments—and demonstrates how MapStruct can address these issues with compile‑time generated, type‑safe mappers.
BeanCopyDTOJava
0 likes · 9 min read

This article introduces MapStruct, explains the challenges of JavaBean conversion, shows how to add dependencies, define POJOs and DTOs, create mapper interfaces with @Mapper, demonstrates basic and advanced mapping scenarios—including custom methods, nested objects, and dependency injection—while highlighting its performance and debugging benefits.
Annotation ProcessorJavaMapStruct
0 likes · 17 min read

This article introduces MapStruct, explains why JavaBean conversion is challenging, shows how to add Maven dependencies, define POJOs and DTOs, create mapper interfaces, run tests, and explores its performance benefits, simple usage, debugging advantages, and advanced features such as custom mappings, multi‑source mapping, bean updates, and integration with dependency injection.
Annotation ProcessorJavaMapStruct
0 likes · 16 min read

Upgrading the Hutool library from 5.7.2 to 5.8.8 caused unexpected BeanUtil.copyProperties failures due to new validation logic, prompting a detailed analysis of the issue and a comparison of safer object‑mapping approaches such as explicit getters/setters, ModelMapper, and MapStruct.
BeanCopyHutoolJava
0 likes · 6 min read

This article introduces the open‑source MapStruct library for Java, shows how to configure Maven, defines entity and DTO classes, demonstrates basic and advanced mapping techniques—including list conversion, multi‑object merging, and default values—while providing complete code examples and explanations.
Entity MappingJavaMapStruct
0 likes · 11 min read

This article introduces MapStruct, a compile‑time Java bean‑mapping code generator, explains its core concepts, shows step‑by‑step examples—including Maven dependencies, entity and DTO definitions, mapper interfaces, custom conversions, and advanced configurations—while comparing its performance to other copy utilities and highlighting deep‑copy behavior.
JavaMapStructMaven
0 likes · 13 min read

The article explains why using automatic property copy utilities in Java can lead to performance degradation, hidden type‑conversion bugs, and runtime errors, and demonstrates safer approaches such as manually written converters, IDE‑generated code, and MapStruct with concrete examples and code snippets.
BeanUtilsMapStructType Conversion
0 likes · 8 min read

The article explains the performance drawbacks, hidden type‑conversion bugs, and runtime errors caused by generic Java property‑copy utilities such as BeanUtils and CGLIB, and demonstrates how compile‑time‑checked tools like MapStruct can safely handle conversions.
BackendBeanUtilsMapStruct
0 likes · 8 min read

This article explains how to replace repetitive getter/setter code with MapStruct by showing dependency setup, defining source and target classes, creating mapper interfaces with @Mapping annotations, testing the conversion, and handling common integration issues such as Swagger conflicts.
MapStructSpringbean-mapping
0 likes · 6 min read

This article explains why using automatic property copy utilities like Spring BeanUtils, CGLIB BeanCopier, or MapStruct can lead to hidden type conversion errors in Java, compares their performance, demonstrates pitfalls with generic type erasure, and recommends writing explicit conversion classes to avoid runtime bugs.
BeanUtilsCGLIBJava
0 likes · 9 min read

The article explains that when using MapStruct with Lombok, Maven must list Lombok before MapStruct (or define annotationProcessorPaths) so Lombok’s annotation processor runs first, and then demonstrates basic and advanced mapping techniques, Spring integration, and singleton caching strategies.
Annotation ProcessingJavaLombok
0 likes · 17 min read

MapStruct dramatically outperforms Spring's BeanUtils for Java object mapping by generating compile-time code that avoids reflection, achieving roughly ten-to-thirty times faster conversions—even across dozens of fields—while requiring only simple PO/Entity definitions and optional @Mapping annotations, making it a superior, low-learning-curve replacement.
BeanUtilsJavaMapStruct
0 likes · 14 min read

This article explains how MapStruct simplifies Java object‑to‑DTO mapping by defining mapping rules, demonstrates various features such as default methods, abstract mappers, multiple parameters, @MappingTarget updates, handling of fields without getters/setters, Spring integration, and custom type conversions with clear code examples.
DTOMapStructObject Mapping
0 likes · 17 min read

Learn how to efficiently convert between Java entities and DTOs using MapStruct, covering basic mappings, default methods, abstract classes, multiple parameters, update operations, Spring integration, and custom type conversions, with complete code examples and explanations to streamline data transfer in backend applications.
DTOJavaMapStruct
0 likes · 18 min read

This article introduces MapStruct’s new Spring extension, shows how to replace manual BeanUtil conversions with generated mappers, explains the Spring Converter interface, and demonstrates custom configuration and integration with ConversionService for seamless DTO/VO/PO transformations in Java backend projects.
ConversionServiceJavaMapStruct
0 likes · 8 min read

This article explains how to replace manual BeanUtil mapping with MapStruct, leverage Spring's Converter interface, and use the MapStruct Spring Extensions plugin to automatically register mappers with ConversionService, including custom adapter configuration and integration of built‑in Spring converters.
ConversionServiceJavaMapStruct
0 likes · 8 min read

This article explains how MapStruct, a Java annotation‑processor library, can automatically generate mapper implementations to convert between entities and DTOs, covering basic usage, default methods, abstract classes, multiple source parameters, update operations, handling fields without getters/setters, Spring injection and custom type conversions.
Annotation ProcessorDTOMapStruct
0 likes · 16 min read

This article explains the different POJO variants—VO, BO, PO, DTO, and DO—describes their typical usage in layered Java applications, introduces the Simple Object Copy IntelliJ plugin for one‑click conversion method generation, compares it with common mapping tools such as MapStruct and BeanUtils, and discusses performance and flexibility advantages.
BeanUtilsIDE pluginJava
0 likes · 10 min read

This article evaluates twelve Java object‑property mapping libraries—including MapStruct, ModelMapper, Dozer, and BeanUtils—by measuring their performance across 100 to one‑million conversions, presenting code examples, rating each tool, and recommending the most efficient solution for backend development.
JavaMapStructObject Conversion
0 likes · 12 min read

This article introduces MapStruct, explains its purpose as a compile‑time Java bean mapper, walks through a complete example with Maven dependencies, entity and DTO classes, mapper interfaces, custom mappings, and configuration options, and compares its performance with other copying libraries.
MapStructbean-mappingcode-generation
0 likes · 15 min read

This article examines the performance drawbacks and hidden type‑conversion issues of common Java property‑copy utilities such as Spring BeanUtils, CGLIB BeanCopier, and MapStruct, demonstrates concrete code examples, and recommends using explicit conversion classes or IDE‑generated getters/setters to avoid runtime errors.
BeanUtilsJavaMapStruct
0 likes · 9 min read

This article introduces four essential Java open‑source libraries—MapStruct, Retrofit, Faker, and Wiremock—explaining their purposes, advantages over traditional approaches, and providing concise code examples to help developers streamline object mapping, HTTP communication, test data generation, and service mocking.
FakerMapStructOpen-source
0 likes · 12 min read

This article introduces MapStruct, a powerful Java annotation‑based object‑mapping library, compares it with BeanUtils, shows how to integrate it into a Spring Boot project, and provides step‑by‑step examples for basic, collection, nested, composite, and advanced mappings including dependency injection, constants, custom processing, and exception handling.
DTOJavaMapStruct
0 likes · 24 min read

This article introduces the open‑source MapStruct library for Java, shows how to configure Maven and Lombok, provides step‑by‑step code examples for basic and advanced entity‑to‑DTO mappings—including list conversions, multi‑object mappings, and default values—so developers can replace boilerplate conversion code with clean, type‑safe mappings.
LombokMapStructMaven
0 likes · 10 min read

This article introduces the open‑source MapStruct library for Java, showing how to configure Maven dependencies, define entity and DTO classes with Lombok, create mapper interfaces, and perform simple and advanced object conversions such as list mapping, multi‑object merging, and default value handling.
Entity MappingJavaLombok
0 likes · 9 min read

This article examines the drawbacks of using Java property copy utilities such as Spring BeanUtils, CGLIB BeanCopier, and Apache Commons BeanUtils, demonstrates type‑conversion errors through code examples, compares their performance, and recommends defining explicit conversion classes or using MapStruct for safer, compile‑time‑checked mappings.
BeanUtilsCGLIBJava
0 likes · 7 min read

This article examines the pitfalls of Java property‑copy utilities such as Spring BeanUtils, CGLIB BeanCopier, and MapStruct, demonstrating performance drawbacks and runtime type‑conversion errors through concrete examples, and recommends defining explicit conversion classes or using IDE‑generated code to avoid hidden bugs.
BeanUtilsJavaMapStruct
0 likes · 9 min read

This article explains why using generic property copy utilities like Apache Commons BeanUtils, Spring BeanUtils, CGLIB BeanCopier, or MapStruct can lead to performance degradation, type‑conversion errors, and hidden bugs in Java applications, and recommends defining explicit conversion classes with IDE‑generated getters and setters for safer, compile‑time‑checked mappings.
BeanUtilsCGLIBJava
0 likes · 9 min read

This article examines the hidden risks and performance drawbacks of Java bean property copy utilities such as Spring BeanUtils, CGLIB BeanCopier, and MapStruct, demonstrates concrete examples of type‑conversion errors, and recommends custom converters or IDE‑generated mapping code for reliable data transfer.
BeanUtilsCGLIBJava
0 likes · 9 min read

This article introduces MapStruct, explains why traditional JavaBean conversion methods like reflection are inefficient, shows how to set up Maven dependencies, define entities and DTOs, write mapper interfaces, run tests, and highlights the performance, debugging, simplicity, and dependency‑free advantages of the generated code.
Annotation ProcessorJavaMapStruct
0 likes · 8 min read

This article introduces MapStruct, a type‑safe, high‑performance, dependency‑free Java bean mapping annotation processor, explains the problems with manual and reflection‑based conversions, provides step‑by‑step Maven setup, entity/DTO definitions, mapper interface, and a JUnit test, and discusses its performance, debugging, and simplicity advantages.
Annotation ProcessorJavaMapStruct
0 likes · 9 min read

This article introduces MapStruct, a compile‑time Java bean‑mapping framework, explains why it outperforms other mappers, shows how to configure Maven, define mapper interfaces, handle custom field mappings, and demonstrates its impressive runtime performance with practical code examples.
JavaMapStructbean-mapping
0 likes · 13 min read

This article introduces MapStruct, a Java annotation‑processor that automatically generates bean‑mapping code, compares it with manual setters and Spring/Apache BeanUtils, and demonstrates how to handle property name differences, collections, type conversions, and multi‑source mappings through clear examples and code snippets.
Annotation ProcessorJavaMapStruct
0 likes · 11 min read

Learn how to efficiently convert between PO, VO, and DTO objects in Java using Spring BeanUtils for identical fields and MapStruct for custom mappings, including single objects, lists, and merging multiple sources, with full Maven setup and generated implementation details.
DTOJavaMapStruct
0 likes · 7 min read
