Skip to content

Commit

Permalink
feat: 타임존 세팅, 헬스 체크 API 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
bflykky committed Jul 31, 2024
1 parent 88f4db1 commit b0a44c3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/umc/naoman/NaomanApplication.java
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());
}
}
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);
}
}
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;
}


0 comments on commit b0a44c3

Please sign in to comment.