Skip to content

Commit a37d849

Browse files
committed
feat: Spring Boot Actuator 설정 추가 및 엔드포인트 구성
1 parent 65fb40e commit a37d849

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

build.gradle

+24
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
id 'application' // application 플러그인 추가
44
id 'org.springframework.boot' version '3.3.6'
55
id 'io.spring.dependency-management' version '1.1.7'
6+
id 'com.gorylenko.gradle-git-properties' version '2.4.1' // git 정보 읽기
67
}
78

89
group = 'com.sprint.mission'
@@ -39,6 +40,12 @@ dependencies {
3940
// Spring Boot Web 의존성 (Spring MVC, REST 등)
4041
implementation 'org.springframework.boot:spring-boot-starter-web'
4142

43+
// Spring Validation 의존성
44+
implementation 'org.springframework.boot:spring-boot-starter-validation'
45+
46+
// Spring Actuator 의존성
47+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
48+
4249
// Lombok 의존성 (간결한 코드 작성)
4350
compileOnly 'org.projectlombok:lombok' // 컴파일 타임에만 Lombok을 사용
4451
annotationProcessor 'org.projectlombok:lombok' // Lombok 애노테이션 프로세서
@@ -63,6 +70,23 @@ dependencies {
6370
}
6471

6572

73+
gitProperties {
74+
dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
75+
dateFormatTimeZone = "UTC"
76+
}
77+
78+
tasks.register('writeBuildProperties') {
79+
doLast {
80+
def props = new Properties()
81+
props.setProperty('version', project.version.toString())
82+
props.setProperty('time', new Date().format("yyyy-MM-dd'T' HH:mm:ss'Z'", Timezone.getTimeZone("UTC")))
83+
84+
def file = file("$buildDir/resources/main/build.properties")
85+
file.parentFile.mkdir()
86+
props.store(file.newWriter(), null)
87+
}
88+
}
89+
6690
tasks.named('test') {
6791
useJUnitPlatform()
6892
}

src/main/resources/application.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,46 @@ logging:
2323
level:
2424
root: INFO
2525

26+
27+
management:
28+
endpoints:
29+
web:
30+
exposure:
31+
include:
32+
- "health"
33+
- "info"
34+
- "metrics"
35+
- "loggers"
36+
endpoint:
37+
health:
38+
show-details: "ALWAYS"
39+
info:
40+
git:
41+
mode: full # Git 정보를 가져올 수 있도록 설정
42+
43+
info:
44+
app:
45+
name: Discodeit
46+
version: 1.7.0
47+
java-version: 17
48+
spring-boot-version: 3.4.0
49+
50+
datasource:
51+
url: jdbc:postgresql://localhost:5432/discodeit
52+
driver-class-name: org.postgresql.Driver
53+
54+
jpa:
55+
ddl-auto: validate
56+
57+
storage:
58+
type: local
59+
path: /storage
60+
61+
multipart:
62+
max-file-size: 10MB
63+
max-request-size: 20MB
64+
65+
2666
springdoc:
2767
packages-to-scan: com.sprint.mission.discodeit.controller
2868
default-consumes-media-type: application/json;charset=UTF-8

0 commit comments

Comments
 (0)