I recently found this article http://www.baeldung.com/spring-interview-questions which states that the Prototype Pattern has been applied by Spring to Prototype-scoped beans (Q17). I've been using Spring for quite some time now, but never actually stopped to think about why the creators of Spring have chosen this name. Now that I saw the above statement in the article I can only think that:
The creators of Spring did not choose the name "prototype" with the Prototype Design Pattern in mind and that the author of the above article is wrong, because the Prototype Design Pattern is not only about creating new objects every time but rather about keeping a cache of objects that are expensive to create, thus using them as "prototypes" for every newly created object, not having to perform the time consuming/expensive initialization part every time. Which is not what Spring does with prototype scoped beans.
What do you think? Am I missing something?
Aucun commentaire:
Enregistrer un commentaire