# Java Beans

In the Container module there is a simple support for JavaBeans configuration. When we have some existing JavaBeans XML, we can easily port that bean configuration into Microcontainer beans configuration. Or if all we really need is simple configuration, no dependency, JavaBeans configuration is enough. Let see this in the examples below.

          <javabean xmlns="urn:jboss:javabean:1.0"
                class="org.jboss.test.javabean.support.SimpleBean">
             <property name="AString">StringValue</property>
             <property name="AByte">12</property>
             <property name="ABoolean">true</property>
             <property name="AShort">123</property>
             <property name="anInt">1234</property>
             <property name="ALong">12345</property>
             <property name="AFloat">3.14</property>
             <property name="ADouble">3.14e12</property>
             <property name="ADate">Jan 01 00:00:00 CET 2001</property>
             <property name="ABigDecimal">12e4</property>
             <property name="ABigInteger">123456</property>
             <property name="abyte">12</property>
             <property name="aboolean">true</property>
             <property name="ashort">123</property>
             <property name="anint">1234</property>
             <property name="along">12345</property>
             <property name="afloat">3.14</property>
             <property name="adouble">3.14e12</property>
             <property name="ANumber" class="java.lang.Long">12345</property>
             <property name="overloadedProperty">StringValue</property>
             <property name="XYZ">XYZ</property>
             <property name="abc">abc</property>
          </javabean>

Simple configuration via JavaBean setters.

          <javabean xmlns="urn:jboss:javabean:2.0"
                class="org.jboss.test.javabean.support.SimpleBean">
              <constructor
                factoryClass="org.jboss.test.javabean.support.SimpleBeanFactory"
                  factoryMethod="newInstance">
                  <property name="anObject"
                      class="java.lang.Object">anObjectValue</property>
                  <property name="AString">StringValue</property>
                  <property name="AByte">12</property>
                  <property name="ABoolean">true</property>
                  <property name="ACharacter">x</property>
                  <property name="AShort">123</property>
                  <property name="anInt">1234</property>
                  <property name="ALong">12345</property>
                  <property name="AFloat">3.14</property>
                  <property name="ADouble">3.14e12</property>
                  <property name="ADate">Jan 01 00:00:00 CET 2001</property>
                  <property name="ABigDecimal">12e4</property>
                  <property name="ABigInteger">123456</property>
                  <property name="abyte">12</property>
                  <property name="aboolean">true</property>
                  <property name="achar">y</property>
                  <property name="ashort">123</property>
                  <property name="anint">1234</property>
                  <property name="along">12345</property>
                  <property name="afloat">3.14</property>
                  <property name="adouble">3.14e12</property>
                  <property name="ANumber" class="java.lang.Long">12345</property>
                  <property name="overloadedProperty">StringValue</property>
                  <property name="XYZ">XYZ</property>
                  <property name="abc">abc</property>
              </constructor>
          </javabean>

Constructor configuration via factory class static method call.

          <bean xmlns="urn:jboss:bean-deployer:2.0" class="org.jboss.acme.Example">
             <property name="PropertyName">
                <javabean xmlns="urn:jboss:javabean:1.0"
                   class="org.jboss.test.kernel.deployment.xml.support.SerializableObject"/>
             </property>
          </bean>

You can use JavaBean with Microcontainer beans in all cases where you could use plain value.