“ Mapstruct”是否可以使用mapstruct将空字符串映射为null?

问题描述 投票:0回答:1

我正在使用mapstruct在我的[[spring boot应用程序中将Dto映射到Entity,反之亦然。

我想知道,有没有一种我可以映射的方法,如果有任何字符串值以

empty

出现,使用mapstruct变为null@@ Mapping()有可能吗?

提前感谢

spring-boot mapstruct
1个回答
0
投票
您可以简单地在expression中使用expression

@Mapping

© www.soinside.com 2019 - 2024. All rights reserved.