🎙 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 2 of 10

Two beans implement Notifier and one is marked @Primary. A constructor asks for a plain Notifier. Which is injected?

Two beans implement Notifier and one is marked @Primary. A constructor asks for a plain Notifier. Which is injected?

  1. A.The @Primary one
  2. B.Both, as a list
  3. C.Neither — startup fails
  4. D.A random one
Answer & explanation

Correct answer: The @Primary one

@Primary is the default choice; use @Qualifier to pick the other.

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 →