Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/ssu/eatssu/global/handler/HealthCheckController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package ssu.eatssu.global.handler;

import java.util.Map;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
Comment thread
pooreumjung marked this conversation as resolved.
public class HealthCheckController {

@GetMapping("/actuator/health")
public Map<String, String> health() {
return Map.of("status", "UP");
}
Comment on lines +8 to +13

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

매번 새로운 Map 인스턴스를 생성하는 대신 private static final 상수로 선언하여 재사용하면 메모리 효율성을 높이고 GC 부하를 줄일 수 있습니다.

public class HealthCheckController {

    private static final Map<String, String> HEALTH_STATUS = Map.of("status", "UP");

    @GetMapping("/actuator/health")
    public Map<String, String> health() {
        return HEALTH_STATUS;
    }

}
Loading