title: @MAPSTRUCT. No property named "packaging" exists in source parameter(s)
body: <p>I am writing an <code>MVC</code> <code>REST</code> application with <code>Spring Boot</code> and <code>Hibernate</code>. I decided to do <code>DTO</code> mapping using <code>MAPSTRUCT</code>. It seems that I did everything according to the guide, but an error is issued. What is the problem, I cannot understand. There is very little information on forums and on google.</p>
  <p>P.S. At first I thought that the problem was in <code>Lombok</code>, so I removed <code>Lombok</code> and manually assigned <code>getters / setters</code>. Then the problem was not solved. I took both in the <code>Drink</code> class and in the <code>DrinkDTO</code> I prescribed <code>getters / setters</code>. It still didn't help.</p>
  <p>Drink:</p>
  <pre class="lang-java prettyprint-override"><code>@Entity
  @Table(name = &quot;drink&quot;, schema = &quot;public&quot;)
  public class Drink {
  
      public Drink() { // Constructor for Hibernate
  
      }
  
  
      // Fields
      //
      private @Id
      @GeneratedValue
      Long id;
  
      @Column(name = &quot;name&quot;)
      private String name;
  
      @Column(name = &quot;price&quot;)
      private float price;
  
      @Column(name = &quot;about&quot;)
      private String about;
  
      @Column(name = &quot;is_deleted&quot;)
      private boolean isDeleted;
  
      // Relationships
      //
      @ManyToOne
      @JoinColumn(name = &quot;packaging_id&quot;)
      private Packaging packaging;
  
      @ManyToOne
      @JoinColumn(name = &quot;manufacturer_id&quot;)
      private Manufacturer manufacturer;
  
      @ManyToOne
      @JoinColumn(name = &quot;country_id&quot;)
      private Countries countries;
  }
  </code></pre>
  <p>DrinkDTO:</p>
  <pre class="lang-java prettyprint-override"><code>public class DrinkDTO {
  
      // Fields
      //
      private String drinkName;
  
      private float drinkPrice;
  
      private String drinkAbout;
  
      private Packaging drinkPackaging;
  
      private Manufacturer drinkManufacturer;
  
      private Countries drinkCountries;
  
  
      // Getters and Setters
      //
      public String getDrinkName() {
          return drinkName;
      }
  
      public void setDrinkName(String drinkName) {
          this.drinkName = drinkName;
      }
  
      public float getDrinkPrice() {
          return drinkPrice;
      }
  
      public void setDrinkPrice(float drinkPrice) {
          this.drinkPrice = drinkPrice;
      }
  
      public String getDrinkAbout() {
          return drinkAbout;
      }
  
      public void setDrinkAbout(String drinkAbout) {
          this.drinkAbout = drinkAbout;
      }
  
      public Packaging getDrinkPackaging() {
          return drinkPackaging;
      }
  
      public void setDrinkPackaging(Packaging drinkPackaging) {
          this.drinkPackaging = drinkPackaging;
      }
  
      public Manufacturer getDrinkManufacturer() {
          return drinkManufacturer;
      }
  
      public void setDrinkManufacturer(Manufacturer drinkManufacturer) {
          this.drinkManufacturer = drinkManufacturer;
      }
  
      public Countries getDrinkCountries() {
          return drinkCountries;
      }
  
      public void setDrinkCountries(Countries drinkCountries) {
          this.drinkCountries = drinkCountries;
      }
  
      // toSTRING
      @Override
      public String toString() {
          return &quot;DrinkDTO{&quot; +
                  &quot;drinkName='&quot; + drinkName + '\'' +
                  &quot;, drinkPrice=&quot; + drinkPrice +
                  &quot;, drinkAbout='&quot; + drinkAbout + '\'' +
                  &quot;, drinkPackaging=&quot; + drinkPackaging +
                  &quot;, drinkManufacturer=&quot; + drinkManufacturer +
                  &quot;, drinkCountries=&quot; + drinkCountries +
                  '}';
      }
  </code></pre>
  <p>CustomerController:</p>
  <pre class="lang-java prettyprint-override"><code>@GetMapping(&quot;/drinks&quot;)
      List&lt;DrinkDTO&gt; getAllDrinks(){
          return DrinkMapper.INSTANCE.drinksToDrinksDTO(customerService.getAllDrinks());
      }
  </code></pre>
  <p>BUILD.GRADLE</p>
  <pre class="lang-java prettyprint-override"><code>// Mapstruct
      implementation 'org.mapstruct:mapstruct:1.3.1.Final'
      annotationProcessor 'org.mapstruct:mapstruct-processor:1.3.1.Final'
  </code></pre>
  <p>DrinkMapper:</p>
  <pre class="lang-java prettyprint-override"><code>@Mapper
  public interface DrinkMapper {
  
      DrinkMapper INSTANCE = Mappers.getMapper(DrinkMapper.class);
  
      @Mapping(source = &quot;name&quot;, target = &quot;drinkName&quot;)
      @Mapping(source = &quot;price&quot;, target = &quot;drinkPrice&quot;)
      @Mapping(source = &quot;about&quot;, target = &quot;drinkAbout&quot;)
      @Mapping(source = &quot;packaging&quot;, target = &quot;drinkPackaging&quot;)
      @Mapping(source = &quot;manufacturer&quot;, target = &quot;drinkManufacturer&quot;)
      @Mapping(source = &quot;countries&quot;, target = &quot;drinkCountries&quot;)
      DrinkDTO drinkToDrinkDTO(Drink drink);
  
      @Mapping(source = &quot;drinkName&quot;, target = &quot;name&quot;)
      @Mapping(source = &quot;drinkPrice&quot;, target = &quot;price&quot;)
      @Mapping(source = &quot;drinkAbout&quot;, target = &quot;about&quot;)
      @Mapping(source = &quot;drinkPackaging&quot;, target = &quot;packaging&quot;)
      @Mapping(source = &quot;manufacturer&quot;, target = &quot;drinkManufacturer&quot;)
      @Mapping(source = &quot;countries&quot;, target = &quot;drinkCountries&quot;)
      Drink drinkDTOtoDrink(DrinkDTO drinkDTO);
  
      @Mapping(source = &quot;name&quot;, target = &quot;drinkName&quot;)
      @Mapping(source = &quot;price&quot;, target = &quot;drinkPrice&quot;)
      @Mapping(source = &quot;about&quot;, target = &quot;drinkAbout&quot;)
      @Mapping(source = &quot;packaging&quot;, target = &quot;drinkPackaging&quot;)
      @Mapping(source = &quot;manufacturer&quot;, target = &quot;drinkManufacturer&quot;)
      @Mapping(source = &quot;countries&quot;, target = &quot;drinkCountries&quot;)
      List&lt;DrinkDTO&gt; drinksToDrinksDTO(List&lt;Drink&gt; drinks);
  }
  </code></pre>
  <p>ERRORS:
  <a href="https://i.stack.imgur.com/yRFFt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yRFFt.png" alt="enter image description here" /></a></p>