title: How to define a Spring bean using annotation instead of XML?
body: <p>I have defined in a xml config file:</p>
  
  <pre><code>&lt;bean id="bootstrap" class="com.package.Bootstrap"&gt;&lt;/bean&gt;
  </code></pre>
  
  <p>this works fine. </p>
  
  <p>The bootsrap class : </p>
  
  <pre><code>public class Bootstrap {
  
     @PostConstruct
     public void onServerStart() {
        System.out.println("PRINTSSSSSSSSSSSSSSSSSSS");
     }
  }
  </code></pre>
  
  <p>The method gets fired. </p>
  
  <p>But how can I get rid of the xml part, and annotate bootstrap to be a bean instead? </p>
  
  <p>I have </p>
  
  <pre><code>&lt;mvc:annotation-driven /&gt;
  &lt;context:annotation-config /&gt; 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>&lt;context:component-scan base-package="com.package" /&gt;
  </code></pre>
  
  <p>But I <strong>was wondering what the annotation</strong> used should be that replaces: </p>
  
  <pre><code>&lt;bean id="bootstrap" class="com.package.Bootstrap"&gt;&lt;/bean&gt;
  </code></pre>
  
  <p>I could not find anything about this online and in the spring docs :(</p>