From 8dcb3312f28082d5f1184d5fb02c8591f91c8c0f Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 7 Sep 2020 20:32:26 +0200 Subject: [PATCH] Switch startup actuator endpoint to using HTTP POST Closes gh-23213 --- .../web/documentation/StartupEndpointDocumentationTests.java | 4 ++-- .../springframework/boot/actuate/startup/StartupEndpoint.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/StartupEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/StartupEndpointDocumentationTests.java index 270088d6aa..5fe538a4d4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/StartupEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/StartupEndpointDocumentationTests.java @@ -32,7 +32,7 @@ import org.springframework.restdocs.payload.ResponseFieldsSnippet; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; /** @@ -75,7 +75,7 @@ class StartupEndpointDocumentationTests extends MockMvcEndpointDocumentationTest fieldWithPath("timeline.events.[].startupStep.tags[].value") .description("The value of the StartupStep Tag.")); - this.mockMvc.perform(get("/actuator/startup")).andExpect(status().isOk()) + this.mockMvc.perform(post("/actuator/startup")).andExpect(status().isOk()) .andDo(document("startup", responseFields)); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/startup/StartupEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/startup/StartupEndpoint.java index e04fe0b1f7..145d1d7317 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/startup/StartupEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/startup/StartupEndpoint.java @@ -18,7 +18,7 @@ package org.springframework.boot.actuate.startup; import org.springframework.boot.SpringBootVersion; import org.springframework.boot.actuate.endpoint.annotation.Endpoint; -import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; +import org.springframework.boot.actuate.endpoint.annotation.WriteOperation; import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup; import org.springframework.boot.context.metrics.buffering.StartupTimeline; @@ -44,7 +44,7 @@ public class StartupEndpoint { this.applicationStartup = applicationStartup; } - @ReadOperation + @WriteOperation public StartupResponse startup() { StartupTimeline startupTimeline = this.applicationStartup.drainBufferedTimeline(); return new StartupResponse(startupTimeline);