skip to content

info Endpoint & InfoContributor

The info endpoint aggregates contributors, most usefully the build and git properties emitted by the build plugin. Interviewers like it because 'which commit is running in production' should never be a guess.

part ofSpring Frameworkoverview, primer and where to startread it →
on this pageshow

questions

5

What is the Actuator /actuator/info endpoint and where does its content come from?

level: juniorimportance: must knowfreq 60%

answer

  1. no fixed schema — merged from InfoContributor beans
  2. Info.Builder accumulates details
  3. empty {} when no contributors
  4. enabled by default, but only health exposed in Boot 3
  5. build + git blocks when properties files exist

basics

~10 s

GET /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
java
// 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

for a junior

Know it returns JSON app info assembled from InfoContributor beans, and that it may be empty.

for a middle

Explain the enabled-vs-exposed distinction and the auto-configured contributors.

for a senior

Discuss the merge semantics of Info.Builder and which contributors are off by default.

for a principal

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

context

open as a page

How do you get build-info and git-info to appear under /actuator/info, and which beans back them?

level: middleimportance: must knowfreq 55%

basics

~20 s

Generate the metadata files at build time: the Spring Boot plugin's build-info goal creates META-INF/build-info.properties, and a git plugin creates git.properties. Spring Boot then auto-creates BuildProperties and GitProperties beans, and their contributors add build/git blocks.

open as a page

What do the env, java, and os info contributors expose, and how do you turn them on?

level: middleimportance: should knowfreq 40%

basics

~10 s

EnvironmentInfoContributor publishes any properties prefixed info.* from the Spring Environment. JavaInfoContributor and OsInfoContributor add JVM and OS details. All three are disabled by default; enable them with management.info.env.enabled / .java.enabled / .os.enabled = true.

open as a page

How do you add custom data to /actuator/info by writing your own InfoContributor?

level: seniorimportance: should knowfreq 45%

basics

~10 s

Create a Spring bean implementing InfoContributor and override contribute(Info.Builder builder), calling builder.withDetail(key, value) to add fields. Because InfoEndpoint aggregates all such beans, your block is merged into the response automatically.

open as a page

What are the security and exposure considerations when publishing /actuator/info, and how would you govern them?

level: principalimportance: should knowfreq 30%

basics

~20 s

The info endpoint can leak build/git details, environment metadata, and (in git full mode) remote URLs and committer emails. Control exposure with management.endpoints.web.exposure.include, protect Actuator with authentication, keep git.mode=simple, and never place secrets in info.* or custom contributors.

open as a page