• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

compare Spring and ServiceLocator

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How do you compare Spring and ServiceLocator Pattern? Which is better and Why?


 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you like Blondes, Brunettes, or RedHeads, and why? ;)

Well the question is very open ended and I doubt you will get a full answer. But ServiceLocator is a pattern, Spring is a framework. You can do a Google search to find out the difference between that. Also Spring framework uses lots of design patterns, not just one.

Mark
 
Chandra Mohan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, This is one of the question has been asked in recent interview. I have very clear idea about the frame work and design patterns. It is open screat that spring has collection design patterns and service locator is one of the design pattern which has been included in spring. As per my understand (differences), Spring services are injected into your business classes rather than the business classes looking up a service.

I don't want full answer, Just to get the knowledge. I will not post this message if I get the answer in google, If you find anything in google search, give me link.

Any other differences ??
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose that you mean Spring IoC and Service Locator.

Spring IoC is better in terms of dependency management, the dependent doesn't look up or create dependencies, the control is inverted, the dependent just defines interfaces and the container injects dependencies to the dependent (dependency injection that is).
 
Mark Spritzler
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I guess a good simple explanation on the difference is that Inversion Of Control is pretty much the opposite of ServiceLocator. Instead of looking up its dependencies. the dependencies are injected into the class instead. But there is so much more with Proxies and AOP to add services like Transactions and stuff. That is why it becomes a comparison of Apples to Oranges and would require a very lengthy post to list all the differences.

Mark
 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic