🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Spring Core and DI: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does "Inversion of Control" mean in Spring?
  2. Q2. Two beans implement Notifier and one is marked @Primary. A constructor asks for a plain Notifier. Which is injected?
  3. Q3. Which injection style is recommended?
  4. Q4. What is the default scope of a Spring bean?
  5. Q5. Which annotation is NOT a specialisation of @Component?
  6. Q6. What is a "bean" in Spring?
  7. Q7. Which error do you get when two beans of the same type exist and neither is @Primary nor selected by @Qualifier?
  8. Q8. Why is it dangerous to store per-user data in a field of a singleton service bean?
  9. Q9. You write new WelcomeService(...) yourself instead of letting Spring create it. What is the result?
  10. Q10. When do you use a @Bean method instead of @Component?