Skip to content

Commit

Permalink
fix startup endpoint (#945)
Browse files Browse the repository at this point in the history
  • Loading branch information
HzjNeverStop authored Apr 11, 2022
1 parent 96b0a06 commit 7ca5a91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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");
}
}

0 comments on commit 7ca5a91

Please sign in to comment.