Skip to content

리팩토링: @Value → @ConfigurationProperties 전환 - #19

Merged
config25 merged 1 commit into
mainfrom
refactor/configuration-properties
Apr 7, 2026
Merged

리팩토링: @Value → @ConfigurationProperties 전환#19
config25 merged 1 commit into
mainfrom
refactor/configuration-properties

Conversation

@config25

@config25 config25 commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

산재되어 있던 @value 필드 주입을 타입 안전한 record properties로 통합. 테스트 시 reflection 없이 생성자로 직접 주입할 수 있어 단위 테스트 도입의 사전 작업 역할.

신규 properties (4개, demo-external/.../config/properties):

전환 대상:

  • GptVisionClient, YoloDetectionClient, LamaInpaintClient, S3ImageStore (demo-external)
  • ExternalFileClientImpl (demo-external) — bucket 일관성 확보
  • OpenAiConfig (demo-api) — RestTemplate interceptor의 apiKey
  • RoomGenieApplication에 @ConfigurationPropertiesScan 추가

application.properties 정리:

  • 키 마이그레이션:
    openai.api.key → openai.api-key
    openai.api.url2 → openai.chat-endpoint
    openai.model1 → openai.model
  • 죽은 키 3개 제거: openai.api.url, openai.model2, openai.api.url.image
  • main + test 양쪽 모두 동일하게 적용

검증:

  • ./gradlew compileJava 통과
  • ./gradlew test 통과 (Spring context 정상 로드)

비고:

  • cloud.aws.s3.base-url은 demo-domain의 FileGenerator에서 사용 중이며, 의존 방향(demo-domain ↛ demo-external) 때문에 본 PR 스코프 밖. AwsS3Properties는 우선 bucket만 포함하고 base-url 정리는 후속 PR로 분리.

산재되어 있던 @value 필드 주입을 타입 안전한 record properties로 통합.
테스트 시 reflection 없이 생성자로 직접 주입할 수 있어 단위 테스트 도입의 사전 작업 역할.

신규 properties (4개, demo-external/.../config/properties):
- OpenAiProperties (apiKey, chatEndpoint, model)
- YoloProperties (url, 기본값 http://localhost:5000)
- LamaProperties (url, 기본값 http://localhost:7870)
- AwsS3Properties (bucket)

전환 대상:
- GptVisionClient, YoloDetectionClient, LamaInpaintClient, S3ImageStore (demo-external)
- ExternalFileClientImpl (demo-external) — bucket 일관성 확보
- OpenAiConfig (demo-api) — RestTemplate interceptor의 apiKey
- RoomGenieApplication에 @ConfigurationPropertiesScan 추가

application.properties 정리:
- 키 마이그레이션:
  openai.api.key   → openai.api-key
  openai.api.url2  → openai.chat-endpoint
  openai.model1    → openai.model
- 죽은 키 3개 제거: openai.api.url, openai.model2, openai.api.url.image
- main + test 양쪽 모두 동일하게 적용

검증:
- ./gradlew compileJava 통과
- ./gradlew test 통과 (Spring context 정상 로드)

비고:
- cloud.aws.s3.base-url은 demo-domain의 FileGenerator에서 사용 중이며,
  의존 방향(demo-domain ↛ demo-external) 때문에 본 PR 스코프 밖.
  AwsS3Properties는 우선 bucket만 포함하고 base-url 정리는 후속 PR로 분리.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@config25 config25 self-assigned this Apr 7, 2026
@config25
config25 merged commit 4bec41a into main Apr 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant