0
0
Spring Bootframework~5 mins

Info endpoint configuration in Spring Boot

Choose your learning style9 modes available
Introduction

The Info endpoint shows useful details about your Spring Boot app. It helps you share app info easily without extra coding.

You want to display app version and build info on a dashboard.
You need to share environment details for debugging.
You want to expose custom info like team name or project URL.
You want a simple way to check app metadata in production.
Syntax
Spring Boot
management.endpoint.info.enabled=true
management.endpoints.web.exposure.include=info
spring.info.app.name=MyApp
spring.info.app.version=1.0.0
spring.info.app.description=Sample Spring Boot app

Enable the info endpoint and expose it over HTTP.

Use spring.info.* properties to add custom info.

Examples
This makes the info endpoint available over HTTP.
Spring Boot
# Enable info endpoint and expose it
management.endpoint.info.enabled=true
management.endpoints.web.exposure.include=info
These properties add custom info shown by the endpoint.
Spring Boot
# Add app info details
spring.info.app.name=MyApp
spring.info.app.version=1.0.0
spring.info.app.description=Sample Spring Boot app
Use this to see the info endpoint output.
Spring Boot
# Example curl command to get info
curl http://localhost:8080/actuator/info
Sample Program

This Spring Boot app enables the info endpoint and adds app details. When you run it and visit /actuator/info, you see the info JSON.

Spring Boot
package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

# application.properties
management.endpoint.info.enabled=true
management.endpoints.web.exposure.include=info
spring.info.app.name=DemoApp
spring.info.app.version=1.2.3
spring.info.app.description=Demo Spring Boot application
OutputSuccess
Important Notes

Make sure to include spring-boot-starter-actuator dependency to use actuator endpoints.

You can add any custom info by defining spring.info.* properties or using a custom InfoContributor bean.

Summary

The info endpoint shares app metadata easily.

Enable it in properties and expose it over HTTP.

Add custom info using spring.info.* properties.