Dependency injection allows you to easily unit test your logic.  If you use
a static method, you can't substitute a "dummy" implementation of the mail
sending logic during unit testing.

-----Original Message-----
From: ZedroS Schwart [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 01, 2006 10:42 AM
To: Tapestry users
Subject: Injecting services and static method

Hi

I was reading some doc regarding another issue and I just ran into this
example of service injection :

<page-specification class=". . .">

  <inject property="mailSender" object="service:mymodule.MailSender"/>

</page-specification>

I'm wondering what the difference with an old fashioned "static method"
called let's say "sendMail".

What are the benefits of the service injection ?

It may be a stupid question, I apologize in advance, I'm just curious...

Thanks in advance
ZedroS



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to