The problem: We want to create a new class at runtime using
constructor parameters determined at runtime AS WELL AS constructor
parameters injected by Guice.

The solution: AssistedInject :-)

That has worked out great for us, except for the fact that assisted
inject will not recognize interceptors. (I did see this mentioned in
the issues list:  http://code.google.com/p/google-guice/issues/detail?id=248)

Currently, the only way we have found to get this behavior is to:

1) Create a constructor with all the GUICE injected parameters
2) Use the Injector directly to get the class instance
3) Call a setter method we supplied on the object to provide the
additional runtime parameters
4) Provide an additional concrete factory/builder class to abstract
out this class creation (just for code cleanliness)

This has forced us to do a couple of strange things-  we have to now
keep track of our parent Injector so we can re-use it later on (which
is more of a resource-lookup feeling), and makes us mix constructor DI
with setter DI (bleck).

Is there currently better way to go about this?


--~--~---------~--~----~------------~-------~--~----~
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