title: MapStruct implementation is not working in Spring Boot Web Application
body: <p>I am a newbie to Spring Boot and <a href="http://mapstruct.org/" rel="noreferrer">MapStruct</a> Tool.  </p>
  
  <p>Earlier, A Project(written by other team using these technologies) is not starting up. Then, I had made some changes in Mapper Abstract Class but now mapper object is coming as null on application startup. </p>
  
  <p>Mapper Abstract Class:</p>
  
  <pre><code>@Mapper(componentModel = "spring")
  public abstract class UserAndEmployeeMapper {
  
      public UserAndEmployeeMapper INSTANCE = Mappers.getMapper( UserAndEmployeeMapper.class );
  
      @Mapping(source = "username", target = "name")
      @Mapping(source = "ssn", target = "ssn", defaultValue = "xxxxxx" )
      @Mapping(target = "salary", constant = "34.67")
      @Mapping(target = "dob", dateFormat = "dd/MM/yyyy", constant = "10/12/2002")
      public abstract Employee mapToEmployee(User user);
  
      public abstract List&lt;Employee&gt; mapToEmployee(List&lt;User&gt; users);
  
      @Mapping(source = "name", target = "username")
      public abstract User mapToUser(Employee employee);
  
      public abstract List&lt;User&gt; mapToUser(List&lt;Employee&gt; employees);
  
  }
  </code></pre>
  
  <p><strong>LoginServiceImpl class</strong></p>
  
  <pre><code>@Service("loginService")
  public class LoginServiceImpl implements LoginService{
  
      private static final AtomicLong counter = new AtomicLong();
  
      @Autowired
      private EmployeeDao employeeDao;
  
      private UserAndEmployeeMapper userAndEmployeeMapper;
  ...
  
  }
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;build&gt;
          &lt;plugins&gt;
              &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;${maven.compiler.plugin.version}&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.mapstruct&lt;/groupId&gt;
                              &lt;artifactId&gt;mapstruct-processor&lt;/artifactId&gt;
                              &lt;version&gt;${mapstruct.jdk8.version}&lt;/version&gt;
                          &lt;/path&gt;
                      &lt;/annotationProcessorPaths&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>After I added @Autowired in LoginServiceImpl, application is not starting and following error log is showing</p>
  
  <pre><code>***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Field userAndEmployeeMapper in org.service.impl.LoginServiceImpl required a bean of type 'org.mapper.UserAndEmployeeMapper' that could not be found.
  
  
  Action:
  
  Consider defining a bean of type 'org.mapper.UserAndEmployeeMapper' in your configuration.
  </code></pre>
  
  <p>Any suggestions ?</p>