Thanks for the article!  I'm reading through it now -- it's a long one... If
my next question is in the article, just tell me to keep reading -- I don't
mean to waste anyone's time.

My one "issue" with Setter injection is that the dependencies aren't
guaranteed to be set by the time I need them (hence why I liked the
constructor-arg property).  What do you guys do for ensuring that your
dependencies are in place when you use setter injection?

For example, I've got the following Gateway/Bean set up:

Domains.cfc
        Variables.datasource; // datasource
        Variables.typesCFC; // non-circular dependent CFC
Variables.emailsCFC; // circular dependent CFC
        function init()
        function setEmailsCFC()
        function getAllDomains()
        function addDomain()
        function editDomain()
        function deleteDomain()

The only reason I even need Variables.emailsCFC is in my delete method -- I
need to clear out all the DomainEmails records when I delete the Domain they
belong to... am I just supposed to do a check to make sure that
Variables.emailsCFC is instantiated on the first line of that function?  I
think it would work, but it does seem like there should be a better way to
do it.

Jonathon


-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Bell
Sent: Tuesday, June 19, 2007 10:56 AM
To: [email protected]
Subject: [coldspring-dev] newbie question!

Hi Tom,

But you still need to decide whether to use constructor or setter injection
though - autowiring just means you don't have to describe the wirings in
your XML. You still need to have a cfargument within your init method or a
cffunction as the setter in the bean. Which you choose depends on whether
you want to use constructor or setter injection . . .

Best Wishes,
Peter 


On 6/19/07 11:44 AM, "Tom Chiverton" <[EMAIL PROTECTED]> wrote:

> On Tuesday 19 Jun 2007, Jonathon Stierman wrote:
>> The problem I'm running in to is that I'm unsure whether I should be
>> specifying my dependencies as constructor-arg's or as properties.  In
some
>> cases, I don't have a choice (Domains is dependent on Contracts, and
>> Contracts is also dependent on Domains, so I have to use the <property>
tag
>> there).  
> 
> Leaving aside the whole circular-dependencies-are-wrong argument, we don't
use
> either, we use autowiring.






Reply via email to