Skip to content
Advertisement

Unable to map target properties using constructors with mapstruct

I am using MapStruct 1.5.2.Final

Map struct is unable to map the target values using the parameterised constructor. Following is the parameterised constructor for the class.

I know that if I would have exposed the setters, this would have worked.

I don’t want to expose the setters for my class as I want my class to be immutable.

JavaScript

I am getting the following error

JavaScript

Also, this is the only constructor in my class.

Following is my class

JavaScript

Advertisement

Answer

Your code seems fine. There must be something else in your project.

JavaScript

=> test is OK

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement