I am aware of the fact that whenever we create bean, by default it creates bean with singleton scope. If we want to get different copy of bean everytime, we have to define prototype scope. In a recent interview I was asked how to get different copy of bean & I replied the same thing. But the interview guy replied that this thing is outdated & something new came up in spring boot . Please let me know if there is any such new thing
Asked
Active
Viewed 222 times
0
-
1Possible duplicate of [Spring Bean Scopes](https://stackoverflow.com/questions/17599216/spring-bean-scopes) – Aritz Mar 09 '19 at 18:09
-
@Xtreme biker read carefully, i am asking for springboot. Not for spring – ASharma7 Mar 09 '19 at 18:11
-
Spring Boot uses Spring core under the covers.. The Spring scopes are defined in their docs. https://stackoverflow.com/questions/32420503/what-is-the-default-bean-scope-used-by-spring-boot – Aritz Mar 09 '19 at 18:15
-
@XtremeBiker That question doesn't answer the question if something there is something new in Spring Boot to get a new copy of a bean, so it is not a duplicate. – Mark Rotteveel Mar 10 '19 at 10:29
-
@Mark if the question refers to the prototypes in spring, as the question infers, it could be a dup of the first or second link in the comments. Anyway, there are other tools in the framework to copy beans, such as BeanUtils#copy. However the interviewer is just wrong when telling the OP that the scopes are outdated. – Aritz Mar 10 '19 at 15:13