Skip to content

org.mapstruct don’t work with a base class

I have 2 classes. My base class:

public class BaseRequest {

   private String dateTransaction;

   private String hourTransaction;


And my other class. This class extends BaseRequest class.

public class AddClass extends BaseRequest {

   private String additionalData60;


And When I try create a mapper to cast my AddClass to OtherClass:

@Mapper(componentModel = "spring", uses = {})
public interface OtherMapper{

        @Mapping(source = "hourTransaction", target = "timeTransaction"),
        @Mapping(source = "dateTransaction", target = "dateTransaction"),
        @Mapping(source = "additionalData60", target = "additionalData60"),
   OtherClass toOtherClass(AddClass addClass);


When I run my build I received this error:

Error:(22,13) java: No property named “dateTransaction” exists in source parameter(s). Did you mean “null”?


MapStruct works without issues with Lombok.

However, if you have upgraded to Lombok 1.18.16 as per the Lombok Changelog then you need to add


In Gradle:

annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.1.0"