title: Managed Bean Annotation doesn't work in JSF 2.0
body: <p>I've encoutered strange issue with annotations in bean.</p>
  
  <p><strong>index.xhtml</strong> content:</p>
  
  <p><code>&lt;h:outputText value="#{ejb.helloWorld}" /&gt;</code></p>
  
  <p><strong>Ejb.java</strong> content:</p>
  
  <pre><code>package bean;
  
  import java.io.Serializable;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  
      @ManagedBean(name="ejb")
      @SessionScoped
      public class Ejb implements Serializable
      {
          public String getHelloWorld()
          {
              return "Hello World";
          }
      }
  </code></pre>
  
  <p>From what we see above i should be able to call bean method... but i can't, it will work <strong>only</strong> if i manage bean in <code>faces-config.xml</code> file with content:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;faces-config xmlns="http://java.sun.com/xml/ns/javaee" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" 
            version="2.0"&gt;
  
            &lt;managed-bean&gt;
                &lt;managed-bean-name&gt;ejb&lt;/managed-bean-name&gt;
                &lt;managed-bean-class&gt;bean.Ejb&lt;/managed-bean-class&gt;
                &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
            &lt;/managed-bean&gt;
  &lt;/faces-config&gt;
  </code></pre>
  
  <p><strong>Questions</strong>:</p>
  
  <ol>
  <li>Why i have encountered such situation ?</li>
  <li>How to resolve this issue ?</li>
  </ol>
  
  <p>I'm using:</p>
  
  <ul>
  <li><code>JSF 2.0</code> (imported to lib)</li>
  <li><code>JBoss Server 4.2</code></li>
  </ul>