What is the purpose of the Info endpoint in Spring Boot Actuator?
The Info endpoint provides custom application information such as version, description, or build details. It helps monitor app metadata easily.
Click to reveal answer
beginner
How do you add custom information to the Info endpoint in Spring Boot?
You add custom info by defining properties under management.info in application.properties or application.yml. For example, management.info.app.name=MyApp.
Click to reveal answer
intermediate
Which file is commonly used to add build or git info to the Info endpoint automatically?
The build-info.properties file generated by the Spring Boot Maven or Gradle plugin can be used. It adds build details like version and time to the Info endpoint.
Click to reveal answer
beginner
How do you enable the Info endpoint if it is disabled by default?
Set management.endpoint.info.enabled=true in your configuration file to enable the Info endpoint.
Click to reveal answer
beginner
What is the default URL path to access the Info endpoint in Spring Boot Actuator?
The default URL path is /actuator/info. Accessing this returns the configured info data in JSON format.
Click to reveal answer
Where do you configure custom info properties for the Info endpoint?
AIn the static resources folder
BIn the main application class
CUnder management.info in application.properties or application.yml
DIn the database configuration
✗ Incorrect
Custom info properties are set under management.info in configuration files.
What plugin helps generate build-info.properties for the Info endpoint?
AJUnit plugin
BSpring Boot Maven or Gradle plugin
CHibernate plugin
DDocker plugin
✗ Incorrect
Spring Boot Maven or Gradle plugin can generate build-info.properties automatically.
What is the default path to access the Info endpoint?
A/api/info
B/info
C/management/info
D/actuator/info
✗ Incorrect
The Info endpoint is available by default at /actuator/info.
How do you enable the Info endpoint if it is disabled?
ASet management.endpoint.info.enabled=true
BRestart the server twice
CAdd @EnableInfoEndpoint annotation
DNo need to enable, always active
✗ Incorrect
You enable the Info endpoint by setting management.endpoint.info.enabled=true.
Which of these is NOT a typical use of the Info endpoint?
AExposing sensitive user data
BShowing app version and build info
CProviding app description
DDisplaying git commit details
✗ Incorrect
The Info endpoint should not expose sensitive user data.
Explain how to add and expose custom application information using the Spring Boot Info endpoint.
Think about configuration files and endpoint URLs.
You got /4 concepts.
Describe how build and git information can be automatically included in the Info endpoint output.
Consider build tools and generated files.
You got /4 concepts.
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
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.
Step 2: Compare with other endpoint purposes
Unlike authentication or serving static content, info is specifically for metadata exposure.
Final Answer:
To provide application metadata like version and description -> Option A
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
Step 1: Recall the correct property prefix for management endpoints
Spring Boot uses management.endpoint.{name}.enabled to enable endpoints.
Step 2: Match the property for info endpoint
For the info endpoint, it is management.endpoint.info.enabled.
Final Answer:
management.endpoint.info.enabled=true -> Option C
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
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
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.
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"}}.
Final Answer:
{"app":{"name":"MyApp","version":"1.2.3"}} -> Option B
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
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.
Step 2: Verify exposure includes 'info'
If 'info' is missing from the exposure list, the endpoint returns 404 despite being enabled.
Final Answer:
The info endpoint is not included in management.endpoints.web.exposure.include -> Option D
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
Step 1: Enable the info endpoint
Set management.endpoint.info.enabled=true to activate the info endpoint.
Step 2: Expose the info endpoint over HTTP
Include 'info' in management.endpoints.web.exposure.include to make it accessible.
Step 3: Add custom build info properties
Use spring.info.build.version and spring.info.build.time to add custom metadata.
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