A circular ServiceLocator 2004-04-15 - By Stefan Frank
Back Hi,
I'm sure this has been asked before, but I'm currently struggling with that Problem:
I have a ServiceLocator, that I use for looking up EJB's - this service-locator is used in the web-tier to encapsulate lookup&creation, as intended - I hand out instantiated and typed EJB's to the Client. If I want to use Bean A from Bean B, I also want to use the ServiceLocator, with the same benefits. But if A uses the ServiceLocator and the ServiceLocator can hand out instances of A, I get a circular reference - now I have to possibilities:
- do not hand out typed Instances and let the client do the casting, which removes explicit references from the ServiceLocator to EJB's, but also removes much of the use of the Pattern. - use another mechanism in the webtier than in the ejb-tier (e.g. do a manual lookup from Bean A to Bean B, thereby not using the ServiceLocator at all.
Maybe I have a coders-block here, but can somebody come up with a better solution?!
cheers stf
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|