CopyPastor

Detecting plagiarism made easy.

Score: 0.8151759505271912; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2018-10-06
by pramodgautam

Original Post

Original - Posted on 2011-08-09
by KARTHIK



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Prototype creates a brand new instance everytime you call getBean on the ApplicationContext. Whereas for Request, only one instance is created for an HttpRequest. So in a single HttpRequest, I can call getBean twice on Application and there will only ever be one bean instantiated, whereas that same bean scoped to Prototype in that same single HttpRequest would get 2 different instances.
**HttpRequest scope**

Mark mark1 = context.getBean("mark"); Mark mark2 = context.getBean("mark"); mark1 == mark2; //This will return true
**Prototype scope**
Mark mark1 = context.getBean("mark"); Mark mark2 = context.getBean("mark"); mark1 == mark2; //This will return false

Best one i found on net Prototype creates a brand new instance everytime you call getBean on the ApplicationContext. Whereas for Request, only one instance is created for an HttpRequest. So in a single HttpRequest, I can call getBean twice on Application and there will only ever be one bean instantiated, whereas that same bean scoped to Prototype in that same single HttpRequest would get 2 different instances. **HttpRequest scope**
Mark mark1 = context.getBean("mark"); Mark mark2 = context.getBean("mark"); mark1 == mark2; //This will return true **Prototype scope** Mark mark1 = context.getBean("mark"); Mark mark2 = context.getBean("mark"); mark1 == mark2; //This will return false Hope that clears it up for you.


        
Present in both answers; Present only in the new answer; Present only in the old answer;