What does the prototype of attribute scope in spring mean?

Source: Internet
Author: User

Prototype-scoped beans, each request (injecting it into another bean, or invoking the container's Getbean () method programmatically) produces a new bean instance, which is equivalent to the operation of an For prototype-scoped beans, it is important to note that spring cannot be held responsible for the entire life cycle of a prototype%20bean, when the container is initialized, configured, decorated, or finished with a prototype instance, it is given to the client, The prototype instance is then ignored. Regardless of the scope, the container invokes the initialization lifecycle callback method for all objects, and for prototype, any configured destructor life-cycle callback methods will not be called. It is the responsibility of the client code to clear the objects of the prototype scope and to release the expensive resources held by any prototype%20bean. (One possible way for the spring container to release the resource that is consumed by the singleton scope Bean is by using the bean's post processor, which holds a reference to the bean to be purged.) )

What does the prototype of attribute scope in spring mean?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.