You can "externalize" the environment specific configuration from the
artifacts (war,ear,jar) that you are deploying by putting those
variables in a propertyfile and placing the file in a folder that you
add to your servers classpath. That way the same artifact can be
deployed to all environments - but you will have to manage the
externalized property files per environment. You can also externalize
configuration files such as "log4j.xml" and "persistance.xml". The
downside to this approach is that it dosent work with configuration
files that have to be in a certain path in the artifact ie.
/web-inf/web.xml. You could replace variables in web.xml at runtime
with values stored in the external property file by setting up a
sevlet context listener that replaces the init parameters with values
from the property file - however I believe init parameters can only be
set programmatically as of servlet API 3.0.



On Mon, Oct 24, 2011 at 10:46 PM, Jim May <jim.webg...@gmail.com> wrote:
> I know this question is not directly associated with MyFaces, but more a
> general web application question.
>
> What is the best practice for storing application variables that need to be
> changed once deployed to an environment? I want to use these variables in my
> application scoped bean in the JSF web project.
>
> I was wondering what others have done. Right now, I am doing a jndi lookup
> for Strings and setting them on my application scoped bean. I feel like
> there is a better way of doing it.
>
> Thank You,
> --
> James May
> Software Engineer / Architect
> http://www.jamesmay.me
>

Reply via email to