Spring Common configuration (1) Scope of---bean

Source: Internet
Author: User

Tagged with: PSC share LSE OTA OBA how a prototype batch

1. Scope1.1 and Theory of bean

Scope describes how the spring container creates an instance of a new bean, which can be implemented by @scope annotations

  • Singleton: Default configuration, a spring container has only one instance of the bean, and the whole container shares an instance.
  • Prototype: Creates a new bean instance each time it is called.
  • Request:web project, create a new bean instance for each HTTP request.
  • Session:web project, create a new bean instance for each HTTP request.
  • Globalsession: This is intended to be useful in protal applications, to create a new bean instance for each global HTTP session.
    In addition, there is one scope in spring batch that uses @stepscope, and we will introduce this scope in the batch section.

Spring Common configuration (1) Scope of---bean

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.