Skip navigation.

Dependency Injection with Spring.NET

Dependency Injection with Spring.NET

Over the next few months I'll be working on a messaging system (WSE, MSMQ, UDDI et al). I have inherited some code, which doesn't have many tests. I want to use TDD and also introduce the Spring.NET Dependency Injection Container so find myself in a very interesting refactoring situation. My rough stab at a strategy so far is:
  • Identify the first component I want to extract, motivated by a required change in behaviour
  • Identify which pieces of the existing system implement this component (!)
  • Drive design for the component with unit tests, writing adapter(s) where necessary
  • Delegate instantiation of the concrete instance of the component to Spring.NET
  • Modify the behaviour of the component as required
I hope to provide concrete examples of the refactoring process as we go.