title: Spring bean instantiation ordering
body: <p>I have run into an issue where Bean instantiation sequencing matters. Currently Bean3 from below is running a DB based cache put operation, and Bean 1 queries against the newly created cache using Proxy Bean2. Priority is for Bean3 and Bean 2 to be completely instantiated before Bean1 gets instantiated, i.e. when Spring container comes up. These beans are in seperate JARS, and Bean2 reference into Bean1 is not using Autowired. Instead a service locator is giving it a reference. We are using Spring 2.5.2 and not using XML for instantiation of beans. Any help appreciated!</p>
  
  <ul>
  <li><p>JAR1 (Spring project)</p>
  
  <pre><code>@Service ("bean3")   
   public class Bean3 implements ApplicationListener  { 
      public void onApplicationEvent() {  
        //load data from DB and populate cache                    
      }
       public void getCache(){
       //get data from cache
      }
  </code></pre>
  
  <p>} </p>
  
  <pre><code>@Service ("bean2")
  public class Bean2 { 
  @Autowired 
  private Bean3 bean3;
     private void methodA(){
       bean3.getCache();
     }
  }
  </code></pre></li>
  <li><p>JAR2 (Non-Spring project)</p>
  
  <pre><code>public class Bean1{  
  Bean2 bean2 = SpringServiceLocator.getBean("bean2")
    public void methodB(){
      bean2.methodA();
     } 
  }
  </code></pre></li>
  </ul>