Spring / Spring Beans
Difference between request and prototype bean scope in spring?
Prototype scope creates a new instance everytime getBean
method is invoked on the ApplicationContext. Whereas for request scope, only one instance is created for an HttpRequest.
So in a HttpRequest, if the getBean
method is called twice on Application and there will be only one bean instantiated and reused, whereas the bean scoped to Prototype in that same single HttpRequest would get 2 different instances.
More Related questions...