Thanks for response, guys. The only problem is that your solutions are
pre-injector construction, but in my case I have to provide Injector
first and then be prepared for handling dependencies which were not
mentioned in modules.
The use-case is: the application starts in OSGi container which starts
my activator. My activator builds an Injector and stores it somewhere.
Application waits for request. Request comes and JSP is invoked. JSP
uses _model_ tag, which asks for some model object. The tag takes the
injector created by activator and asks it for the model asked by JSP
page. So far so good, all the "infrastructure" dependencies are
provided by Injector. But there is problem with DTO objects. I would
like to avoid iterating over all the possible DTO objects in my
modules. All of them are to be provided by DtoFactory so right now I
have a DtoModule which iterates over all the DTO's and binds them to
provider which asks for them the DtoFactory.

When I miss one DTO in my DtoModule, the application will crash on a
page which requires some model which depends on that DTO. I was
thinking, maybe I could weave the general Injector's process of
providing dependencies, checks in runtime if someone asks for any kind
of DTO object and provide that object from DtoFactory.

That would let me get rid of DtoModule which manually binds each DTO class.

Thanks,
Witold Szczerba

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to