fix: RestClient Builder Bean 등록#101
Conversation
📝 WalkthroughWalkthrough
ChangesAuth RestClient 구성
Sequence Diagram(s)Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/com/zimdugo/auth/config/AuthRestClientConfig.java (1)
10-12: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
RestClient.Builder를 singleton으로 노출하면 상태가 공유됩니다.지금 빈은 기본 scope가 singleton이라서, 다른 주입 지점들이
baseUrl(...)같은 설정을 누적해서 바꾼 상태를 서로 공유하게 됩니다. 실제로GoogleSocialAccountUnlinkClient와KakaoSocialAccountUnlinkClient가 둘 다 주입받은 builder를 바로 변경하고 있으니, prototype scope로 바꾸거나 Spring Boot가 제공하는 구성 경로를 타는 편이 안전합니다.제안 예시
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.web.client.RestClient; `@Configuration` public class AuthRestClientConfig { `@Bean` + `@Scope`(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public RestClient.Builder restClientBuilder() { return RestClient.builder(); } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/zimdugo/auth/config/AuthRestClientConfig.java` around lines 10 - 12, `restClientBuilder()` currently exposes a shared singleton `RestClient.Builder`, so mutations like `baseUrl(...)` from clients such as `GoogleSocialAccountUnlinkClient` and `KakaoSocialAccountUnlinkClient` can leak between consumers. Change this bean to avoid shared mutable state by switching the builder to prototype scope or by using Spring Boot’s recommended configuration path, and keep the fix localized to `AuthRestClientConfig.restClientBuilder()`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/main/java/com/zimdugo/auth/config/AuthRestClientConfig.java`:
- Around line 10-12: `restClientBuilder()` currently exposes a shared singleton
`RestClient.Builder`, so mutations like `baseUrl(...)` from clients such as
`GoogleSocialAccountUnlinkClient` and `KakaoSocialAccountUnlinkClient` can leak
between consumers. Change this bean to avoid shared mutable state by switching
the builder to prototype scope or by using Spring Boot’s recommended
configuration path, and keep the fix localized to
`AuthRestClientConfig.restClientBuilder()`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 143bb93d-1650-4d6d-a121-3ad9faab34db
📒 Files selected for processing (1)
src/main/java/com/zimdugo/auth/config/AuthRestClientConfig.java
✨ 작업 내용 한 줄 요약
🛠️ 작업 내용
🧠 기술적 의사결정
📚 참고 자료 (선택)
📷 스크린샷 (선택)
Summary by CodeRabbit