Spring Boot 使用的默认 bean 范围是什么? [英] What is the default bean scope used by Spring Boot?

查看:36
本文介绍了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).

这篇关于Spring Boot 使用的默认 bean 范围是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆