From fe4546e2b548c0dd3033cb8e73c74ee3177a292e Mon Sep 17 00:00:00 2001 From: BenjaminNH <1249376374@qq.com> Date: Tue, 5 Aug 2025 13:02:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=81=A5=E5=BA=B7=E7=9A=84HealthController?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipreservebackend/config/SecurityConfig.java | 1 + .../controller/HealthController.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/main/java/github/benjamin/equipreservebackend/controller/HealthController.java diff --git a/src/main/java/github/benjamin/equipreservebackend/config/SecurityConfig.java b/src/main/java/github/benjamin/equipreservebackend/config/SecurityConfig.java index 26b50ab..fb1ecda 100644 --- a/src/main/java/github/benjamin/equipreservebackend/config/SecurityConfig.java +++ b/src/main/java/github/benjamin/equipreservebackend/config/SecurityConfig.java @@ -32,6 +32,7 @@ public class SecurityConfig { .authorizeHttpRequests(auth -> auth .requestMatchers("/login").permitAll() .requestMatchers("/device_image/**").permitAll() + .requestMatchers("/health").permitAll() .anyRequest().authenticated()) .addFilterBefore(jwtAuthFilter(), UsernamePasswordAuthenticationFilter.class) .build(); diff --git a/src/main/java/github/benjamin/equipreservebackend/controller/HealthController.java b/src/main/java/github/benjamin/equipreservebackend/controller/HealthController.java new file mode 100644 index 0000000..7e345bc --- /dev/null +++ b/src/main/java/github/benjamin/equipreservebackend/controller/HealthController.java @@ -0,0 +1,14 @@ +package github.benjamin.equipreservebackend.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HealthController { + + @GetMapping("/health") + public String health() { + return "ok"; + } + +}