-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
115 lines (94 loc) · 5.4 KB
/
Copy pathbuild.gradle
File metadata and controls
115 lines (94 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
plugins {
id 'java'
id 'org.springframework.boot' version '4.1.0'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'com.shinhan'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
// @Valid / @NotBlank 등 Bean Validation. GeneralExceptionAdvice가 이미 BindException을
// 처리하고 있어 동작은 했지만, hibernate-validator가 springdoc을 통해 전이로만 들어와 있었다.
// springdoc을 빼거나 올리면 @Valid가 조용히 검증을 멈추므로 명시적으로 선언한다.
implementation 'org.springframework.boot:spring-boot-starter-validation'
// 카카오 Authorization Code 로그인
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
// KLLJS JWT Access Token 검증
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
// Lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// 2.5.0은 Spring Framework 6(Boot 3) 시절 ControllerAdviceBean 생성자를 보고 컴파일된 버전이라
// Spring Framework 7(Boot 4)에서 NoSuchMethodError가 난다 — Boot 4를 지원하는 3.x로 올린다
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:3.0.3'
// 모니터링 및 헬스체크 스타터
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// AWS SDK v2. Spring Boot 4가 아직 Spring Cloud AWS 지원 대상이 아니라서
// (Spring Cloud AWS의 @SqsListener 같은 편의 기능 대신) SDK를 직접 쓴다.
// 자격증명은 기본 체인을 그대로 쓴다 - 로컬은 aws configure로 설정된 자격증명,
// 운영(EC2)은 인스턴스 프로파일을 자동으로 사용한다.
//
// BOM으로 버전을 한곳에서 맞춘다. 모듈별로 버전을 따로 적으면 공통 의존성(core, http-client)이
// 버전이 어긋나 런타임에 NoSuchMethodError가 나기 쉬워서다.
implementation platform('software.amazon.awssdk:bom:2.42.19')
implementation 'software.amazon.awssdk:sqs' // Vision Summary 수신 (@Scheduled 폴링)
implementation 'software.amazon.awssdk:s3' // 캠페인 소재 presigned PUT, 사업자등록증 원본 저장
implementation 'software.amazon.awssdk:lambda' // OCR Lambda 직접 invoke (API Gateway 미경유)
// 업로드된 사업자등록증 PDF를 실제로 열어본다 (team-creation-api-spec.md 4절).
// 매직바이트("%PDF-")만 보면 헤더만 흉내 낸 파일이 통과해 S3에 저장되고 OCR Lambda까지 호출된다
// (= 비용). 암호가 걸렸거나 손상된 PDF도 OCR이 못 읽으므로 업로드 시점에 걸러낸다.
// 이미지(JPG/PNG)는 JDK의 ImageIO로 디코딩해보면 되어 별도 의존성이 필요 없다.
implementation 'org.apache.pdfbox:pdfbox:3.0.8'
// 매체 위경도(WGS84) -> 서울시 250m 격자좌표계(EPSG:5179, UTM-K) 변환.
// 전체 유동인구 연동(깔대기 그래프 6절)에서 매체 위치가 속한 격자코드를 계산하는 데 쓴다.
implementation 'org.locationtech.proj4j:proj4j:1.4.1'
// prod: RDS MySQL
runtimeOnly 'com.mysql:mysql-connector-j'
// local: 인메모리 H2 (Docker/DB 서버 없이 테스트)
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.springframework.boot:spring-boot-h2console'
// prod 전용 스키마 마이그레이션 (local은 Hibernate ddl-auto=create-drop 그대로 사용)
// Flyway API를 직접 호출하지 않고 Spring Boot 자동설정으로만 동작하므로 runtimeOnly로 충분
// Spring Boot 4.x는 자동설정이 기능별 모듈로 분리되어 flyway-core/mysql만으로는 부족하고
// spring-boot-flyway(자동설정 연결 모듈)가 별도로 있어야 FlywayAutoConfiguration이 동작한다
runtimeOnly 'org.springframework.boot:spring-boot-flyway'
runtimeOnly 'org.flywaydb:flyway-core'
runtimeOnly 'org.flywaydb:flyway-mysql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
// spring-boot-starter-test만으로는 MockMvc 자동설정이 빠져있어 별도로 추가해야 한다
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') {
useJUnitPlatform {
// 실제 MySQL 컨테이너가 필요한 동시성 테스트는 기본 test 실행에서 제외한다
excludeTags 'mysql-concurrency'
}
}
// 잠금 동작을 검증하는 테스트들. 반드시 실제 MySQL로 돌려야 한다 —
// H2는 READ COMMITTED, MySQL InnoDB는 REPEATABLE READ가 기본이라 우리가 잡으려는 버그가
// H2에서는 재현되지 않는다 (잠금을 지워도 통과해버린다).
//
// docker compose -f docker-compose.test.yml up -d --wait
// ./gradlew mysqlConcurrencyTest
// docker compose -f docker-compose.test.yml down
tasks.register('mysqlConcurrencyTest', Test) {
useJUnitPlatform {
includeTags 'mysql-concurrency'
}
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
}