验证服务是否启动成功可以调用****/ruok接口,端口是服务器实际运行端口
返回imok是启动成功,返回no是启动失败
@Order(Ordered.LOWEST_PRECEDENCE)
@RestController
public class HealthCheckController implements ApplicationListener<ApplicationStartedEvent> {
private static boolean IM_OK = false;
private static final String SUCCESS_STRING = "imok";
private static final String FAILURE_STRING = "no";
@GetMapping("/ruok")
public String ruok() {
if (IM_OK) {
return SUCCESS_STRING;
}
return FAILURE_STRING;
}
@Override
public void onApplicationEvent(ApplicationStartedEvent event) {
IM_OK = true;
}
public static boolean imok() {
return IM_OK;
}
}
Oinone社区 作者:yexiu原创文章,如若转载,请注明出处:https://doc.oinone.top/oinone-faq/17905.html
访问Oinone官网:https://www.oinone.top获取数式Oinone低代码应用平台体验