prototype: This bean scope just reverses the behavior of singleton scope and produces a new instance each and every time a bean is requested.
request: Only one instance is created for an HttpRequest.
With this bean scope, a new bean instance will be created for each web request made by client. As soon as request completes, bean will be out of scope and garbage collected.
HttpRequest or request scope
For a in a single HttpRequest, when we will call getBean twice on Application and there will ever be one bean instantiated, whereas that same bean scoped to Prototype in that same single HttpRequest would get 2 different instances.
Prototype creates a brand new instance every time when we call getBean on the ApplicationContext.
How to define the bean scope
1) In bean configuration file
2) Using annotations