Bird
0
0

You have a Spring Boot project with multiple modules. Where should you place a shared utility class used by all modules?

hard📝 Application Q9 of 15
Spring Boot - Fundamentals
You have a Spring Boot project with multiple modules. Where should you place a shared utility class used by all modules?
AIn a separate common module included as a dependency
BIn the main application module's src/main/java folder
CIn each module's src/test/java folder
DIn the resources folder of the main module
Step-by-Step Solution
Solution:
  1. Step 1: Understand multi-module project structure

    Shared code should be in a dedicated module to avoid duplication.
  2. Step 2: Place shared utilities in a common module

    This module is added as a dependency to other modules needing the utilities.
  3. Final Answer:

    In a separate common module included as a dependency -> Option A
  4. Quick Check:

    Shared code belongs in a common module [OK]
Quick Trick: Use a common module for shared utilities in multi-module projects [OK]
Common Mistakes:
  • Duplicating utility classes in each module
  • Placing shared code in test folders
  • Putting Java code in resources folder

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes