Spring核心框架-Bean存放在哪里? [英] Spring Core Framework - Where are the beans hold?

查看:241
本文介绍了Spring核心框架-Bean存放在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名初级Java开发人员,正在阅读 spring.io 中的spring文档.我读到,每个在*.xml文件中注册的bean(春天用来解析依赖关系的文件)都是使用<bean> </bean>标记声明的.

I am a junior Java developer and I am reading the spring documentation from spring.io. I read that every bean that gets registered in the *.xml file that spring uses to resolve dependencies is declared using <bean> </bean> tags.

我的问题是:在读取xml文件并实例化(创建)bean之后,bean保持哪种数据结构?

My question is: In which data structure are the beans hold after the xml file is read and the beans are instantiated(created)?

谢谢

推荐答案

尽管如果您刚刚开始学习 Spring ,但出于几乎所有情况的了解,底层类是

Although you should not be worried much about the internal structures if you are just beginning to learn Spring but for the sake of knowledge in almost all cases the underlying class is DefaultSingletonBeanRegistry and as you can see by going through the source code here it maintains a ConcurrentHashMap of singleton objects. Also there are similar other map object for other information being stored.

private final Map<String, Object> singletonObjects = new ConcurrentHashMap<String, Object>(64);

这篇关于Spring核心框架-Bean存放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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