How many bean scopes does spring support?

Alibaba cloud Q & A 2022-02-13 05:23:01 阅读数:863

bean scopes spring support

A detailed description ?




Take the answer 1:

1、singleton: Single case , Default scope .

2、prototype: Prototype , One new object at a time .

3、request: request , Every time Http Request to create a new object , Apply to WebApplicationContext In the environment .

4、session: conversation , Share an instance with the same session , Different sessions use different instances .

5、global-session: The global session , All sessions share an instance .


copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130522598678.html