It seems that all Guice implementation implementations out of the box are essentially streaming (or ignoring streams entirely):
Scopes.SINGLETON and Scopes.NO_SCOPE ignore streams and are edge cases: global scope and scope.
ServletScopes.REQUEST and ServletScopes.SESSION ultimately depend on retrieving objects with a scope from ThreadLocal<Context> . The restored Context contains a link to the HttpServletRequest , which contains a link to objects with a storage area stored as named attributes (where the name is obtained from com.google.inject.Key ).
The SimpleScope class from the user area. The Guice wiki also provides a stream implementation using the member variable ThreadLocal<Map<Key<?>, Object>> .
With this preamble, my question is this: how do I create a non-Thread-scope Scope? It seems that something I can use to search for Map<Key<?>, Object> is missing, since the only thing passed to Scope.scope() is Key<T> and a Provider<T> .
Thanks in advance for your time.
source share