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