October 2017
Intermediate to advanced
396 pages
10h 2m
English
For creating your customer scope in the Spring IoC container, Spring provides the org.springframework.beans.factory.config.Scope interface. You have to implement this interface to create your own custom scopes. Take a look at the following MyThreadScope class as a custom scope in the Spring IoC container:
package com.packt.patterninspring.chapter5.bankapp.scope;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.config.Scope;
public class MyThreadScope implements Scope {
private final ThreadLocal<Object> myThreadScope = new ThreadLocal<Object>() { protected Map<String, Object> initialValue() { System.out.println("initialize ...Read now
Unlock full access