12.2. Environment Entries

The bean provider declares all the bean environment entries in the deployment descriptor via the env-entry element. The deployer can set or modify the values of the environment entries.

A bean accesses its environment entries with a code similar to the following:

InitialContext ictx = new InitialContext();
Context myenv = ictx.lookup("java:comp/env");
Integer min = (Integer) myenv.lookup("minvalue");
Integer max = (Integer) myenv.lookup("maxvalue");

In the standard deployment descriptor, the declaration of these variables are as follows:

<env-entry>
  <env-entry-name>minvalue</env-entry-name>
  <env-entry-type>java.lang.Integer</env-entry-type>
  <env-entry-value>12</env-entry-value>
</env-entry>
<env-entry>
  <env-entry-name>maxvalue</env-entry-name>
  <env-entry-type>java.lang.Integer</env-entry-type>
  <env-entry-value>120</env-entry-value>
</env-entry>