Junior — Middle
How is the scope of a Bean object determined by default in standard conditions?
sobes.tech AI
Answer from AI
By default, the scope of a Bean object in standard conditions is a singleton. This means that the Spring container creates one instance of the Bean for the entire application context, and this instance is used everywhere the Bean is required.
That is, unless otherwise specified, the Bean is created once at application startup and lives until the application terminates. This is convenient for services and components that should be unique and shared.
If a different scope is needed, such as prototype (a new instance for each request), it must be explicitly specified using an annotation or configuration.