On 12/04/2010 11:00, Manuel Chinea wrote:
I guess a simple way to do this is doing the ctx.lookup of the SLSB.
Could/should it be done in a custom ConfigService or a TypeConverter
class in click? or better in a Superclass?
ctx.lookup has been the approach used in EJB containers this far.
I wouldn't use a superclass for this though. While its simple, the Page is not really the place to
manage service lookup logic.
I'd recommend a ServiceFactory or ServiceLocator pattern, unless J2EE 6 provides a way to inject
services into POJOs directly.
Another approach is to subclass ClickServlet, override newPageInstance which passes in the pageClass
to create, scan for @EJB annotated services and inject them manually. The SpringClickServlet does
something similar, so have a look for some inspiration.
kind regards
bob