The prototype bean scope

In Spring, any bean defined with the prototype scope has one instance of the bean created for every time the bean is injected into other collaborating beans. The following figure illustrates the Spring prototype scope:

As you can see in the preceding diagram, an accountRepository class is configured as a prototype bean, and the container creates a brand new instance for each time that bean is injected into other beans.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset