• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

Setting up Application Configuration for URLs

Hello,

I would like to setup application configuration depending on what host the application is running on.  I have 3 .properties files app-DEV.properties, app-TEST.properties and app.properties.  I'm using tomcat and spring and I'm not sure if Spring has any built in control for this. How would I build in the swapping of config?  Ideally, I would like to have a base file and that way the currently loaded properties file just overrides values to it.
0
cgray1223
Asked:
cgray1223
1 Solution
 
colr__Commented:
maven has built in features for this. If you use maven to do your build, then you cans etup a profile, one for each of your environments. The profiles can be used to customise the build characterisctics depending on the environement.

So you would run 'mvn clean install -Ptest' to build your test environment for example.
0
 
Amitkumar PSr. ConsultantCommented:
cgray1223,

I don't know whether what you are using to build your application. But you can follow the below given approach.

1. Prepare 3 property files (that you are doing right now)
    a. app-dev.properties
    b. app-test.properties
    c. app-production.properties

2. now maintain a variable to figure out the environment. Possible values are development, test and production.

3. based on the value of the variable, pickup the appropriate property file and copy it as app.properties during the build process.

Hope, this works for you as I'm following the same approach as mentioned above. I'm using ANT.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now