I am thinking about @scope("prototype")
scope but I don't get it because we already have the new
keyword. Both of them create a new instance of an object in runtime. What is the advantage of using prototype
? Is it easier to reallocate than using new
? Am I doing something wrong when I create new object with using the new
keyword?
I'm trying to understand the advantages of it.
I found this question but it does not explain the advantages / disadvantages of new
and prototype
: What is the difference between bean with scope prototype and new Object in singleton bean?