← Quiz: Spring Core and DI: all 10 questions
Quiz: Spring Core and DI · Question 3 of 10
Which injection style is recommended?
Which injection style is recommended?
- A.Field injection with @Autowired
- B.Constructor injection
- C.Static injection
- D.Setter injection for everything
Answer & explanation
Correct answer: Constructor injection
Constructor injection allows final fields and simple unit tests.
Can you get the rest right without peeking?
Take the timed Quiz: Spring Core and DI quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →