title: CDI bean configuration using beans.xml file
body: <p>I have very simple CDI bean:</p>
  
  <pre><code>package net.resourceAuth;
  
  public class Sample {
  
     private String text;
  
     public String getText() {
      return text;
     }
  
     public void setText(String text) {
      this.text = text;
     }
  }
  </code></pre>
  
  <p>And now I would like to initialize <code>text</code> variable using <code>beans.xml</code>. I'm trying with <code>beans.xml</code> file like this one:</p>
  
  <pre><code>&lt;beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:res="urn:java:net.resourceAuth"
      xsi:schemaLocation="
      http://java.sun.com/xml/ns/javaee 
      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt;
  
      &lt;res:Sample&gt;
        &lt;res:text&gt;test123&lt;/res:text&gt;
      &lt;/res:Sample&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>But it does not work. <code>text</code> is always null. Can You help me figure out what is wrong here?</p>
  
  <p>In other words: I am looking for a similar solution as it is used in the JSF  faces-config.xml described for example here: <a href="http://www.mkyong.com/jsf2/configure-managed-beans-in-jsf-2-0/" rel="nofollow">http://www.mkyong.com/jsf2/configure-managed-beans-in-jsf-2-0/</a></p>