mirror of
https://gitee.com/easii/mapstruct-plus.git
synced 2025-12-06 17:18:43 +08:00
release 1.3.2
This commit is contained in:
parent
87055f0fdc
commit
20fecd0bd4
@ -61,7 +61,7 @@ public class User {
|
||||
|
||||
```xml
|
||||
<properties>
|
||||
<mapstruct-plus.version>1.3.1</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.3.2</mapstruct-plus.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -56,27 +56,22 @@ copyright: false
|
||||
<dependency>
|
||||
<groupId>io.github.linpeilie</groupId>
|
||||
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- gradle
|
||||
|
||||
```groovy
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.3.1'
|
||||
implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.3.2'
|
||||
```
|
||||
|
||||
## 更新日志
|
||||
|
||||
### 1.3.1
|
||||
### 1.3.2
|
||||
|
||||
- 增加编译参数中指定配置类的功能
|
||||
- 更好地适配 IDEA 部分编译场景
|
||||
|
||||
### 1.3.0
|
||||
|
||||
- fix: 解决本地开发时 IDEA 编译或者运行时报错等与预期不一致的问题
|
||||
- feature: AutoMapper 注解增加 imports 属性支持
|
||||
- 不可变对象支持,可以使用任意包下的 `Immutable` 标注类型为不可变类
|
||||
- 全面适配 IDEA 部分编译问题,使用更加流畅丝滑
|
||||
|
||||
……
|
||||
|
||||
|
||||
@ -514,3 +514,17 @@ public class CarDtoToCarMapperImpl implements CarDtoToCarMapper {
|
||||
|
||||
如果还是不理解,这里可以认为,该注解就是本该应用在目标类中的 `@AutoMapping` 注解,原封不动拷贝到当前类,再修改注解名称即可。
|
||||
|
||||
## 不可变类型设计
|
||||
|
||||
> since 1.3.2
|
||||
|
||||
当一个类型是不可变类型时,之前默认的规则,生成的 `T convert(S source, @MappingTarget T target)` 可能会存在问题。
|
||||
|
||||
所以,可以使用任意包下的 `Immutable` 注解,标识一个类为不可变类型,
|
||||
当为不可变类型时,`@MappingTarget` 没有意义,上面的方法最终生成如下:
|
||||
|
||||
```java
|
||||
public T convert(S source, @MappingTarget T target) {
|
||||
return target;
|
||||
}
|
||||
```
|
||||
@ -23,10 +23,13 @@ public class MapStructPlusConfiguration {
|
||||
}
|
||||
```
|
||||
|
||||
:::warning
|
||||
**当使用该方式配置时,强烈建议,在编译参数中,指定配置类为当前类,以解决IDEA部分编译场景时出现的各种问题,该功能从 1.3.1 开始支持**
|
||||
:::info
|
||||
|
||||
配置时,需要在启动参数中添加 `-Amapstruct.plus.mapperConfigClass` 参数,该参数的值为配置类的全路径名称:
|
||||
1.3.2 已彻底适配 IDEA 部分编译,无需再添加如下配置。
|
||||
|
||||
~~当使用该方式配置时,强烈建议,在编译参数中,指定配置类为当前类,以解决IDEA部分编译场景时出现的各种问题,该功能从 1.3.1 开始支持
|
||||
|
||||
配置时,需要在启动参数中添加 `-Amapstruct.plus.mapperConfigClass` 参数,该参数的值为配置类的全路径名称~~:
|
||||
|
||||
```xml
|
||||
<plugin>
|
||||
|
||||
@ -6,6 +6,11 @@ category:
|
||||
description: MapStructPlus release log
|
||||
---
|
||||
|
||||
### 1.3.2
|
||||
|
||||
- 不可变对象支持,可以使用任意包下的 `Immutable` 标注类型为不可变类
|
||||
- 全面适配 IDEA 部分编译问题,使用更加流畅丝滑
|
||||
|
||||
### 1.3.1
|
||||
|
||||
- 增加编译参数中指定配置类的功能
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mapstruct.version>1.5.1.Final</mapstruct.version>
|
||||
<mapstruct-plus.version>1.3.2-SNAPSHOT</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.3.2</mapstruct-plus.version>
|
||||
<lombok.version>1.18.22</lombok.version>
|
||||
</properties>
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -17,7 +17,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<mapstruct-plus.version>1.3.2-SNAPSHOT</mapstruct-plus.version>
|
||||
<mapstruct-plus.version>1.3.2</mapstruct-plus.version>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user