24

I upgraded spring boot version in my app from 2.4.4 to 2.5.0 and it stopped exposing /actuator/info endpoint. Here is the pom.xml and application.yml

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.ms</groupId>
    <artifactId>spring-boot-test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-boot-test</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <layers>
                        <enabled>true</enabled>
                    </layers>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                            <goal>build-info</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

application.yml

management:
  endpoints:
    jmx:
      exposure:
        include: "health,info"

With spring boot parent version 2.4.4, the application is able to expose info endpoint but not with 2.5.0.

6 Answers 6

32

The correct property for exposing actuator urls over http is management.endpoints.web.​exposure.include (web instead of jmx).

In your case, info was exposed earlier not because you had the property you've provided but because it was exposed by default (along with health). But in 2.5.0 it becomes hidden, it according with Spring Boot 2.5 Release Notes - Secure Info Endpoint. So now you need to expose it manually.

1
  • 3
    +1 up for including the source, I upgraded to Spring Boot 2.5.9 from 2.4.12 and my /info stopped. I knew it became disabled but couldn't find the source.
    – Cortex
    Commented Feb 22, 2022 at 1:19
28

Add this to application properties to expose the /info endpoint.

management.info.env.enabled = true
1
12

In my case, which was a silly mistake, I had the following dependency:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator</artifactId>
    </dependency>

Instead of:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

So I kept on getting Whitelabel Error Page 404 Not found on all /actuator calls

In application.properties

#Actuator
management.endpoints.jmx.exposure.include=health,info,env,beans
management.endpoints.web.exposure.include=health,info,env,beans
8

You have to enable management.info.env.enabled true and you can add any kind of details that you want inside of the property file. like below. and make sure to enable info for web.exposure. all the configurations are like below.


.properties

#enable /actuator/info
management.info.env.enabled=true
management.endpoints.web.exposure.include=info

#custom properties
info.app.name=order-service
info.app.version=1.0.0
info.app.description=you can insert any kind of data in the property file like this
info.author=mafei

.ymal

#enable /actuator/info
management:
  info:
    env:
      enabled: true
  endpoints:
    web:
      exposure:
        include: info

#custom properties
info:
  app:
    name: order-service
    version: 1.0.0
    description: you can insert any kind of data in the property file like this
  author: mafei

You can see the result here.

enter image description here

1
  • thx , I hv indented 'info' inside 'management' and wondered why it was not showing up.
    – kuhajeyan
    Commented Nov 8, 2022 at 10:33
1

Here is a basic gradle build (kotlin dsl) to have three default available endpoints for actuator:

gradle.build.kts

build.gradle.kts
    //Global variables
    val junitVersion = "5.8.2"
    val springVersion = "2.6.4"
    val springWebVersion = "5.3.16"
    
    plugins {
        java
        id("org.springframework.boot") version "2.6.4"
    
    }
    
    group = "org.example"
    version = "1.0-SNAPSHOT"
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
        testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
    
        //spring boot
        implementation("org.springframework:spring-web:$springWebVersion")
        implementation("org.springframework.boot:spring-boot-starter-web:$springVersion")
        implementation("org.springframework.boot:spring-boot-starter-actuator:$springVersion")
        testImplementation("org.springframework.boot:spring-boot-starter-test:$springVersion")
    
    }
    
    tasks.getByName<Test>("test") {
        useJUnitPlatform()
    }

application.yml

#tomcat
server:
  port: 7999

#actuator
management:
  endpoints:
    web:
      exposure:
        include: health,info,env,beans

gradlew bootRun:

enter image description here

Actuator endpoint, e.g.:

http://localhost:7999/actuator/health
0

you need to check many things to be sure to endpoint URL like info, health, and beans...etc by Actuator

  • The First point you must check if the actuator exists on your project or not if doesn't exist, you need to add the following dependency.

         <!--to enable actuator help to trace project-->
     <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-actuator</artifactId>
     </dependency>
    
  • You need to add the following scripts to your application.yml to enable the actuator and Prometheus by actuator.

.

 management:
  security:
    enabled: false
  server:
    port: 9000
  endpoint:
    metrics:
      enabled: true
    prometheus:
      enabled: true
    health:
      show-details: always
      show-components: always
      probes:
        enabled: true
    shutdown:
      enabled: true
    info:
      env:
        enabled: true
      enabled: true
  endpoints:
    web:
      exposure:
        include: prometheus, metrics, info, health, shutdown, beans

using the above script the actuator will run on port 9000 and you can send a request to the following URL to access the actuator.

http://localhost:9000/actuator

and the following URL to access info path

http://localhost:9000/actuator/info

Note: you must check where you are writing your script because I was confused between endpoint and endpoints

  • The endpoint to set the actuator config.
  • The endpoints to set the actuator URLs endpoint

Note: you can delete the port from application.yml and the actuator will run by current application port

best luck

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.