You can configure this using the element in the server.xml. This is documented in the infocenter. Essentially you enable the jndi feature in the server.xml using this:
<featureManager>
<feature>jndi-1.0</feature>
</featureManager>
Then you can configure the JNDI entries. You can only do simple types using this, so no complex objects. To configure your entry you then do this:
<jndiEntry jndiName="myProp/philosopher" value="plato" />
The Liberty profile does type inference, so if you expressed this:
<jndiEntry jndiName="myProp/philosopher" value="1234" />
you get an Number from JNDI. If you express this:
<jndiEntry jndiName="myProp/philosopher" value="1234.3D" />
You get a Double.
If you want a number as a string literal you would express it using quotes:
<jndiEntry jndiName="myProp/philosopher" value='"1234.3D"' />
To get this from your application you can do a global lookup such as:
Context ctx = new InitialContext();
Object jndiConstant = ctx.lookup("myProp/philosopher");
String philosopher = (String) jndiConstant;
You can also map this to a resource environment entry in the ibm-web-bnd.xml file:
<env-entry name="philosopher" binding-name="myProp/philosopher" />
and then use this code to look it up:
Context ctx = new InitialContext();
Object jndiConstant = ctx.lookup("java:comp/env/philosopher");
String philosopher = (String) jndiConstant;