Am Dienstag, 13. Juni 2017 20:21:00 UTC+2 schrieb Arun Thirupathi:
>
> In one of our projects we are binding an implementation in RequestScope. 
> But when this is run from a background thread, it fails with the exception 
> below. 
>
> Error in custom provider, com.google.inject.OutOfScopeException: Cannot 
> access scoped object.
> Either we are not currently inside an HTTP Servlet request, or you may 
> have forgotten to apply
> com.google.inject.servlet.GuiceFilter as a servlet filter for this request.
>

Have a look at ServletScopes 
<https://google.github.io/guice/api-docs/4.1/javadoc/com/google/inject/servlet/ServletScopes.html>on
 
how to transfer the current request to another thread.


> Can I bind different implementations based on the scope ? I want to 
> provide one implementation in RequestScope and other implementation in 
> another scope.
>
> Is there a way to configure Guice to ignore these errors silently. 
>
> Currently I am thinking of the naive way of, try/catch all the usage of 
> this object, which is far too many and there are new interactions with this 
> object.
>
> I run my project inside Google App Engine, if that matters.
>
> Thanks,
> Arun.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/251762fa-04de-477c-909a-c4d9972b3ef1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to