concept custom scope in category dependency injection

appears as: custom scope, custom scope, custom scopes
Dependency Injection: Design Patterns Using Spring and Guice

This is an excerpt from Manning's book Dependency Injection: Design Patterns Using Spring and Guice.

Listing 6.3. Spring’s custom scope interface
package org.springframework.beans.factory.config; public interface Scope { Object get(String key, ObjectFactory unscopedProvider); Object remove(String key); String getConversationId(); void registerDestructionCallback(String key, Runnable destructionCallback); }
Listing 6.4. Transaction scope implemented as a custom scope in Spring

The process of moving data between application memory (in the form of objects) and database storage (in the form of relational tables) occurs in series of tasks called transactions. Let’s look at how to treat transactions as a context and define a custom scope around them.