What is the default bean scope used by Spring Boot?

前端 未结 2 1244
时光取名叫无心
时光取名叫无心 2021-01-08 00:56

I can\'t find this information anywhere. Can someone explain how spring boot \'decides\' what the right scope is? Are the beans all singletons?

相关标签:
2条回答
  • 2021-01-08 01:31

    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).

    0 讨论(0)
  • 2021-01-08 01:33

    Here is the official documentation:

    https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#beans-factory-scopes

    Default scope for a Spring Bean in singleton.

    0 讨论(0)
提交回复
热议问题