1. ID: the unique ID of JavaBean in beanfactory. this parameter is required as the index name when obtaining a JavaBean instance through beanfactory in the code.
2. Class: name of the JavaBean class
3. Singleton: Specifies whether the Java Bean uses the singleton mode. If it is set to "true", only one Java Bean instance is maintained within the scope of beanfactory, the Code obtains the reference of this JavaBean instance through beanfactory. If this parameter is set to "false", beanfactory returns a new instance every time it obtains the JavaBean instance through beanfactory.
4. init-method: initialization method. This method will be executed after beanfactory creates a JavaBean instance and before returning a reference to the application layer. It is generally used for initialization of some resources.
5. destruction method. This method will be executed when beanfactory is destroyed and is generally used for resource release.
6. Depends-on: bean dependency. Generally, this parameter is not required. Spring organizes the construction of various dependencies based on the situation (here
The depends-on attribute in the example is not required ). In some special cases, for example, some static variables in JavaBean need to be initialized (this is a bad smell and should be avoided in design ). You can use depends-on to specify its dependency to ensure that the resources specified by depends-on are loaded before the bean is loaded.
7. <value>: You can specify the attribute value through the <value/> node. Beanfactory will automatically match according to the attribute type corresponding to Java Bean. Note: <value> </value> indicates an empty string. To set the attribute value to null, you must use the <null/> node.
8. <ref> specifies the reference relationship between attributes and other beans in beanfactory.