天天看点

java 单页应用_java-SpringBoot单页应用程序并发

4.4.1 The singleton scope

When a bean is a singleton, only one shared instance of the bean will be managed, and all requests for beans with

an id or ids matching that bean definition will result in that one

specific bean instance being returned by the Spring container.

To put it another way, when you define a bean definition and it is

scoped as a singleton, then the Spring IoC container will create

exactly one instance of the object defined by that bean definition.

This single instance will be stored in a cache of such singleton

beans, and all subsequent requests and references for that named bean

will result in the cached object being returned.