title: Should we use @Component on @Entity class in Spring boot
body: <p>Well i am a newbie in spring boot. I was working on a project where I needed to @Autowired my Entity in a controller class. But I ended up with error:</p>
  
  <blockquote>
    <p>Field repository in abc required a bean of type 'xyz' that could not be found.</p>
  </blockquote>
  
  <p>But it solved after adding @Component in Entity class. </p>
  
  <p>So my questions are:</p>
  
  <ol>
  <li><p>Why Spring boot was not scanning my Entity class as it was under @SpringBootApplication declaration?</p></li>
  <li><p>When and where we should use @Component annotation in our application?</p></li>
  </ol>