Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Injection vs. Service Locator #5

Open
seohy02 opened this issue Mar 23, 2024 · 1 comment
Open

Dependency Injection vs. Service Locator #5

seohy02 opened this issue Mar 23, 2024 · 1 comment

Comments

@seohy02
Copy link

seohy02 commented Mar 23, 2024

책에서는 Service Locator 패턴과 IoC 패턴을 설명하며 비교하고 있는데, 두 패턴에 대한 설명이 간략하다보니 명확하게 이해가 되지 않는 부분이 있었어요.

일반적으로 Dependency Injection와 Service Locator가 비교선상에 놓이는 것으로 보이고, 이 두 가지를 더 알아보면 좋을 것 같습니다!

책만 읽고 느낀점

  • ServiceLocator와 IoC Container의 명확한 차이를 모르겠음
  • 의존성을 외부에서 주입하고(DI) ServiceLocator를 이용할 순 없는것인가?
@java-saeng
Copy link
Contributor

java-saeng commented Mar 26, 2024

제가 생각한 ServiceLocator와 IoC Container의 차이는 관리 주체 인 것 같습니다.
ServiceLocator는 스크립트 기반으로 개발자가 관리하고, IoC Container는 Container 즉, 개발자가 아닌 외부에서 관리하는 것으로 이해했습니다.

pg165에 IoC Container의 설정은 Service Locator와 마찬가지로 시작 스크립트 등을 이용한다고 한다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants