What is the Actuator /actuator/info endpoint and where does its content come from?
answer
- no fixed schema — merged from InfoContributor beans
- Info.Builder accumulates details
- empty {} when no contributors
- enabled by default, but only health exposed in Boot 3
- build + git blocks when properties files exist
basics
~10 sGET /actuator/info returns arbitrary application info as JSON. Spring Boot builds the response by collecting every InfoContributor bean; each one adds details like build version, git commit, or Java/OS info.
solid answer
~40 s/actuator/info is a read-only Actuator endpoint that returns a JSON document describing the application. Spring Boot has no fixed schema for it: at request time it iterates over every InfoContributor bean in the context, calling contribute(Info.Builder), and merges their details. Out of the box you may get build-info (from BuildProperties) and git-info (from GitProperties) if those files exist, plus optional env/java/os contributors. If no contributor adds anything, the endpoint returns an empty object {}. The endpoint is enabled by default, but in Spring Boot 3.x only health is exposed over HTTP by default, so you must add info to management.endpoints.web.exposure.include to reach it.
code
java · 11 lines// The core interface every contributor implements
public interface InfoContributor {
void contribute(Info.Builder builder);
}
// application.properties
// info endpoint is enabled by default, but must be exposed over HTTP:
// management.endpoints.web.exposure.include=health,info
// GET /actuator/info -> e.g.
// { "build": { "version": "1.4.0" }, "git": { "commit": { "id": "a1b2c3" } } }go deeper
Know it returns JSON app info assembled from InfoContributor beans, and that it may be empty.
Explain the enabled-vs-exposed distinction and the auto-configured contributors.
Discuss the merge semantics of Info.Builder and which contributors are off by default.
Frame it as a deploy-metadata surface and reason about exposure/security policy across environments.
## What it is `/actuator/info` is one of Spring Boot Actuator's built-in **endpoints**. Actuator is a Spring Boot module (dependency `spring-boot-starter-actuator`) that exposes operational endpoints (health, metrics, info, env, etc.) over HTTP and/or JMX. The `info` endpoint is purely informational and read-only: it returns a JSON object describing the running application (version, commit, environment, custom metadata). ## Where the content comes from — InfoContributor Unlike `/actuator/health`, the `info` endpoint has **no fixed schema**. Its content is assembled from beans implementing the `org.springframework.boot.actuate.info.InfoContributor` interface: ```java public interface InfoContributor { void contribute(Info.Builder builder); } ``` When a request hits the endpoint, `InfoEndpoint` iterates over **all** `InfoContributor` beans, calls `contribute` on each, and the `Info.Builder` accumulates their details into one merged JSON object. If there are no contributors (or none add data), the response is simply `{}`. ## Auto-configured contributors Spring Boot auto-configures several contributors when the right conditions are met: - **`BuildInfoContributor`** — active when a `BuildProperties` bean exists (from `META-INF/build-info.properties`). Adds a `build` block. - **`GitInfoContributor`** — active when a `GitProperties` bean exists (from `git.properties`). Adds a `git` block. - **`EnvironmentInfoContributor`** — exposes any properties prefixed `info.*` from the Spring `Environment`. - **`JavaInfoContributor`**, **`OsInfoContributor`**, **`ProcessInfoContributor`** — add `java`, `os`, and `process` blocks respectively. Many of these are **disabled by default** and gated by `management.info.<name>.enabled` flags (details in later questions). ## Enabled vs. exposed — a common gotcha Two independent switches control whether you can actually call the endpoint over HTTP: 1. **Enabled**: `management.endpoint.info.enabled` (default `true`). 2. **Exposed over web**: `management.endpoints.web.exposure.include`. In **Spring Boot 3.x** the default is `health` **only** — so even though `info` is enabled, you must add it: `management.endpoints.web.exposure.include=health,info`. ## When to use Use `/actuator/info` to surface deploy-time facts operators care about: which version/commit is running, when it was built, environment name. It's ideal for CI/CD dashboards and quick 'what's deployed?' checks. Do not put secrets in it — see the security question.
- You added spring-boot-starter-actuator but GET /actuator/info returns 404. Why?In Spring Boot 3.x only health is exposed over HTTP by default. The endpoint is enabled but not exposed — add info to management.endpoints.web.exposure.include.
- GET /actuator/info returns 200 with an empty {} body. Is that a bug?No. It just means no InfoContributor added any detail — e.g. no build-info/git.properties files and env/java/os contributors disabled. The endpoint aggregates contributors, so with none it's an empty object.
saying these in an interview costs you the question
- Thinking /actuator/info has a fixed built-in schema like health
- Assuming info is exposed over HTTP by default in Spring Boot 3.x
- Confusing 'endpoint enabled' with 'endpoint exposed over web'
- Believing build/git info appears automatically without generating the properties files