title: Mapstruct 'aftermapping' not called
body: <p>The problem is that, methods annotated with <code>@AfterMapping</code> are not called at all. From the <code>testToEntityMapping</code> it goes to <code>toEntity</code> method but it doesn't call any of the <code>toEntityAfterMapping()</code> methods. Why ? Is it possible ? how can I achieve that using MapStruct ?</p>
  
  <p>(Here I have prepared a scenario that is meaningless but it fully captures the essence of my question)<br>
  Entity:</p>
  
  <pre><code>public class Ford {
      private String color;
      private String market;
      private int totalWidth;
  
      //getters and setters omitted for brevity
  }
  </code></pre>
  
  <p>Dtos:</p>
  
  <pre><code>public abstract class FordDto {
      public String market;
      public String color;
  
      //getters and setters omitted for brevity
  }
  
  public class EuropeanFordDto extends FordDto{
      private int totalWidth;
  
      public int getTotalWidth() {
          return totalWidth + 2;//"+2" for EU market
      }
      //setter omitted for brevity
  }
  
  public class AmericanFordDto extends FordDto{
      private int totalWidth;
  
      public int getTotalWidth() {
          return totalWidth + 1;//"+1" for US market
      }
  
      //setter omitted for brevity
  }
  </code></pre>
  
  <p>Mappers:</p>
  
  <pre><code>public abstract class FordMapper&lt;D extends FordDto&gt; {
      public Ford toEntity(D dto) {
  
          /* fill in fields common to both ford versions */
  
          final Ford ford = new Ford();
  
          ford.setColor(dto.getColor());
          ford.setMarket(dto.getMarket());
  
          return ford;
      }
  }
  @Mapper(componentModel = "spring")
  public abstract class EuropeanFordMapper extends FordMapper&lt;EuropeanFordDto&gt; {
  
      @AfterMapping
      public void toEntityAfterMapping(final EuropeanFordDto dto, @MappingTarget final Ford entity) {
  
          /* Fill in fields related to european version of the ford */
  
          entity.setTotalWidth(dto.getTotalWidth());
      }
  }
  @Mapper(componentModel = "spring")
  public abstract class AmericanFordMapper extends FordMapper&lt;AmericanFordDto&gt; {
  
      @AfterMapping
      public void toEntityAfterMapping(final AmericanFordDto dto, @MappingTarget final Ford entity) {
  
          /* Fill in fields related to american version of the ford */
  
          entity.setTotalWidth(dto.getTotalWidth());
      }
  }
  </code></pre>
  
  <p>Service:</p>
  
  <pre><code>@Service
  public class CarService {
  
      @Autowired
      private AmericanFordMapper americanFordMapper;
      @Autowired
      private EuropeanFordMapper europeanFordMapper;
  
      public void testToEntityMapping(final FordDto dto) {
  
          if (dto instanceof AmericanFordDto) {
              americanFordMapper.toEntity((AmericanFordDto) dto);
          } else {
              europeanFordMapper.toEntity((EuropeanFordDto) dto);
          }
      }
  }
  </code></pre>