A couple of people replied to my last article about constructor vs setter injection that they prefer a third option, field injection. This is a slight variant of setter injection in which we magically let the setter dissapear.
So, another blogpost here!
Recently I’ve had a discussion with a collegue about Setter vs Constructor injection. For those who don’t know what I’m talking about a quick example:
Setter injection:
public class SomeClass { private SomeDependency someDependency; public SomeClass() { //Empty constructor } public void setSomeDependency(SomeDependency someDependency) { this.someDependency = someDependency; } }
Constructor injection:
public class SomeClass [...]
Recently I placed a comment on this interesting blog from Uncle Bob Martin (Robert C. Martin). It contains a brief description on how I teach people how to use the Spring Framework.
Now, by popular demand (one person requested it over Twitter), I’ll guide you through the method and examples I use in this blogpost. It explains why people should use frameworks like Spring and/or Google Guice, and how.
To improve the quality of your code it is important to thoroughly test your code. Not only using unit tests but also using integration tests. I’ll describe these terms and show examples on how to create tests using JUnit and Spring’s Test library.
Unit Testing
A unit-test is an automated test that tests one single [...]
Latest tweet
- Unique, there is only one traffic jam in the Netherlands currently! The only problem? It is almost 1000km long.
Links
Archives

