Question regarding using Mapstruct Decorator

123 views
Skip to first unread message

MileHighGuy

unread,
Jun 28, 2018, 11:22:28 AM6/28/18
to mapstruct-users
Hi,

I am using with Spring Component Model and when i created a new Decorator using the approach described in the reference document. When i try to use the mapping after introducing the Decorator change,  i am getting NPE when the mapper method is being invoked from the delegate instance in the Mapstruct generated code. 
Not sure if the spring DI is not working or if i am missing any steps. 

Here are the annotations i have in Decorator code:

public abstract class PolicyWebServiceMapStructMapperDecorator implements PolicyWebServiceMapStructMapper { 
 @Autowired 
 @Qualifier("delegate") private PolicyWebServiceMapStructMapper delegate;
...


and here is the mapper code snippet

@Mapper(componentModel="spring")
@DecoratedWith(PolicyWebServiceMapStructMapperDecorator.class)
public interface PolicyWebServiceMapStructMapper {
          public B mapAToB(A a)
}

Thanks,
Santosh

Reply all
Reply to author
Forward
0 new messages