0
0
Spring Bootframework~20 mins

Info endpoint configuration in Spring Boot - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Info Endpoint Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What is the output of the Info endpoint with custom properties?

Given a Spring Boot application with the following application.properties configuration:

management.endpoint.info.enabled=true
management.endpoints.web.exposure.include=info
info.app.name=MyApp
info.app.version=1.0.0

What will be the JSON output when accessing /actuator/info?

A{"info":{"app":{"name":"MyApp","version":"1.0.0"}}}
B{"app":{"name":"MyApp","version":"1.0.0"}}
C{"name":"MyApp","version":"1.0.0"}
D{"app.name":"MyApp","app.version":"1.0.0"}
Attempts:
2 left
💡 Hint

Think about how Spring Boot nests info properties under the info key in the JSON response.

📝 Syntax
intermediate
1:30remaining
Which configuration enables the Info endpoint in Spring Boot?

Which of the following application.properties snippets correctly enables the Info endpoint and exposes it over HTTP?

A
management.endpoint.info.enabled=false
management.endpoints.web.exposure.exclude=info
Bmanagement.endpoints.web.exposure.exclude=info
C
management.endpoints.enabled-by-default=false
management.endpoints.web.exposure.include=info
D
management.endpoint.info.enabled=true
management.endpoints.web.exposure.include=info
Attempts:
2 left
💡 Hint

Remember you must both enable the endpoint and expose it over HTTP.

🔧 Debug
advanced
2:00remaining
Why does the Info endpoint return an empty JSON object?

A developer configured the Info endpoint with these properties:

management.endpoint.info.enabled=true
management.endpoints.web.exposure.include=info

But when accessing /actuator/info, the response is {}. What is the most likely cause?

ANo custom info properties are defined in <code>application.properties</code> or <code>application.yml</code>
BThe Info endpoint is disabled by default and must be enabled in code
CThe endpoint URL is incorrect; it should be <code>/info</code> not <code>/actuator/info</code>
DThe application is missing the Spring Boot Actuator dependency
Attempts:
2 left
💡 Hint

Think about what the Info endpoint shows by default if no info properties are set.

🧠 Conceptual
advanced
2:30remaining
How to add custom info data programmatically in Spring Boot?

Which approach correctly adds custom information to the Info endpoint response by code?

ACreate a bean implementing <code>InfoContributor</code> and override <code>contribute(Info.Builder builder)</code>
BAdd a <code>@RestController</code> with a <code>@GetMapping("/actuator/info")</code> method returning a Map
COverride the <code>info()</code> method in the main application class annotated with <code>@SpringBootApplication</code>
DAdd properties under <code>management.info.custom</code> in <code>application.properties</code>
Attempts:
2 left
💡 Hint

Think about how Spring Boot allows programmatic customization of actuator endpoints.

state_output
expert
3:00remaining
What is the output of the Info endpoint with multiple InfoContributor beans?

Consider a Spring Boot app with two InfoContributor beans defined:

@Component
public class AppInfoContributor implements InfoContributor {
  public void contribute(Info.Builder builder) {
    builder.withDetail("app", Map.of("name", "AppX"));
  }
}

@Component
public class VersionInfoContributor implements InfoContributor {
  public void contribute(Info.Builder builder) {
    builder.withDetail("version", "2.1.0");
  }
}

What JSON will /actuator/info return?

A{"app":{"name":"AppX"}}
B{"app":{"name":"AppX"},"version":{"version":"2.1.0"}}
C{"app":{"name":"AppX"},"version":"2.1.0"}
D{"version":"2.1.0"}
Attempts:
2 left
💡 Hint

Remember that each InfoContributor adds details to the same builder object.