[ad_1]
I’m upgrading project mapstruct dependency from 1.2.0.Final to 1.4.2.Final.
Everything was going right util falling on a complex mapper which looks like the below snippet code:
@Mapper(componentModel = "spring")
public abstract class CustomMapper{
@Named("mapTestla")
@Mapping(target = "f", source = "t.f")
public abstract TestlaDTO mapTestla(Testla t) {}
@Named("mapBar")
@Mapping(target = "t", source = "b.t", qualifiedByName = "mapTestla")
public abstract BarDTO mapBar(Bar b) {}
@Mappings({@Mapping(target = "a", source = "f.a"),
@Mapping(target = "b", source = "f.b", qualifiedByName = "mapBar")})
public abstract FooDTO mapFoo(Foo f) {}
}
class Foo {
String a;
Bar b;
}
class Bar {
Tesla t;
}
class Testla {
String f;
}
class FooDTO {
String a;
Bar b;
}
class BarDTO {
TeslaDTO t;
}
class TestlaDTO {
String f;
}
As You see in the error, mapstruct didn’t detect the referenced method despite they are annotated with @Named
. It looks like a spring aop proxy problem..
Any idea of this issue?
PS: I don’t want to split the mapper into multiple mappers as we’re running behind schedule and it may lead to impact.
Error got:
Error : Qualifier error. No method found annotated with @Named#value: [ mapBar]. See https://mapstruct.org/faq/#qualifier for more info.
Error : Qualifier error. No method found annotated with @Named#value: [ mapTestla]. See https://mapstruct.org/faq/#qualifier for more info.
[ad_2]