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.
My question is: In which data structure are the beans hold after the xml file is read and the beans are instantiated(created)?
Thank you
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With