Spring Boot 2.4.3 - 未找到执行器/启动端点

Spring Boot 2.4.3 - Actuator /startup endpoint not found

我有一个 spring 启动应用程序,我从 v2.2.x 升级到现在的 v2.4.3.

我在他们的文档中看到有一个新的执行器端点 /startup,但是当我启动我的应用程序时它并不存在。

根据他们的文档没有特殊要求here

我正在使用 spring-boot-admin-starter-client v2.4.3,它提供 spring-boot-actuator v2.4.3,我什至在我的 application.properties 文件中有 management.endpoint.startup.enabled=true

有没有其他人使用过这个版本的 spring 启动并让这个执行器 enpoint 工作?

您需要调整启动配置:

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(DemoApplication.class);
        app.setApplicationStartup(new BufferingApplicationStartup(1000));
        app.run(args);
    }
}

在application.properties中:

management.endpoints.web.exposure.include=startup

如果您想可视化启动事件,请查看我几个月前制作的这个工具https://spring-boot-startup-analyzer.netlify.app/(查看配置说明,因为您需要在此端点上启用 CORS)

可能是您正在使用 BootstrapApplicationListener 再次构建应用程序上下文但忽略了之前的 applicationStartup,因此它设置了默认值,这是 spring-cloud-context:3.0.0[=10 中的错误=]