Starting in JSF 2.0 (JSR-314) a feature was added called ProjectStage. This is an attribute that signifies the stage where the project is running:
Development
, UnitTest
, SystemTest
, or Production
. The idea is that if the code knows where it is running, it can plan better. As an example, in a production environment certain optimizations could occur during startup that would cause better overal performance. However, these optimizations during start up is a problem during development because during development there is a lot more shutting down and starting up of the server.
There are two ways to specify the ProjectStage:
web.xml
and JNDI. The problem with using web.xml
is that you need to update or override it as you go move from one environment to the next. JNDI is configured on the application server, so it is the ideal place to configure ProjectStage.
In WebLogic (11g), you can not add custom resources to JNDI. So, out of the box, you can not specify ProjectStage in JNDI.
In a previous post, I described Weblogic JNDI Custom Resource Configuration, which is a project where I configure JNDI in WebLogic using Startup Classes.