Results 1 to 4 of 4

Thread: Deploying web apps - dev, test, production configuration

  1. #1

    Default Deploying web apps - dev, test, production configuration

    Hi!

    I can't find any references to how people are configuring applications for different servers. Ideally I should be able to put some sort of application specific configuration file on the server in question before I deploy a WAR. Otherwise deploying to a live Tomcat server cluster would be a nightmare! (deploy, stop the app, alter web.xml, restart -- not an acceptable way to do things!)

    How are you achieving this? I just want a simple file somewhere with the key server specific parameters such as which Oracle database to target and whether to cache messages.properties files. We currently use dev, test, beta and live servers and it is not good to repackage the WAR for each server since the binaries should be identical or the testing doesn't hold water.

    Also, certain parameters would ideally be shared - for example most, if not all the applications on live will target the same database, so there should be no need to define the connect URL in multiple places on the same server.

    Thanks in advance for any input...
    Matt

  2. #2
    Join Date
    Aug 2004
    Location
    Roeselare, Belgium
    Posts
    16

    Default

    This question is not really Spring related, but you should have a look at Ant or Maven.
    Pieter Coucke
    Onthoo.com

  3. #3
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    Spring provide some nice "out of the box" support for configuring your application context using property files.

    http://www.springframework.org/docs/...onfigurer.html
    www.almaer.com/blog/archives/000449.html
    http://sourceforge.net/forum/message.php?msg_id=2370307

    I always try and have a web.xml file that does not require any changes between production and test environments. I achieve this by moving as much configuration as is possible out of web.xml and into the spring application context. For servlets if you're using Spring MVC this is easy for filters check out FilterToBeanProxy which part of the Acegi Security framework.


    Ollie

  4. #4
    Join Date
    Aug 2004
    Location
    Allentown, PA
    Posts
    141

    Default

    Matt,

    Look at the classes:

    org.springframework.beans.factory.config.PropertyO verrideConfigurer
    org.springframework.beans.factory.config.PropertyP laceholderConfigurer

    These allow you externalize properties so that your values will be filled in or overriden when the app starts. I use these to configure my datasource, a different on per platform, ie. dev, qa, pre-prod, prod. Remember, you can use ant-style variables in your bean configuration files.

    Other than a datasource, what are you trying to parameterize? Try to put all your platform specific properties in separate properties files and load the correct one, using one of the classes above, and it should dynamically re-configure for you.

    Also, if you are using an o/r mapper like hibernate, use the abilites of hibernate configuraton to change your environments. You could define a default hibernate.cfg.xml and a hibernate.properties in the classpath will override default cfg file.

    Hope this helps.

    Dan

Similar Threads

  1. Dynamic Property Configuration
    By fenrick in forum Container
    Replies: 3
    Last Post: May 12th, 2006, 02:38 AM
  2. Replies: 0
    Last Post: Jun 21st, 2005, 06:17 AM
  3. Replies: 1
    Last Post: Nov 18th, 2004, 05:56 AM
  4. Spring: useful for J2EE. not so useful for J2SE?
    By Edward Kenworthy in forum Container
    Replies: 2
    Last Post: Nov 2nd, 2004, 08:46 AM
  5. Replies: 5
    Last Post: Aug 27th, 2004, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •