-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
package com.umc.naoman; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.TimeZone; | ||
|
||
@EnableJpaAuditing | ||
@SpringBootApplication | ||
@Slf4j | ||
public class NaomanApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(NaomanApplication.class, args); | ||
} | ||
|
||
@PostConstruct | ||
public void setTimeZone() { | ||
log.debug("타임존 설정 전 현재 시각: {}", ZonedDateTime.now()); | ||
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul")); | ||
log.debug("타임존 설정 후 현재 시각: {}", ZonedDateTime.now()); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/umc/naoman/domain/member/controller/HealthCheckController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.umc.naoman.domain.member.controller; | ||
|
||
import com.umc.naoman.global.result.ResultResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import static com.umc.naoman.global.result.code.GlobalResultCode.HEALTH_CHECK; | ||
|
||
@RestController | ||
@Tag(name = "헬스 체크 API", description = "서버의 상태 검사 API입니다.") | ||
public class HealthCheckController { | ||
@GetMapping("/") | ||
@Operation(summary = "헬스 체크 API", description = "서버가 정상적으로 동작하는지 검사하는 API입니다.") | ||
public ResultResponse<Object> healthCheck() { | ||
return ResultResponse.of(HEALTH_CHECK); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/umc/naoman/global/result/code/GlobalResultCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.umc.naoman.global.result.code; | ||
|
||
import com.umc.naoman.global.result.ResultCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum GlobalResultCode implements ResultCode { | ||
HEALTH_CHECK(200, "HEALTH_CHECK", "서버가 정상적으로 동작합니다.") | ||
|
||
; | ||
|
||
private final int status; | ||
private final String code; | ||
private final String message; | ||
} | ||
|
||
|