Pages

Friday, September 7, 2012

spring bean scopes

singleton – create and returns a bean instance per Spring IoC container
prototype – creates a new bean instance for every request.
request – creates a single bean instance per HTTP request.
session – create and returns a  bean instance per HTTP session.
globalSession – creates a single bean instance per global HTTP session.

eg:


@Service
@Scope("prototype")
public class Vehicle{
     public void driveVehicle(){
     }
}

No comments:

Post a Comment