Results 1 to 2 of 2

Thread: Where should one put configuration data?

  1. #1
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    4

    Default Where should one put configuration data?

    Hi all,

    from what I understand about Spring, one should be able to reduce the reliance on external (dependancy lookup) type systems such as JNDI, thanks to dependancy injection. This is fine, and I am very happy to move all my object interdependancies into the application context which I deploy with my web application.

    My question relates to what to do with other "configuration" type data, such as the name of the database which will be used or the e-mail address which is used for sending e-mails. In several examples, I've seen this in the web application context XML. I don't want this information to exist inside the web application itself, as this would mean that each time a new version was deployed it would need to be reconfigured. As the same WAR will be deployed in many different situations, each requiring a specific configuration, the configuration information must exist outside the web app.

    So what are the best options for storing common, environment specific, configuration data which remains the same when the application is upgraded? JNDI? JMX? A table in a database? Simple "properties" files in a common directory (although often web apps can't access files outside the context of the application)? Ideally, I should be able to configure different types of information (datasources, properties, mail servers, etc) via a common interface.

    In typical J2EE servers, this functionality is normally provided by JNDI. What would be the most elegant way to address this requirement in a Spring environment?

    Thanks,
    Dominic.

  2. #2
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default

    It depends. What is the life cycle of that data, when is it required, what is the security required, who changes it, is it cluster wide, runtime configurable, and so forth.

    For example, if it is the database config data, then it has to exist prior to app boot up, so the simplest thing that would work is file based persistence such as properties or even Preferences.

    I'm wondering if configuration data storage can't just be another application of a DAO that Spring abstracts out, just as it does with JNDI. So, it doesn't matter where something is, LDAP, DB, Props, ....

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. Multiple Data Sources + Hibernate + Spring
    By joeserel in forum Data
    Replies: 2
    Last Post: May 18th, 2005, 09:22 AM
  4. injecting complex configuration data
    By fox9 in forum Container
    Replies: 2
    Last Post: Feb 25th, 2005, 07:23 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
  •