mirror of
https://github.com/suyiiyii/SIMS.git
synced 2025-06-05 13:36:12 +08:00
实现新的健康检查端点和Hello控制器以响应GET和POST请求。健康检查返回"ok"或自定义响应,而Hello控制器返回带参数的问候信息。另外,引入了springdoc-openapi以增强API文档生成能力。
28 lines
652 B
Java
28 lines
652 B
Java
package top.suyiiyii.sims.controller;
|
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.Data;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
public class HealthzController {
|
|
@GetMapping("/healthz")
|
|
public String healthz() {
|
|
return "ok";
|
|
}
|
|
|
|
@PostMapping("/healthz")
|
|
public HealthzResponse healthzPost() {
|
|
return new HealthzResponse("health");
|
|
}
|
|
|
|
@AllArgsConstructor
|
|
@Data
|
|
public static class HealthzResponse {
|
|
private String status;
|
|
}
|
|
|
|
}
|