Bird
Raised Fist0
Spring Bootframework~10 mins

Multi-module project structure in Spring Boot - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the parent project packaging type.

Spring Boot
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>parent-project</artifactId>
  <version>1.0.0</version>
  <packaging>[1]</packaging>
</project>
Drag options to blanks, or click blank then click option'
Awar
Bpom
Cear
Djar
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'jar' packaging for the parent project.
Confusing packaging types like 'war' or 'ear'.
2fill in blank
medium

Complete the code to include a module named 'service' in the parent POM.

Spring Boot
<modules>
  <module>[1]</module>
</modules>
Drag options to blanks, or click blank then click option'
Arepository
Bweb
Cservice
Dcommon
Attempts:
3 left
💡 Hint
Common Mistakes
Using module names that do not exist in the project.
Confusing module names with artifact IDs.
3fill in blank
hard

Fix the error in the child module POM to inherit from the parent project.

Spring Boot
<parent>
  <groupId>com.example</groupId>
  <artifactId>parent-project</artifactId>
  <version>[1]</version>
</parent>
Drag options to blanks, or click blank then click option'
A1.0.0
B1.0
Clatest
Dsnapshot
Attempts:
3 left
💡 Hint
Common Mistakes
Using incomplete or incorrect version strings.
Omitting the version tag.
4fill in blank
hard

Fill both blanks to define the parent and artifact IDs in a child module POM.

Spring Boot
<parent>
  <groupId>[1]</groupId>
  <artifactId>[2]</artifactId>
  <version>1.0.0</version>
</parent>
Drag options to blanks, or click blank then click option'
Acom.example
Bservice
Cparent-project
Dcom.service
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up groupId and artifactId values.
Using module names instead of parent project names.
5fill in blank
hard

Fill all three blanks to define a dependency in a child module POM.

Spring Boot
<dependency>
  <groupId>[1]</groupId>
  <artifactId>[2]</artifactId>
  <version>[3]</version>
</dependency>
Drag options to blanks, or click blank then click option'
Aorg.springframework.boot
Bspring-boot-starter-web
C3.0.5
Dcom.example
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect groupId or artifactId.
Omitting the version or using wrong version format.

Practice

(1/5)
1. What is the main purpose of a multi-module project in Spring Boot?
easy
A. To create multiple databases for one application
B. To run multiple Spring Boot applications simultaneously
C. To split a large project into smaller, manageable parts
D. To avoid using pom.xml files

Solution

  1. Step 1: Understand project organization

    Multi-module projects break a big codebase into smaller modules for easier management.
  2. Step 2: Identify the main goal

    This splitting helps teams work on parts independently and share code efficiently.
  3. Final Answer:

    To split a large project into smaller, manageable parts -> Option C
  4. Quick Check:

    Multi-module = smaller parts [OK]
Hint: Think of dividing work into smaller folders [OK]
Common Mistakes:
  • Confusing multi-module with running multiple apps
  • Thinking it removes the need for pom.xml
  • Assuming it creates multiple databases
2. Which file typically manages all modules in a Spring Boot multi-module project?
easy
A. application.properties
B. module-specific application.yml
C. settings.gradle
D. parent pom.xml

Solution

  1. Step 1: Identify the build management file

    In Maven-based Spring Boot projects, the parent pom.xml controls all modules.
  2. Step 2: Understand file roles

    Other files like application.properties configure app settings, not modules.
  3. Final Answer:

    parent pom.xml -> Option D
  4. Quick Check:

    Parent pom manages modules [OK]
Hint: Parent pom.xml controls modules [OK]
Common Mistakes:
  • Confusing application.properties with module management
  • Thinking settings.gradle is used in Maven projects
  • Assuming module-specific files manage all modules
3. Given a multi-module project with modules core and web, where web depends on core, what happens if core is not built before web?
medium
A. The web module build will fail due to missing dependencies
B. The web module will build successfully without core
C. Both modules will build independently without errors
D. The core module will build automatically after web

Solution

  1. Step 1: Understand module dependencies

    If web depends on core, it needs core built first to access its code.
  2. Step 2: Consequence of build order

    Building web without core causes missing dependency errors and build failure.
  3. Final Answer:

    The web module build will fail due to missing dependencies -> Option A
  4. Quick Check:

    Dependent module needs dependency built first [OK]
Hint: Build dependencies before dependents [OK]
Common Mistakes:
  • Assuming modules build independently
  • Thinking build order does not matter
  • Believing dependent modules build automatically
4. You have a multi-module Spring Boot project but the web module cannot find classes from the core module. What is the most likely cause?
medium
A. The core module is not listed as a dependency in web's pom.xml
B. The web module has no application.properties
C. The parent pom.xml is missing the modules section
D. The core module is using a different Java version

Solution

  1. Step 1: Check module dependencies

    If web cannot find core classes, it likely lacks a dependency declaration on core.
  2. Step 2: Verify dependency declaration

    Adding core as a dependency in web's pom.xml fixes class visibility.
  3. Final Answer:

    The core module is not listed as a dependency in web's pom.xml -> Option A
  4. Quick Check:

    Missing dependency causes class not found [OK]
Hint: Always declare module dependencies in pom.xml [OK]
Common Mistakes:
  • Ignoring dependency declarations
  • Thinking application.properties affects class visibility
  • Assuming Java version mismatch causes missing classes
5. In a multi-module Spring Boot project, you want to share common utility classes across modules without duplicating code. Which approach is best?
hard
A. Copy utility classes into each module's source folder
B. Create a separate common module and add it as a dependency to other modules
C. Put all utility classes in the parent pom.xml
D. Use application.properties to share utility classes

Solution

  1. Step 1: Identify code sharing strategy

    To avoid duplication, create a dedicated common module for shared utilities.
  2. Step 2: Use module dependencies

    Other modules add common as a dependency to access shared code cleanly.
  3. Final Answer:

    Create a separate common module and add it as a dependency to other modules -> Option B
  4. Quick Check:

    Shared code in common module [OK]
Hint: Use a common module for shared code [OK]
Common Mistakes:
  • Copying code causes duplication and maintenance issues
  • Trying to put code in pom.xml (not for code)
  • Using properties files to share classes
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard