0
0
Spring Bootframework~10 mins

Why monitoring matters in Spring Boot - Test Your Understanding

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

Complete the code to enable basic actuator endpoints in a Spring Boot application.

Spring Boot
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    [1]
}
Drag options to blanks, or click blank then click option'
Aimplementation 'org.springframework.boot:spring-boot-starter-actuator'
Bimplementation 'org.springframework.boot:spring-boot-starter-data-jpa'
Cimplementation 'org.springframework.boot:spring-boot-starter-security'
Dimplementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding unrelated dependencies like JPA or Thymeleaf instead of actuator.
2fill in blank
medium

Complete the property to expose all actuator endpoints over HTTP.

Spring Boot
management.endpoints.web.exposure.include=[1]
Drag options to blanks, or click blank then click option'
Ametrics
Binfo
Chealth
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Exposing only one endpoint like 'health' or 'info' when all are needed.
3fill in blank
hard

Fix the error in the code to create a custom health indicator bean.

Spring Boot
@Component
public class CustomHealthIndicator implements HealthIndicator {
    @Override
    public Health health() {
        return Health.[1]().withDetail("status", "All good").build();
    }
}
Drag options to blanks, or click blank then click option'
Aup
Bunknown
Cdown
DoutOfService
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'down()' or 'unknown()' which indicate problems.
4fill in blank
hard

Fill both blanks to configure a custom endpoint path and enable it.

Spring Boot
management.endpoints.web.base-path=[1]
management.endpoint.health.enabled=[2]
Drag options to blanks, or click blank then click option'
A/monitoring
Btrue
Cfalse
D/api
Attempts:
3 left
💡 Hint
Common Mistakes
Using a path without '/' or disabling the endpoint accidentally.
5fill in blank
hard

Fill all three blanks to create a REST controller that returns application health status.

Spring Boot
import org.springframework.web.bind.annotation.[1];

@RestController
public class HealthController {

    private final HealthEndpoint healthEndpoint;

    public HealthController(HealthEndpoint healthEndpoint) {
        this.healthEndpoint = healthEndpoint;
    }

    @[2]("/custom-health")
    public Health health() {
        return healthEndpoint.[3]();
    }
}
Drag options to blanks, or click blank then click option'
AGetMapping
BRequestMapping
CGetHealth
DGet
Ehealth
Attempts:
3 left
💡 Hint
Common Mistakes
Using RequestMapping without specifying method=GET.
Incorrect method name on HealthEndpoint.