Spring Boot 2.6.6 - Actuator API Reference
I checked the above link and unable to find the /actuator/pause
endpoint. I was not sure if it was my app that was causing the issue, so I created a new MVP from spring initializer and even then pause endpoint is not there.
I remember that there used to be a POST endpoint /actuator/pause
, but how do I enable this on newer versions of Spring Boot(2.6.6 above)?
The below is my MVP's code.
build.gradle
plugins {
id 'org.springframework.boot' version '2.6.6'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
application.yml
management:
endpoints.web.exposure.include: '*'
endpoint:
pause.enabled: true
restart.enabled: true
resume.enabled: true
shutdown.enabled: true
And once I start the app and hit
curl --location --request POST 'localhost:8080/actuator/pause'
, its sending 404.
It looks like you should add the following dependency to your
build.gradle
fileYou can see that
RestartEndpoint
andRestartEndpoint.PauseEndpoint
classes actually are defined in this package.Obviously you should change the
application.yml
like this: