Which pattern should you apply to eliminate this problem?

Your web application requires access to several different services, so you created a Service
Locator class to be used by the UI developers on the team. New services with different interfaces
are occasionally added. Unfortunately, the caching benefits of the Service Locator class are NOT
being realized because a new instance of this class is being created in every backing bean
method that requires a service. Which pattern should you apply to eliminate this problem?

Your web application requires access to several different services, so you created a Service
Locator class to be used by the UI developers on the team. New services with different interfaces
are occasionally added. Unfortunately, the caching benefits of the Service Locator class are NOT
being realized because a new instance of this class is being created in every backing bean
method that requires a service. Which pattern should you apply to eliminate this problem?

A.
Bridge

B.
Singleton

C.
Prototype

D.
Factory Method

E.
Business Delegate



Leave a Reply 0

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