title: Understanding Spring4 annotation beans
body: <p>First time using Spring with annotions. I'm trying to define a singleton bean like:</p>
  
  <pre><code>@Bean
  public ActionProducer actionProducer() {
      return new ActionProducer();
  }
  </code></pre>
  
  <p>But i feel like this is not a correct way to do since returns a "new" bean each time. Should i instead define like below? </p>
  
  <pre><code>@Bean
  public ActionProducer actionProducer() {
      if (bean==null) 
          bean=new ActionProducer();
      return bean 
  }
  </code></pre>
  
  <p>Thanks in advance.</p>