Spring's stateful bean and stateless bean

Source: Internet
Author: User

Stateful session Bean: each user has its own unique instance, during the lifetime of the user, the bean maintains the user's information, namely "stateful"; Once the user dies (the end of the call or the end of the instance), the bean's lifetime ends. That is, each user will initially get an initial bean.

Stateless session Bean:bean Once instantiated, they are added to the session pool and can be shared by individual users. Even if the user has died, the lifetime of the bean does not necessarily end, it may still exist in the session pool for other users to invoke. Because there is no specific user, it is not possible to maintain a user's state, so called a stateless bean. However, a stateless session bean is not stateless, and if it has its own attributes (variables), then these variables will be affected by all users who invoke it, which must be noted in practical applications.

Spring's stateful bean and stateless 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.