Relying on dependency injection is even worse than setters. Will DI behave the same in tests as in real code? Are you sure?<p>The right thing is to use an actual constructor that takes constructor parameters. Guice and Spring can both handle this correctly (you just put the @Autowired on the constructor itself). The trouble is that in Java this requires ~twice as many lines as putting a magic annotation on your fields.