I work on servers that have 'extended' the definition of @RequestScope
beyond just servlet based http requests.  We use the same annotations but
use alternate implementations of the Scope object.  So i think it would be
quite reasonable to reimplement the scopes for your usecase.

The general advice around 'don't implement your own scopes' is accurate,  a
Scope is generally a very general and all encompassing concept, so it is
rare that you might have an application that needs something beyond the
standard set.  Plus there can be weird issues introduced if your custom
scopes have overlapping lifetimes.  So the advice is correct, it just may
not apply to your usecase :)

On Sun, Jun 7, 2015 at 11:29 PM, Tim Boudreau <[email protected]> wrote:

> On Sunday, June 7, 2015 at 3:12:08 PM UTC-4, Hannes Steffenhagen wrote:
>>
>> Hello, I'm currently writing an Application using Guice. It is not a web
>> application (nor is it based on servlets), but it still conceptually has
>> scopes like 'Application', 'Session' and 'Request' - does it make any sense
>> at all to try to attempt to use the built in scopes from the web module? Or
>> should I rather write my own scopes, despite what the documentation
>> recommends?
>>
>
> I've found it so useful to do that that I wrote a library for generically
> doing custom scopes:
> https://github.com/timboudreau/scopes
>
> To use it in a Maven project:
> http://timboudreau.com/builds/
>
> (one of these days I'll get that and a bunch of related stuff on Maven
> Central)
>
> -Tim
>
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-guice.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-guice/8eac70b5-7dfa-4a34-9aa1-0aa9a97003c0%40googlegroups.com
> <https://groups.google.com/d/msgid/google-guice/8eac70b5-7dfa-4a34-9aa1-0aa9a97003c0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/CAO9V1M%2B5Bc7d3R6mzV%3DwAOq-nnmv8OUDwUjo7jWF705XTeKJJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to