skip to content

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

level: middleimportance: should knowfreq 40%

answer

  1. info.* prefix -> EnvironmentInfoContributor strips prefix
  2. env disabled by default since Boot 2.6
  3. java + os contributors also off by default
  4. management.info.<name>.enabled pattern
  5. build/git = true, env/java/os = false

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.

solid answer

~30 s

Beyond build and git, Spring Boot ships three more auto-configured contributors that are off by default. EnvironmentInfoContributor takes every property whose key starts with info. from the Environment (application.properties, env vars, config server, etc.), strips the prefix, and nests it under info — so info.app.team=payments shows as app.team. JavaInfoContributor adds a java block (version, vendor, runtime). OsInfoContributor adds an os block (name, version, arch). Since Spring Boot 2.6 the env contributor is disabled by default, and java/os have always shipped disabled, so you must opt in: management.info.env.enabled=true, management.info.java.enabled=true, management.info.os.enabled=true. These flags follow the general management.info.<contributor>.enabled pattern.

code

java · 20 lines
java
// application.yml
// info:
//   app:
//     name: Billing Service
//     team: payments
// management:
//   info:
//     env:
//       enabled: true    # required since Spring Boot 2.6 for info.* to show
//     java:
//       enabled: true
//     os:
//       enabled: true

// Resulting /actuator/info (excerpt):
// {
//   "app": { "name": "Billing Service", "team": "payments" },
//   "java": { "version": "21.0.2", "vendor": { "name": "Eclipse Adoptium" } },
//   "os":   { "name": "Linux", "version": "6.5.0", "arch": "amd64" }
// }

go deeper

for a junior

Know info.* properties can appear in /actuator/info.

for a middle

List env/java/os contributors and that they're off by default with per-contributor enable flags.

for a senior

Explain the 2.6 default change, resource filtering for build values, and env-vs-/actuator/env distinction.

for a principal

Set org-wide policy on which contributors are enabled per environment and how metadata is injected in CI.

## The env contributor — your own metadata `EnvironmentInfoContributor` is how you add **arbitrary static metadata** without writing code. It scans the Spring `Environment` for any property key beginning with `info.`, removes that prefix, and adds the remainder as nested JSON under the info response. ```properties # application.properties info.app.name=Billing Service info.app.team=payments [email protected]@ # Maven resource filtering can inject build values ``` yields ```json { "app": { "name": "Billing Service", "team": "payments" } } ``` Because it reads the whole `Environment`, the value can come from `application.yml`, environment variables, command-line args, a config server, etc. Maven/Gradle **resource filtering** (`@...@` / `${...}` placeholders) is commonly used to inject build-time values like project version. **Important default change:** since **Spring Boot 2.6**, `management.info.env.enabled` defaults to **false** (it was `true` before). If your `info.*` properties stopped showing after an upgrade, this is why — set `management.info.env.enabled=true`. ## The java contributor `JavaInfoContributor` adds a `java` block with details such as `java.version`, `java.vendor.name`/`version`, and `java.runtime.name`/`version`. Enable with `management.info.java.enabled=true` (default false). ## The os contributor `OsInfoContributor` adds an `os` block: `os.name`, `os.version`, `os.arch`. Enable with `management.info.os.enabled=true` (default false). ## The general pattern Every built-in contributor is gated by `management.info.<name>.enabled`: - `build` — default **true** - `git` — default **true** - `env` — default **false** (since 2.6) - `java` — default **false** - `os` — default **false** - `process` — default **false** (adds pid/uptime; `ProcessInfoContributor`) - `ssl` — newer, exposes certificate expiry info (Boot 3.4+) ## Gotchas - **info.* not showing** → env contributor disabled by default in 2.6+. - **Filtering placeholders literal** (`@project.version@` shows verbatim) → resource filtering isn't configured for that file, or you used the wrong delimiter for the build tool. - **Don't dump the whole environment** → the env contributor only picks the `info.` prefix; it does not expose all properties (that's the separate `/actuator/env` endpoint, which is sensitive). ## When to use Use the env contributor for human-meaningful deploy metadata (team, service description, region). Enable java/os selectively — they're handy in debugging but add noise and minor disclosure, so keep them off in public-facing exposure.

  • After upgrading from Spring Boot 2.5 to 3.x, your info.* properties disappeared from /actuator/info. Why and how do you fix it?
    Since 2.6 management.info.env.enabled defaults to false, disabling EnvironmentInfoContributor. Re-add management.info.env.enabled=true.
  • Does the env contributor expose all Environment properties?
    No — only keys prefixed with info., with the prefix stripped. The full environment is exposed by the separate, sensitive /actuator/env endpoint.

saying these in an interview costs you the question

  • Claiming the env contributor dumps the entire Spring Environment
  • Assuming info.* properties show without enabling management.info.env.enabled in Boot 2.6+
  • Thinking java/os contributors are on by default
  • Confusing /actuator/info's env contributor with the /actuator/env endpoint

context