title: Difference between Dependency Injection and @DependsOn
body: <p>we are using Spring in our project and today I found, in my eyes, a strange beaviour. In my opinion Dependency Injection and the annotation @DependsOn should be the same in the following both cases </p>
  
  <pre><code>@Bean
  public ClassA classA(){
      //code
  }
  
  @Bean
  public ClassB classB(ClassA classA){
      someMethodWhichNeedsClassA()
  }
  
  </code></pre>
  
  <p>and </p>
  
  <pre><code>@Bean
  public ClassA classA(){
      //code
  }
  
  @Bean
  @DependsOn("classA")
  public ClassB classB(){
      someMethodWhichNeedsClassA()
  }
  
  </code></pre>
  
  <p>It seems, that those both ways are not identical. I am not allowed to share my code, but in the first case I have access to a list which is filled in the first Bean, but not in the second case. 
  I tried to find something in the documentation or in other blogs but without success. </p>
  
  <p>Has anybody an idea if there is any differences between those both ways, because I thougth it has something to do with ordering of bean creation and thats all. </p>
  
  <p>Thanks for any help</p>