- Spring’s beans are actually cached in the CurrentHashMap object
- Before creating a Bean, you first need to specify the Bean’s creation id, indicating that the Bean has been or will be created, to increase the efficiency of caching
- Use the scope attribute of the Bean to determine whether the scope is singleton or Prototype, and then create the corresponding Bean object
- Java reflection is used to create instances of beans, checking for access modifiers before creation and, if not public, calling setAccessible (True) to break through Java’s syntaxal limitations so that object instances can be created through, say, private constructors
- Next, find the bean’s property value and complete the property injection
- Add the created Singleton object to the cache for the next call