Spring Boot 使用的默认 bean 范围是什么?
问题描述:
我在任何地方都找不到此信息.有人可以解释一下 spring boot 如何决定"正确的范围是什么?豆子都是单身吗?
I can't find this information anywhere. Can someone explain how spring boot 'decides' what the right scope is? Are the beans all singletons?
答
Spring Boot 不决定关于 bean 范围的任何事情,这是简单的 Spring 框架功能.默认的 bean 作用域是单例作用域(意思是应用程序中那个 bean 的一个实例).
Spring Boot doesn't decide anything about the bean scope, this is plain Spring framework functionality. Default bean scope is singleton scope (meaning, one instance of that bean in the application).