1 Reply Latest reply on Apr 5, 2012 3:45 AM by jaikiran pai

    Overriding Simple Environment Entries at deployment time

    Stephen Coy Master

      This question is related to the plethora of discussions on this list related to accessing the content of external property files from enterprise applications.


      In general developers do this because they need a way to externalise the configuration of their deployment artifacts for different environments.


      The fact that JBossAS 7's beautiful new classloading has made accessing external property files difficult has highlighted the fact that developers need to become more familiar with the "JEE way" of doing this.


      One of these ways is to use env-entry elements in their deployment descriptors and inject their values into JEE components. In the old days this would have been done with a JNDI lookup.


      For example, given this env-entry:










      the value can be accessed from a component with:



      private int maxLookupRows;



      That's pretty easy to do. And we don't have to worry about how property files get distributed to the various nodes in a cluster either.


      But what happens when we want the env-entry-value to be "100" for the production environment?


      The JEE 6 spec (§EE. has this to say about env-entry values:

      If the Application Component Provider provides a value for an environment entry using the env-entry-value element, the value can be changed later by the Application Assembler or Deployer.


      In WebSphere (and I think WebLogic too), I can use the server admin console to make changes to these env-entry-values for each deployment.


      What is the JBossAS 7 way to do this?