feat: 增加检测服务健康的HealthController

This commit is contained in:
BenjaminNH 2025-08-05 13:02:21 +08:00
parent 99281f8166
commit fe4546e2b5
2 changed files with 15 additions and 0 deletions

View File

@ -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();

View File

@ -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";
}
}