title: MapStruct - @Mapper annotation don't create bean
body: <p>I downloaded application from this source <a href="https://github.com/springframeworkguru/spring5-mvc-rest/tree/vendor-api" rel="noreferrer">https://github.com/springframeworkguru/spring5-mvc-rest/tree/vendor-api</a>
  And I have a problem with MapStruct.</p>
  
  <pre><code>@Mapper
  public interface CategoryMapper {
  
  CategoryMapper INSTANCE = Mappers.getMapper(CategoryMapper.class);
  
  
  CategoryDTO categoryToCategoryDTO(Category category);
  </code></pre>
  
  <p>}</p>
  
  <pre><code>@Data
  public class CategoryDTO {
      private Long id;
      private String name;
  }
  </code></pre>
  
  <p>domain class:</p>
  
  <pre><code>@Data
  @Entity
  public class Category {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
      private String name;
  }
  </code></pre>
  
  <p>Service class:</p>
  
  <pre><code>@Service
  public class CategoryServiceImpl implements CategoryService {
  
      private final CategoryMapper categoryMapper;
      private final CategoryRepository categoryRepository;
  
      public CategoryServiceImpl(CategoryMapper categoryMapper, CategoryRepository categoryRepository) {
          this.categoryMapper = categoryMapper;
          this.categoryRepository = categoryRepository;
      }
  }
  </code></pre>
  
  <p>And in pom.xml dependency, I paste only two::</p>
  
  <pre><code>&lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;org.mapstruct.version&gt;1.2.0.CR2&lt;/org.mapstruct.version&gt;
  &lt;/properties&gt;
  &lt;dependency&gt;
          &lt;groupId&gt;org.mapstruct&lt;/groupId&gt;
          &lt;artifactId&gt;mapstruct-jdk8&lt;/artifactId&gt;
          &lt;version&gt;${org.mapstruct.version}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>And plugin:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
      &lt;version&gt;3.7.0&lt;/version&gt;
      &lt;configuration&gt;
          &lt;source&gt;1.8&lt;/source&gt;
          &lt;target&gt;1.8&lt;/target&gt;
          &lt;annotationProcessorPaths&gt;
              &lt;path&gt;
                   &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
                   &lt;artifactId&gt;lombok&lt;/artifactId&gt;
                   &lt;version&gt;${lombok.version}&lt;/version&gt;
              &lt;/path&gt;
              &lt;path&gt;
                   &lt;groupId&gt;org.mapstruct&lt;/groupId&gt;
                   &lt;artifactId&gt;mapstruct-processor&lt;/artifactId&gt;
                   &lt;version&gt;${org.mapstruct.version}&lt;/version&gt;
             &lt;/path&gt;
          &lt;/annotationProcessorPaths&gt;
          &lt;compilerArgs&gt;
             &lt;compilerArg&gt;
                   -Amapstruct.defaultComponentModel=spring
             &lt;/compilerArg&gt;
          &lt;/compilerArgs&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Description:</p>
  
  <pre><code>Parameter 0 of constructor in 
  guru.springfamework.services.CategoryServiceImpl required a bean of type 'guru.springfamework.api.v1.mapper.CategoryMapper' that could not be found.
  </code></pre>
  
  <p>Action:</p>
  
  <pre><code>Consider defining a bean of type 'guru.springfamework.api.v1.mapper.CategoryMapper' in your configuration.
  </code></pre>
  
  <p>I think that in my Intellij annotation @Mapper don't create a bean for mapper.
  I didn't change code from John GitHub.
  Any idea?
  I tried to change path generated source to target but this doesn't help
  Thanks for help.</p>