Bird
Raised Fist0
Spring Bootframework~20 mins

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

Choose your learning style10 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.

Practice

(1/5)
1. What is the primary purpose of the info endpoint in a Spring Boot application?
easy
A. To provide application metadata like version and description
B. To expose database query results
C. To handle user authentication
D. To serve static web content

Solution

  1. Step 1: Understand the role of the info endpoint

    The info endpoint is designed to share metadata about the application, such as version, description, or build info.
  2. Step 2: Compare with other endpoint purposes

    Unlike authentication or serving static content, info is specifically for metadata exposure.
  3. Final Answer:

    To provide application metadata like version and description -> Option A
  4. Quick Check:

    Info endpoint = app metadata [OK]
Hint: Info endpoint shares app details, not data or auth [OK]
Common Mistakes:
  • Confusing info endpoint with security or data endpoints
  • Thinking it serves static files
  • Assuming it handles user login
2. Which property correctly enables the info endpoint in Spring Boot's application.properties file?
easy
A. info.endpoint.management.enabled=true
B. spring.info.endpoint.enabled=true
C. management.endpoint.info.enabled=true
D. management.info.enabled=true

Solution

  1. Step 1: Recall the correct property prefix for management endpoints

    Spring Boot uses management.endpoint.{name}.enabled to enable endpoints.
  2. Step 2: Match the property for info endpoint

    For the info endpoint, it is management.endpoint.info.enabled.
  3. Final Answer:

    management.endpoint.info.enabled=true -> Option C
  4. Quick Check:

    Enable info endpoint = management.endpoint.info.enabled [OK]
Hint: Use management.endpoint.info.enabled to enable info [OK]
Common Mistakes:
  • Using spring.info.endpoint.enabled which is invalid
  • Mixing property order or names
  • Using management.info.enabled which is incorrect
3. Given this application.properties snippet:
management.endpoints.web.exposure.include=info,health
spring.info.app.name=MyApp
spring.info.app.version=1.2.3

What will the /actuator/info endpoint return?
medium
A. {"application":{"name":"MyApp","version":"1.2.3"}}
B. {"app":{"name":"MyApp","version":"1.2.3"}}
C. {"appName":"MyApp","appVersion":"1.2.3"}
D. {"info":{"name":"MyApp","version":"1.2.3"}}

Solution

  1. Step 1: Understand spring.info property mapping

    Properties under spring.info.* appear as nested JSON keys matching their structure. Here, spring.info.app.name and spring.info.app.version create an "app" object.
  2. Step 2: Check the JSON structure returned by /actuator/info

    The info endpoint returns JSON with keys matching the spring.info hierarchy, so it returns {"app":{"name":"MyApp","version":"1.2.3"}}.
  3. Final Answer:

    {"app":{"name":"MyApp","version":"1.2.3"}} -> Option B
  4. Quick Check:

    spring.info.app.* -> JSON key "app" [OK]
Hint: spring.info.app.name -> JSON key 'app' with nested fields [OK]
Common Mistakes:
  • Assuming keys are renamed to 'info' or 'application'
  • Expecting flat JSON without nesting
  • Confusing property names with JSON keys
4. You added management.endpoint.info.enabled=true but /actuator/info still returns 404. What is the most likely cause?
medium
A. The property name is misspelled as management.endpoint.info.enable
B. The actuator dependency is not added
C. The application.properties file is missing
D. The info endpoint is not included in management.endpoints.web.exposure.include

Solution

  1. Step 1: Check endpoint exposure settings

    Even if the info endpoint is enabled, it must be exposed over HTTP by including it in management.endpoints.web.exposure.include.
  2. Step 2: Verify exposure includes 'info'

    If 'info' is missing from the exposure list, the endpoint returns 404 despite being enabled.
  3. Final Answer:

    The info endpoint is not included in management.endpoints.web.exposure.include -> Option D
  4. Quick Check:

    Enable + expose info endpoint = no 404 [OK]
Hint: Enable and expose info endpoint to avoid 404 [OK]
Common Mistakes:
  • Only enabling endpoint without exposing it
  • Misspelling property names
  • Assuming actuator dependency is always missing
5. You want to add custom build info to the info endpoint using spring.info.build.* properties and expose it. Which configuration snippet correctly achieves this?
hard
A. management.endpoint.info.enabled=true management.endpoints.web.exposure.include=info spring.info.build.version=2.0.1 spring.info.build.time=2024-06-01T12:00:00Z
B. management.endpoints.web.exposure.include=info spring.info.build.version=2.0.1 spring.info.build.time=2024-06-01T12:00:00Z
C. management.endpoint.info.enabled=true spring.info.build.version=2.0.1 management.endpoints.web.exposure.include=health
D. spring.info.build.version=2.0.1 management.endpoint.info.enabled=false management.endpoints.web.exposure.include=info

Solution

  1. Step 1: Enable the info endpoint

    Set management.endpoint.info.enabled=true to activate the info endpoint.
  2. Step 2: Expose the info endpoint over HTTP

    Include 'info' in management.endpoints.web.exposure.include to make it accessible.
  3. Step 3: Add custom build info properties

    Use spring.info.build.version and spring.info.build.time to add custom metadata.
  4. Final Answer:

    management.endpoint.info.enabled=true management.endpoints.web.exposure.include=info spring.info.build.version=2.0.1 spring.info.build.time=2024-06-01T12:00:00Z -> Option A
  5. Quick Check:

    Enable + expose + add spring.info.build.* = correct config [OK]
Hint: Enable, expose info, add spring.info.build.* properties [OK]
Common Mistakes:
  • Forgetting to expose info endpoint
  • Disabling info endpoint accidentally
  • Exposing wrong endpoints like only health
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