title: @Bean annotation on a static method
body: <p>Can anyone explain me why a <code>@Bean</code> on a static method is returning 2 different instances ?</p>
  
  <p>I can understand that <code>@Bean</code> on a method non static like the class <code>A</code> is returning the same instance because default scope is singleton.</p>
  
  <p>And If I try to inject the class <code>B</code> with <code>@Autowire</code> in a Service it won't work, so it looks like it's not load by the Spring App Context. So using a class like <code>D</code> will be similar !?
  I think not because for <code>@PropertySource</code> we need to use in addition (used for the placeholder):</p>
  
  <pre><code>@Bean
  public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
      return new PropertySourcesPlaceholderConfigurer();
  }
  </code></pre>
  
  <p>and if we remove @Bean from this, it won't work.</p>
  
  <p>Is there other use case where it would be useful to use @Bean on a static method?</p>
  
  <p>EXAMPLE:</p>
  
  <p>when I run:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = {Conf.class})
  public class Test {
      @org.junit.Test
      public void test(){
      }
  }
  </code></pre>
  
  <p>for</p>
  
  <pre><code>@Configuration
  @ComponentScan
  public class Conf {
  
      @Bean
      public A aaa(){
          return new A();
      }
  
      @Bean
      public static B bbb(){
          return new B();
      }
  
      @Bean
      @Scope("prototype")
      public C ccc(){
          return new C();
      }
  
      public static D ddd(){
          return new D();
      }
  
      @PostConstruct
      public void post(){
          System.out.println(aaa());
          System.out.println(aaa());
          System.out.println(bbb());
          System.out.println(bbb());
          System.out.println(ccc());
          System.out.println(ccc());
          System.out.println(ddd());
          System.out.println(ddd());
      }
  
  }
  public class A {
  }
  public class B {
  }
  public class C {
  }
  public class D {
  }
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>uk.co.xxx.unit.A@6caf0677
  uk.co.xxx.unit.A@6caf0677
  uk.co.xxx.unit.B@413d1baf
  uk.co.xxx.unit.B@16eb3ea3
  uk.co.xxx.unit.C@353352b6
  uk.co.xxx.unit.C@4681c175
  uk.co.xxx.unit.D@57a78e3
  uk.co.xxx.unit.D@402c4085
  </code></pre>