David_W (70) [Avatar] Offline
#1
In listing 16.4, you show the use of auto-wiring applied to the field level. Maybe you should mention that this will make unit testing difficult. This approach means that you need an application context specific to the tests that injects a mock implementation (if needed), or you need to use some reflection-based utility to set the field value.
David_W (70) [Avatar] Offline
#2
Re: Note about Configurable and Autowired fields
I meant listing 16.6
David_W (70) [Avatar] Offline
#3
Re: Note about Configurable and Autowired fields
I assume that the Autowired annotation would also work on a constructor, for constructor-based DI. This would remove the issue with testing.
ramnivas (171) [Avatar] Offline
#4
Re: Note about Configurable and Autowired fields
This is a general Spring issue with @Autowired fields. However, since many may not be familiar, I added a sentence.