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

You write new WelcomeService(...) yourself instead of letting Spring create it. What is the result?

You write new WelcomeService(...) yourself instead of letting Spring create it. What is the result?

  1. A.Spring still injects its dependencies
  2. B.It is not a bean, so Spring does not manage or inject anything into it
  3. C.It replaces the Spring bean
  4. D.Compile error
Answer & explanation

Correct answer: It is not a bean, so Spring does not manage or inject anything into it

Only objects created by the container get injection, proxies and lifecycle callbacks.

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 →