title: Better way to register beans in Spring
body: <p>I am new in Spring. I understand process of Dependency Injection and Inversion Of Control as well. But in few days ago I found one source code which compel me thinking about it.</p>
  
  <p>If I am not wrong, Beans can be registered by Stereotype annotations - @Component, @Service, etc. </p>
  
  <p>In code which I found will be defined class with some logic, but without annotation. Next that same class will be initialized in some @Configuration class as been like that:</p>
  
  <pre><code>@Bean
  public Foo fooBean() {
     return new Foo();
  }
  </code></pre>
  
  <p>Can you tell me what is different between these options and when they use? Thanks in advice.</p>