【发布时间】:2022-08-03 13:30:42
【问题描述】:
Spring Boot 2.6.6 - Actuator API Reference
我检查了上面的链接,但找不到 /actuator/pause 端点。我不确定是不是我的应用程序导致了这个问题,所以我从 spring 初始化程序创建了一个新的 MVP,即使这样,暂停端点也不存在。
我记得曾经有一个 POST 端点/actuator/pause,但是如何在较新版本的 Spring Boot(2.6.6 以上)上启用它?
下面是我的 MVP\'s 代码。
构建.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()
}
应用程序.yml
management:
endpoints.web.exposure.include: \'*\'
endpoint:
pause.enabled: true
restart.enabled: true
resume.enabled: true
shutdown.enabled: true
一旦我启动应用程序并点击
curl --location --request POST \'localhost:8080/actuator/pause\',发送 404。
标签: java spring spring-boot spring-boot-actuator spring-actuator