General Question about Config Files and IoC

Chad Woolley <lists-+3axmRx+iL57nQ4KK8CQzgC/[email protected]> Fri, 06 Feb 2004 18:24:33 -0700
Newsgroups gmane.comp.java.jcontainer.interest
Message-ID <[email protected]>
Hello,

Last month I asked for some general advice on designing my app to use an IoC 
"Type 3" approach, and I got some good advice: 
http://lists.codehaus.org/pipermail/jcontainer-interest/2004-January/001117.html

So far, I'm impressed - it has led me to eliminate and simplify a lot of 
existing code.

Now, I am running into something that is confusing me:

Say that there is an object, ObjectA, in my system, that I want to configure via 
a configuration file.  However, there are also some dependencies that ObjectA 
has on ObjectB.  So, when I construct ObjectA, I need to provide both the 
configuration settings, and a reference to ObjectB.

Since the reading of the configuration file happens earlier in the app startup 
process than the creation of ObjectB (which may also depend on config settings), 
how should I handle the construction of ObjectA?

Do I need to make a separate "ObjectAConfig" class, which just holds the config 
settings from the file, and then have a constructor like this:
   new ObjectA(objectAConfig, objectB)

Is this the preferred approach, or am I missing something?

Thanks,
Chad