title: How to access a method a Spring Bean from a class not in the Spring Container
body: <p>I'm not a <a href="https://spring.io/" rel="noreferrer">Spring</a> pro, so please bear with me....</p>
  
  <p>I have three classes:</p>
  
  <pre><code>class SpringBeanA {
      public aMethod() {
          .....
      }
  }
  
  class SpringBeanB {
  
      @Autowired SpringBeanA a;
  
      public bMethod() {
          a.method();
      }
  }
  
  class NONSpringClass {
      .....
      b.method();
      .....
  }
  </code></pre>
  
  <p><code>b.method()</code> gives a null pointer error, both when accesed via the instances <code>SpringBeanB b = new SpringBeanB()</code> and autowiring SpringBeanB to NONSpringClass.</p>
  
  <p>The autowiring:</p>
  
  <pre><code>class NONSpringClass {
  
      @Autowired SpringBeanB b;
  
      .....
      b.method();
      .....
  }
  </code></pre>
  
  <p>How can I successfully call <code>b.method()</code>?</p>