title: Spring Boot - Consider defining a bean of type
body: <p>I receive the error when attempting to run my Spring Boot app:</p>
  
  <blockquote>
    <p>Field studentMapper in <strong>com.adam.rest.client.impl.StudentClientImpl</strong>
    required a bean of type <strong>'com.adam.rest.mapper.StudentMapper'</strong> that
    could not be found.</p>
  </blockquote>
  
  <p>Could you suggest what is going wrong? (See files below)</p>
  
  <p><strong>App.java</strong></p>
  
  <pre><code>package com.adam.rest;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class App {
  
      public static void main(String[] args) {
          SpringApplication.run(App.class, args);
      }
  }
  </code></pre>
  
  <p><strong>StudentClientImpl.java</strong></p>
  
  <pre><code>package com.adam.rest.client.impl;
  
  import com.adam.rest.mapper.StudentMapper;
  import com.adam.rest.model.Student;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Repository;
  
  import java.util.Collection;
  import java.util.HashMap;
  import java.util.Map;
  
  @Repository
  public class StudentClientImpl {
  
      @Autowired
      private StudentMapper studentMapper;
  
      private static Map&lt;Integer, Student&gt; students;
           // DUMMY DATA GOES HERE
  
      Collection&lt;Student&gt; getStudents() { return this.students.values(); }
  
      Student getStudent(Integer id) { return this.students.get(id); }
  
      ...
  </code></pre>
  
  <p><strong>StudentMapper.java</strong></p>
  
  <pre><code>package com.adam.rest.mapper;
  
  import com.adam.rest.model.Student;
  
  import java.util.Collection;
  
  public interface StudentMapper {
  
      Collection&lt;Student&gt; getStudents();
  
      Student getStudent(Integer id);
  
      Student getStudent(String name);
  
      void updateStudent(Student student);
  
      void removeStudent(Integer id);
  
      void removeStudent(String name);
  
      void createStudent(Student student);
  
  }
  </code></pre>