Hi

> So I've been doing some thinking lately about dependency injection,  
> and the fact that my own personal beef with it (other than the amount  
> of dogma surrounding it) is the fact that dependencies are exposed  
> through the public interface of the class.  This has always seemed  
> wrong to me.
How would you else do it? Lookup methods?
Either way (push or pull) you're committing to a level of dependency. A 
constructor argument or a setter is better than depndency on some lookup class 
IMO.
What I like is that I can see my dependencies (those that matter) and I can 
easely mock them when unit testing.
Keeping dependencies in the class and not the interface is in most cases best 
practise.

> Anyway, after a little push from Nic to make the @Before/@After stuff  
> work with non-public methods, I figured why not do the same for the  
> Spring integration?
>  And actually I've gone on a bit of a rampage and  
> refactored the SpringHelper quite significantly.  I've made the  
> following improvements:
>       - support for protected/package/private method access as well as public

Using private makes unit testing almost impossible (you need to supply a 
dependency somehow) and protected makes it harder (subclassing is needed), so 
IMO public is the right access level.

>       - support for public/protected/package/private *field* access (if  
> you annotate the field)

I like that I can specify it on the field, but I would still like to keep my 
public setter.

>       - support for non-standard method naming (e.g. @SpringBean someBean 
> (Bean bean) will look for "someBean" in the ctx)
Neat :)

> That said, I don't actually use Spring in any of the applications I'm  
> developing currently.  Anyone game for trying out the latest spring  
> support and providing feedback?  It'll be in SVN a few minutes after  
> I hit send on this email...
I will try it out tomorrow and get back to you with feedback.

/Jeppe


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to