Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Service Locators vs. Spring's Dependency Injection

 
James Dekker
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the benefits of service locators? I know that they encapsulate JNDI lookups in J2EE based architectures.

Also, a service locator hides the implementation details of the lookup mechanism and encapsulates related dependencies.

Is it true that they clash with Spring's dependency injection by creating somewhat of a "disjunct architecture" when included in the same system?

Thank you for taking the time to read this.
 
Ramon Anger
Ranch Hand
Posts: 56
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,

there is an old article from Martin Fowler covering dependency injection (pattern) and service locators at http://martinfowler.com/articles/injection.html. Maybe it helps for a first answer, although it's not Spring specific.

Best regards,
Ramon
 
Yash Don
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is an old article from Martin Fowler covering dependency injection (pattern) and service locators at http://martinfowler.com/articles/injection.html. Maybe it helps for a first answer, although it's not Spring specific.



Very useful link.

Thanks,
Yash
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic