Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607656
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:44:01+00:00 2026-05-22T00:44:01+00:00

I have several times ran into the same problem, and I would like to

  • 0

I have several times ran into the same problem, and I would like to have some input on what other people think about the issue:
Suppose we have Spring application packaged as a .war file and we want to run it on several environments. (development/test/preprod/prod/etc)

For accessing the infrastructure needed by the application, (databases/webservices etc) we store the access info in configuration files, also some business configuration is in those files.
Let’s say we use .properties files for this purpose (because we have a spring application inside the war and we like having the properties read by a one-liner in the appcontext)
and also suppose that in the different environments we don’t have the same appserver/servlet container. (eg: dev, test: jetty, preprod: tomcat, prod: glassfish)

What I usually have done is creating multiple Maven profiles, one for each environment, the needed configuration in the appropriate files for each.

Now recently I have faced a question from a guy running operations:
‘So really we have to generate a new build with the appropriate profile on the buildserver if the DB is changed in preprod environment?’
I answered ‘No, you can actually go to …/webapps/currentApp/WEB-INF/classes/config/application.properties and change the values there, then restart the container’

We have come up with a solution which solves some aspects of this issue:
using Maven assembly plugin we embed a Jetty inside the war which makes it usable as an ‘executable’ war, also giving us the possibility to have a global configuration XML,
from which the starter of the embedded Jetty creates/modifies the appropriate .properties files in the exploded war directory and only then starts the application.

But again this doesn’t solve the issue if you want to use anything else other than Jetty.

How is everyone dealing with the same situation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:44:02+00:00Added an answer on May 22, 2026 at 12:44 am

    Environment variable, external config files

    We have something similar, a Web Application running in Tomcat/Weblogic with Spring.
    What we do is define a environment property CONFIG_PATH and put all the XMLs (including spring config) and properties files in that directory.

    We have multiple properties files (per environment) that we send it as a tar file.
    The Web app loads all the Properties/Spring config files from the CONFIG_PATH directory. This variable is defined as Environment variable in the respective environment

    This way we are not touching the WAR file nor building separate WAR for environment. Think of this scenario: QA & PROD WAR files built, QA tested QA war file, PROD WAR deployed in PROD but something blows up 🙁

    We do something as below:

    In spring config xml, we define:

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="order" value="0"></property>
        <property name="locations">
            <list>
                <value>file:${CONFIG_PATH}/App.properties</value>
            </list>
        </property>
    </bean>
    

    Refer all variables as usual in spring config.

    In web.xml we define spring config as below:

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>file:${CONFIG_PATH}/**/spring-config.xml
        </param-value>
    </context-param>
    

    The QA/PROD team deploys the same artifact with their corresponding environment files. If something blows up we know its only the env. properties that are messed up.
    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several databases where the transaction log (.LDF) is many times larger than
I have heard the 'shard' technique mentioned several times with regard to solving scaling
I have had to do this several times, usually when trying to find in
Several times in my career, I have worked in a software group that determined
I have implemented authentication systems for webapps several times over the years, but before
I have several ASP:TextBox controls on a form (about 20). When the form loads,
We have several jobs that run concurrently that have to use the same config
I recently ran into a quite complex problem and after looking around a lot
I ran into this problem at my old job, and now again at my
In my iPhone app I would like to run several queries when the application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.