In jBoss 7.1.1 it's pretty straight forward to create bindings.
Acess your standalone configuration file (standalone.xml) and look for the
<subsystem xmlns="urn:jboss:domain:naming:1.1">
tag.
There you'll define two differente tags:
- a Simple tag, where you define you property as key/value
- a Lookup tag, that will be used to map your property to a more user-friendly name. That name will be exposed in the JNDI context and accessible in your java classes.
Here is an example:
<subsystem xmlns="urn:jboss:domain:naming:1.1">
<bindings>
<simple name="java:jboss/applicationmode" type="java.lang.String" value="DEMO"></simple>
<lookup name="property/applicationmode" lookup="java:jboss/applicationmode"/>
</bindings>
</subsystem>
And then, in your java class, instatiate InitialContext and get the property by its exposed name:
InitialContext ctx = new InitialContext();
String applicationEnv = (String) ctx.lookup("property/applicationenvironment");