🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Field injection with @Autowired
  2. B.Constructor injection
  3. C.Static injection
  4. 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 →