Results 1 to 3 of 3

Thread: How-to have different applicationContext.xml files

  1. #1
    Join Date
    Oct 2005
    Posts
    11

    Default How-to have different applicationContext.xml files

    Can someone tell me if there is a clean way to be able to load different applicationContext.xml files depending on the hostname?

    I am running on a local, development, test, and production environment, but I only want to deploy one war file....

    Can I subclass the spring servlet and have it choose the applicationContext there... or something similar?

    Thanks in Advance!!!

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney
    Posts
    503

    Default

    Check out PropertyPlaceHolderConfigurer.

    The idea is to have different property files for each environment.

    In the 'locations' property, you can use the classpath: notation to specify which property files to use. This is all in the manual, check it out.

  3. #3
    Join Date
    Oct 2005
    Posts
    11

    Default

    Thanks for the info. That looks like exactly what I need...

    Still, I need to know how I would be able to load this on startup. The servlet and contextloaderlistener are loaded by my web.xml. I can do the grunt work obviously, but would I be correct in saying that i would probably need to subclass the contextloaderlistener?

Posting Permissions

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