title: Spring: calling method before injection
body: <p>I will explain my problem with a simple example:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class A () {
      private B b;
  
      public A () { /* ... */ }
  
      public B getB () { /* ... */ }
  
      @Autowired
      public void setB (B b) { /* ... */ }
  
      public init (int x, int y, float rx, float ry) { /* ... */ }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre class="lang-java prettyprint-override"><code>public class B () {
      private A a;
  
      public B () { /* ... */ }
  
      public A getA () { /* ... */ }
  
      @Autowired
      public void setA (A a) { /* ... */ }
  
      public init (int x, int y, float rx, float ry) { /* ... */ }
  }
  </code></pre>
  
  <p>So I need call <code>init()</code> method before injection, because immediately after injection is called method from injected component in loop fps times per second, and of course is not initialized so I get <code>NullPointerException</code>.</p>
  
  <p>I use setter injection and create object with <code>context.getBean("A")</code>.</p>
  
  <p>Is there any way to call method <code>init()</code> before injection?</p>