Skip to content

Tag: mapstruct

Can I extend MapStruct methods?

I’m developing a library and I expect the library to have a mapper like so: Which is meant for internal remapping. Now, I’d like to add a feature where the user can “override” this method, in the sense that they could for example add a statement to ignore the password of the account, w…

Spring Boot Mapstruct not woking mapping

My Dto model My main model My mapstruct class Hi everyone my project using mapstruct but my dto class user_id not mapping user please help me Thanks Answer This should solve the problem: Because you’re wanting to map user_id from CoverLetterDto to the User class in CoverLetter, you have to use dot notat…

MapStruct Java: property to list

Shortly, I’d like to move this code inside a mapstruct mapper: I’d like to have: Details My source class: where Results is: And ResultType: My Service class is getting a ResultSetType object from my Repository: I need to map resultSetType to List<Provincia>. So, I need to map resultSetType.r…

MapStruct mapper based on type

Consider the following simplified structure (that has both a DO and a DTO for each): For both I have a mapper that does the mapping between the DO and DTO, However, I am facing a problem and don’t really know how to handle it. If for the MotherboardComponent in the list I have another MotherboardCompone…

nullValuePropertyMappingStrategy not working

I have the following mapper The pokerRoomDto which is passed to it has a “phase” field which can be null. I want this field to be ignored when it is null. But right now the “null” value still gets mapped to the pokerRoom entity. If I just ignore the field in the mapper it works and the…