spring-boot - Spring Boot 中的 Dropwizard 任务相当于什么

标签 spring-boot dropwizard

是否有 Dropwizard Task 的等效概念在 Spring Boot 中?

A Task is a run-time action your application provides access to on the administrative port via HTTP. All Dropwizard applications start with the gc task, which explicitly triggers the JVM’s garbage collection. (This is useful, for example, for running full garbage collections during off-peak times or while the given application is out of rotation.) The execute method of a Task can be annotated with @Timed, @Metered, and @ExceptionMetered. Dropwizard will automatically record runtime information about your tasks. Running a task can be done by sending a POST request to /tasks/{task-name} on the admin port

我的用例是创建一个简单的“任务”来执行 an online backup of an embedded H2 databaseadmin interface在 Spring Boot 应用程序中。关键要求是我不想通过主 HTTP 端口和网络接口(interface)公开此端点。

最佳答案

Spring Boot 将其称为端点 ( http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#production-ready-endpoints )。您只需实现该接口(interface)(或使用基类)并创建一个 @Bean

关于spring-boot - Spring Boot 中的 Dropwizard 任务相当于什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26360409/

相关文章:

java - 如何捕获配置解析异常?

ssl - 如何使用中间证书配置 Dropwizard 应用程序?

java - Maven 的依赖收敛错误

java - Dropwizard 关闭 Hook

configuration - Dropwizard 集成测试 : config resource file not found

Spring Boot 和 Hibernate 延迟初始化的奇怪行为

spring-boot - 这个表达式在 thymeleaf 表单验证中意味着什么?

java - Spring Boot 应用程序启动 Jar 文件时未设置 ServletContext

java - Ajax 调用 Spring Boot Controller 来重定向 View

java - Docker 构建上不可解析的父 POM