Stuart McCulloch 写道: > 2008/10/10 Haulyn R. Jason <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> > > > Hi,all > > I use Guice 1.0, and write my own Interceptor. I need to get a > database > connection in the Interceptor, but when I use the code as follow: > > @Inject > private DBProvider dbProvider ; > > It doesn't work, I have to use DBProvider dbProvider = > Guice.getInject...... > > I think maybe it's not the Guice way, should I use @Inject in > Interceptor? > > > for Guice 1.0 see: > > http://tembrel.blogspot.com/2007/09/injecting-method-interceptors-in-guice.html > > for the next release of Guice, you can use Binder.requestInjection(obj): > > http://code.google.com/p/google-guice/issues/detail?id=88 > > HTH > > -- > > Thanks! > > Mobile: +086-15864011231 > Website:http://www.openmotel.cn > http://www.vvthumb.com > GTalk:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > Skype:saharabear > > > Haulyn Runner Jason > > > > > > > > -- > Cheers, Stuart > > > Thanks Stuart, it works well.
-- Thanks! Mobile: +086-15864011231 Website:http://www.openmotel.cn http://www.vvthumb.com GTalk:[EMAIL PROTECTED] Skype:saharabear Haulyn Runner Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
