Re: General Question about Config Files and IoC

peter royal <[email protected]> Sun, 15 Feb 2004 13:46:27 -0500
Newsgroups gmane.comp.java.jcontainer.interest
Message-ID <[email protected]>
On Feb 6, 2004, at 8:24 PM, Chad Woolley wrote:
> 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?

I believe that is the preferred approach when doing constructor-based 
dependency injection.

Of course, it doesn't have to be an 'ObjectAConfig' class, it could be 
a Properties object, a DOM document, or anything else.. but there is 
the general principal of passing a representation of the config via the 
constructor.
-pete
smime.p7s (application/pkcs7-signature, 2.3 KB) - not displayed