spring中bean的默认作用域
时间: 2023-10-30 21:55:43 浏览: 160
回答: 在Spring中,bean的默认作用域是singleton。当一个bean的作用域为singleton时,Spring容器中只会存在一个共享的bean实例,并且所有对该bean的请求,只要id与该bean定义相匹配,就只会返回同一个实例。\[1\]\[2\]
#### 引用[.reference_title]
- *1* [Spring中Bean的作用域](https://blog.csdn.net/weixin_35106801/article/details/114233547)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [Spring bean 的5个作用域 Spring Bean的默认作用域为:singleton。它相比其他作用域的优点是系统开销小,...](https://blog.csdn.net/Rideal/article/details/77963912)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文