The conversion between Java classes requires only additional annotation, reducing the tedious and error-prone development task
Based on the annotation processors, all of the generation is done at compile time
Property conversions are based on getter/setter methods in the class
Support JDK8~17、SpringBoot2~3
Support for a single class to configure multiple type conversions
More powerful map-to-object functionality
<dependency>
<groupId>io.github.linpeilie</groupId>
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
<version>1.4.6</version>
</dependency>
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.6'
SpringContextUtils
class name to prevent conflicts with other project class names;AutoMapping
、AutoMappings
、ReverseAutoMapping
、ReverseAutoMappings
features.ReverseAutoMapping
configuration did not take effect.spring-lazy
option to ComponentModel
for lazy loading Spring Beans, resolving mutual dependency issues, and set this option as the default configuration.unmappedTargetPolicy
was not effective.mapperNameSuffix
attribute to the AutoMapper
annotation. This supports adding a suffix to the generated conversion interface name, and the reverse conversion interface will be effective under the default rules.Mapper
annotation to support the following attributes: unmappedSourcePolicy
, unmappedTargetPolicy
, typeConversionPolicy
, collectionMappingStrategy
, nullValueMappingStrategy
, nullValueIterableMappingStrategy
, nullValuePropertyMappingStrategy
, nullValueCheckStrategy
, and mappingControl
.Mapping
annotation to support the following attributes: constant
, qualifiedBy
, nullValueCheckStrategy
, nullValuePropertyMappingStrategy
, and mappingControl
.typeConversionPolicy
, collectionMappingStrategy
, nullValueIterableMappingStrategy
, nullValueMapMappingStrategy
, nullValueCheckStrategy
, mappingControl
, unexpectedValueMappingException
, and suppressTimestampInGenerated
.reverseConvertGenerate
attribute to the AutoMapping
annotation to control whether to generate reverse conversion logic, adapting to more complex application scenarios.targetClass
.useEnums
attribute to AutoMapper
, supporting manual configuration of required enums for conversion, solving the issue of automatic conversion of enums across modules.AutoMapping
、ReverseAutoMapping
supports qualifiedByName
,conditionQualifiedByName
,and dependsOn
properties.AutoMappings
supports configuration on methods.Points to note for upgrading 1.4.0
- 1.4.0 and later versions, complex object comparisons reply on
ConvertMapperAdapter
generated in the project, which may causeNoSuchMethodError
exceptions under multiple modules because the Class Loading mechanism will load only one, of course, this problem has been around before, and the odds are probably lower, so be sure to configure theadapterPackage
to avoid this problem with multiple modules.- Map to object conversions still rely on class conversions in hutool, and additional
hutool-core
dependencies need to be introduced if this functionality is required.
……