0
0
Spring Bootframework~20 mins

Multi-module project structure in Spring Boot - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Multi-module Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
How does a multi-module Spring Boot project handle dependencies?

Consider a multi-module Spring Boot project where module A depends on module B. What happens when you build module A?

AModule A can only use module B if both modules are merged into a single jar file.
BModule A ignores module B unless you manually copy module B's jar into module A's classpath.
CModule A must declare module B as a runtime dependency but not as a compile-time dependency.
DModule A automatically includes module B's classes and resources during its build and runtime.
Attempts:
2 left
💡 Hint

Think about how Maven or Gradle handles project dependencies in multi-module setups.

📝 Syntax
intermediate
2:00remaining
Correct parent POM declaration for multi-module Spring Boot project

Which of the following is the correct way to declare a parent POM for a multi-module Spring Boot project?

A
<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.5.0</version>
</parent>
B
<parent>
  <groupId>com.example</groupId>
  <artifactId>parent-project</artifactId>
  <version>1.0.0</version>
</parent>
C
<parent>
  <groupId>com.example</groupId>
  <artifactId>parent-project</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
</parent>
D
<parent>
  <groupId>com.example</groupId>
  <artifactId>child-module</artifactId>
  <version>1.0.0</version>
</parent>
Attempts:
2 left
💡 Hint

The parent POM should represent the overall project, not a child module.

🔧 Debug
advanced
3:00remaining
Why does a Spring Boot multi-module project fail to start with NoSuchBeanDefinitionException?

You have a multi-module Spring Boot project. Module A defines a service bean, and module B depends on module A. When running module B, you get NoSuchBeanDefinitionException for the service in module A. What is the most likely cause?

AModule B does not have module A as a dependency in its build configuration.
BThe service bean in module A is not annotated with <code>@Service</code> or <code>@Component</code>.
CModule B's <code>@SpringBootApplication</code> scan does not include module A's packages.
DModule A's service bean is defined as <code>private</code> and cannot be accessed.
Attempts:
2 left
💡 Hint

Think about how Spring Boot scans for beans in multi-module projects.

state_output
advanced
3:00remaining
What is the output when running a multi-module Spring Boot project with conflicting properties?

In a multi-module Spring Boot project, module A and module B both define application.properties files with the same property app.name but with different values. When running the project, which value will Spring Boot use?

AThe value from the module that appears last in the classpath is used.
BThe value from module A's <code>application.properties</code> is used.
CSpring Boot merges both and throws an error due to conflict.
DThe value from module B's <code>application.properties</code> is used.
Attempts:
2 left
💡 Hint

Consider how Spring Boot loads properties from multiple sources.

🧠 Conceptual
expert
4:00remaining
Best practice for sharing common code in multi-module Spring Boot projects

In a large multi-module Spring Boot project, you want to share common utility classes and configurations across multiple modules. What is the best practice to organize this?

ACreate a separate common module that contains shared code and declare it as a dependency in other modules.
BDuplicate the common code in each module to avoid dependency issues.
CPlace all common code in the parent POM file as Java classes.
DUse Spring Boot's auto-configuration to automatically share code without dependencies.
Attempts:
2 left
💡 Hint

Think about modular design and code reuse principles.