title: Null pointer Exception when autowired class is called
body: <pre><code>@Component
  public class car {
      void getCar(){
          System.out.println(&quot;Honda&quot;);
  
      }
  }
  
  
  
  public class Tyre  {
      @Autowired
      private car cars;
      @Test
      void print(){
  
              cars.getCar();
          }
      }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/il2Nv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/il2Nv.png" alt="enter image description here" /></a></p>
  <p>java.lang.NullPointerException when &quot;cars.getcar&quot; is called
  Spring Version 2.7.1
  I am trying to annotate an autowire for Car.class
  but it returns null on run time
  Attached the project Structure</p>