Skip to content

Commit e4f3232

Browse files
committed
chore: 학습용 코드 외부에 노출되지 않도록 수정
1 parent f87bc9e commit e4f3232

6 files changed

Lines changed: 21 additions & 7 deletions

File tree

.claude/skills/graphql-schema/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,4 @@ type Task {
125125

126126
## 제외 대상
127127

128-
`src/main/resources/schema/learning.graphqls`는 학습용 스키마이므로 이 규칙을 적용하지 않습니다 (수정 금지 코드).
128+
`src/test/resources/schema/learning.graphqls`는 학습용 스키마이므로 이 규칙을 적용하지 않습니다 (수정 금지 코드, 테스트 전용 classpath).

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727

2828
다음 경로의 코드는 학습/참고용이므로 **절대 수정하지 않습니다**:
2929

30-
- `src/main/kotlin/kr/io/team/loop/learning/` — DGS GraphQL 학습 예제 코드
30+
- `src/main/kotlin/kr/io/team/loop/learning/` — DGS GraphQL 학습 예제 코드 (ComponentScan에서 제외되어 엔드포인트 비활성화)
3131
- `src/test/kotlin/kr/io/team/loop/learning/` — DGS GraphQL 학습 테스트 코드
32-
- `src/main/resources/schema/learning.graphqls` — 학습용 GraphQL 스키마
32+
- `src/test/resources/schema/learning.graphqls` — 학습용 GraphQL 스키마 (테스트 전용 classpath, 프로덕션 미포함)
3333
- `docs/learning/` — 학습 가이드 문서
3434
- `docs/dgs-graphql-execution.md` — GraphQL 실행 파이프라인 문서
3535

docs/graphql-api-documentation-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ project-root/
5252

5353
### SpectaQL 설정 (`spectaql/config.yml`)
5454

55-
BC별 스키마가 추가되면 `schemaFile` 목록에 경로를 추가합니다. `learning.graphqls`는 학습용이므로 제외합니다.
55+
BC별 스키마가 추가되면 `schemaFile` 목록에 경로를 추가합니다. `learning.graphqls`는 학습용이므로 제외합니다 (위치: `src/test/resources/schema/learning.graphqls`).
5656

5757
### 로컬 실행
5858

docs/learning/dgs-graphql-guide.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ HTTP 응답
589589

590590
| 파일 | 설명 |
591591
|---|---|
592-
| `src/main/resources/schema/learning.graphqls` | GraphQL 스키마 정의 (주석 포함) |
592+
| `src/test/resources/schema/learning.graphqls` | GraphQL 스키마 정의 (주석 포함, 테스트 전용 classpath) |
593593
| `src/main/kotlin/.../learning/LearningModels.kt` | 도메인 모델 (data class) |
594594
| `src/main/kotlin/.../learning/ShowDataFetcher.kt` | DataFetcher 구현 (Query, Mutation, 자식 필드) |
595595
| `src/main/kotlin/.../learning/ShowDataLoader.kt` | DataLoader 구현 (BatchLoader, MappedBatchLoader) |
@@ -600,8 +600,12 @@ HTTP 응답
600600
### 실행 방법
601601

602602
1. **테스트 실행**: `./gradlew test --tests "kr.io.team.loop.learning.*"`
603-
2. **서버 시작 후 GraphiQL**: `./gradlew bootRun`http://localhost:8080/graphiql
604-
3. **Codegen 실행**: `./gradlew generateJava`
603+
2. **Codegen 실행**: `./gradlew generateJava`
604+
605+
> **참고**: 학습용 코드는 프로덕션 엔드포인트에 노출되지 않도록 비활성화되어 있습니다.
606+
> - `learning.graphqls`는 DGS 스캔 경로(`src/main/resources/schema/`) 밖인 `docs/learning/`에 위치
607+
> - `learning` 패키지는 `ServerApplication.kt``@ComponentScan` excludeFilter로 빈 등록에서 제외
608+
> - 테스트는 `@SpringBootTest`로 별도 컨텍스트를 로드하므로 정상 동작
605609
606610
### 다음 단계
607611

src/main/kotlin/kr/io/team/loop/ServerApplication.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@ package kr.io.team.loop
22

33
import org.springframework.boot.autoconfigure.SpringBootApplication
44
import org.springframework.boot.runApplication
5+
import org.springframework.context.annotation.ComponentScan
6+
import org.springframework.context.annotation.FilterType
57

68
@SpringBootApplication
9+
@ComponentScan(
10+
excludeFilters = [
11+
ComponentScan.Filter(
12+
type = FilterType.REGEX,
13+
pattern = ["kr\\.io\\.team\\.loop\\.learning\\..*"],
14+
),
15+
],
16+
)
717
class ServerApplication
818

919
fun main(args: Array<String>) {
File renamed without changes.

0 commit comments

Comments
 (0)