title: Using Spring boot, I am unable to refer a class present in another jar
body: <p>I am trying to build a spring boot web application. I want to refer a class from another jar. The class name is SalaryHandler.
  I have done the following configuration in the class having 
      @SpringBootApplication annotation:</p>
  
  <pre><code>@Bean
  public SalaryHandler iSalary() {
      return new SalaryHandler();
  }
  </code></pre>
  
  <p>In the class, where it is required, I have used autowiring annotation like this:
      package hello;</p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;   
  import org.springframework.stereotype.Service;
  
  import com.salary.SalaryHandler;
  //@Service - not working
  //@Component - not working
  public class SalaryDelegatorImpl implements SalaryDelegator {
  
      @Autowired
      private SalaryHandler iSalary;
  
      @Override
      public void show() {
          iSalary.testSalary();
  
      }
  
  }
  </code></pre>
  
  <p>The code is compiling fine, but when this iSalary object is used to call its method, nullpointer exception is thrown.</p>
  
  <p>Just to note that SalaryHandler is present inside another jar and is not using any spring annotation, its code is as below:</p>
  
  <pre><code>package com.salary;
  
  public class SalaryHandler implements ISalary {
  
  public void testSalary() {
      System.out.println("Salary test successful...");
     }
  
  }
  </code></pre>