🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Roadmap and Maven: all 10 questions

Quiz: Roadmap and Maven · Question 9 of 10

A @Service class is placed in com.example.other while the main class is in com.skills101.courses. What happens?

A @Service class is placed in com.example.other while the main class is in com.skills101.courses. What happens?

  1. A.Component scanning does not find it, so it is not a bean
  2. B.It is found because all packages are scanned
  3. C.The project does not compile
  4. D.Spring moves the class automatically
Answer & explanation

Correct answer: Component scanning does not find it, so it is not a bean

@SpringBootApplication scans its own package and sub-packages only.

Can you get the rest right without peeking?

Take the timed Quiz: Roadmap and Maven quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →