From 7ca5a91ff728c776f5c75db21f7ddde5100ef37c Mon Sep 17 00:00:00 2001 From: HzjNeverStop <441627022@qq.com> Date: Mon, 11 Apr 2022 17:28:14 +0800 Subject: [PATCH] fix startup endpoint (#945) --- .../startup/StartupEndPointAutoConfiguration.java | 9 --------- .../boot/actuator/startup/SofaBootStartupEndPoint.java | 7 +++++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/startup/StartupEndPointAutoConfiguration.java b/sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/startup/StartupEndPointAutoConfiguration.java index 6945328ed..55979ed0c 100644 --- a/sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/startup/StartupEndPointAutoConfiguration.java +++ b/sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/startup/StartupEndPointAutoConfiguration.java @@ -21,11 +21,9 @@ import com.alipay.sofa.startup.StartupReporter; import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint; import org.springframework.boot.actuate.autoconfigure.startup.StartupEndpointAutoConfiguration; -import org.springframework.boot.actuate.startup.StartupEndpoint; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -45,11 +43,4 @@ public class StartupEndPointAutoConfiguration { public SofaBootStartupEndPoint sofaBootStartupEndPoint(StartupReporter startupReporter) { return new SofaBootStartupEndPoint(startupReporter); } - - @Bean - @ConditionalOnMissingBean - @ConditionalOnAvailableEndpoint(endpoint = SofaBootStartupEndPoint.class) - public StartupEndpoint startupEndpoint() { - return new StartupEndpoint(new BufferingApplicationStartup(0)); - } } diff --git a/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/startup/SofaBootStartupEndPoint.java b/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/startup/SofaBootStartupEndPoint.java index 7c0a24fbc..8aebae1a9 100644 --- a/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/startup/SofaBootStartupEndPoint.java +++ b/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/startup/SofaBootStartupEndPoint.java @@ -19,6 +19,8 @@ import com.alipay.sofa.startup.StartupReporter; 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.actuate.startup.StartupEndpoint; /** * Display the time cost details used in startup @@ -39,4 +41,9 @@ public SofaBootStartupEndPoint(StartupReporter startupReporter) { public StartupReporter.StartupStaticsModel startup() { return startupReporter.report(); } + + @WriteOperation + public StartupEndpoint.StartupResponse startupForSpringBoot() { + throw new UnsupportedOperationException("Please use GET method instead"); + } }