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.
The correct property for exposing actuator urls over http is management.endpoints.web.exposure.exclude
(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, so now you need to expose it manually.
Add this to application properties to expose the /info endpoint.
management.info.env.enabled = true
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
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:
Actuator endpoint, e.g.:
http://localhost:7999/actuator/health
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With