Does the ServiceLocator pattern have life after EJB3.0?

Brandon Werner has an interesting article on looking at how typically the ServiceLocator pattern has been implemented prior to EJB3.0, and whether or not it will be needed with EJB3.0.

The ServiceLocator has been called a ‘compensating pattern’, one of a collection of patterns from the J2EE Core Patterns book by Sun that are viewed by many as patterns that attempt to negate some of the disadvantages and complexities of dealing with J2EE. They are know as ‘compensating’, because the general opinion has been if EJBs were designed right in the first place, we wouldn’t need the majority of these patterns in the first place.

Werner shows in his article how the ServiceLocator pattern is used to hide the complexities of looking up JNDI resources, and compares to how this is implemented in EJB3.0 using annotations and Dependency Injection. The EJB3.0 approach is much simpler and cleaner, and yes, in this case, we would no longer to use an approach like the ServiceLocator.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.