I Miss Dependency Injection

I’ve just started working on a fairly small web application project that uses Struts as its web framework. I like Struts, its fairly simple to use and covers just about everything I need for my application.

Since I’m now using NetBeans 5 Beta 2 (eventually!), I though I would have a read of Geertjan’s series of articles on how to use Struts with NetBeans. These are good articles if you are new to Struts or want to see how NetBeans handles Struts development.

However, since I’ve used Spring in the past, Geertjan’s method of grabbing database connections seems odd. I’m not detracting in any way from the series of articles (which are great) which are intended to discuss struts development with NetBeans – this is more of a problem I have with Struts.

Once you get into the rhythm of using DI, it seems strange going back to explicitly setting things up. For example datasources – injecting datasources directly into DAOs is one of the best things that I like about Spring and something that seems completely unnecessary now when using Struts.