I've looked at the Spring/JAX-RS integrations that Jersey and RESTEasy provides.
Honestly, I haven't considered using Spring to configure @Context and @PathParam, but it does seem to be an interesting topic. I have a question on this... I understand how @Context can be injected when it's applied to a setter/constructure/member variable. You'd have a request scoped Resource and request scoped @Context beans based on a @Povider, or something like that. I don't quite understand how Guice (or Spring) would populate method level @PathParam/@CookieParam/@MatrixParam variables since they change per reqeust; would you create a request scoped Guice bean per @PathParam/@CookieParam that's created at startup time? Would you be able to support "optional" dependencies for optional parameters? Would you treat a JAX-RS method as a @Provider method? -Solomon Duskis On Tue, Oct 7, 2008 at 11:31 AM, James Strachan <[EMAIL PROTECTED]>wrote: > > 2008/10/7 Gili <[EMAIL PROTECTED]>: > > Hi, > > > > Can someone from the Guice core development team please take a look at > > http://n2.nabble.com/Using-Guice-with-JAX-RS-tt1127230.html > > > > I've integrated Guice into Jersey (the reference implementation for > > JAX-RS) but the implementation is fragile. If you read that discussion > > thread you will likely see a lot of potential RFEs for Guice to fix > > this. > > > > One topic I had in mind is the fact that Jersey knows how to inject > > some classes, Guice knows how to inject others, but they cannot share > > that information with one another. Ideally I want Guice to inject all > > the classes it knows and ask Jersey how to inject some type before > > deciding to throw ConfigurationException. > > Ironically, from a different direction (implementing @Resource > injection from JSR250/EJB3) I kinda hit the same kinda issue today & > tried implementing a generic hook in Guice to solve these kinds of > issues. > > There's a patch here: > http://code.google.com/p/google-guice/issues/detail?id=258 > > and a thread I just started discussing it here... > > http://groups.google.com/group/google-guice/browse_thread/thread/649f1a24c62a2bae > > > I've hit similar issues in the past using JAX-RS with Spring too BTW; > you kinda want really one IoC framework to do all the injection, > including some framework specific injection points (like the @Context > / @ PathParam values from JAX-RS etc) > > > > To be fair, this use-case is rather ugly. It isn't clear what should > > happen if a class is marked up using Guice annotations but Guice > > doesn't know how to configure it because it isn't bound in the Module. > > Jersey would be able to inject it but it will end up ignoring the > > Guice annotations. I want to avoid misleading the user into thinking > > Guice took all his annotations into consideration when in fact it did > > not. > > Yeah - I'd prefer Guice to do all the injections, including the > Jersey/JAX-RS injections too; which shouldn't be too hard to be honest > if something like the patch for 258 is applied it'd be quite trivial. > That way Guice does all the injections in a single, consistent way > rather than adding framework specific hacks etc. > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://open.iona.com > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
