description of the XML configuration file properties:
<bean id= "Theaction" ⑴
class= "Net.xiaxin.spring.qs.UpperAction" ⑵
Singleton= "true" ⑶
Init-method= "Init" ⑷
destroy-method= "Cleanup" ⑸
depends-on= "ActionManager" ⑹>
<property...>
</bean>
⑴id
The unique identifier of the Java Bean in beanfactory , which is obtained through beanfactory in the code .
This is used as the index name for JavaBean instances.
⑵class the Java Bean class name is the implementation class for the real interface.
⑶ singleton bean prototype or singleton
Singleton (Singleton) mode, if set to "true", only one instance of this Java Bean is maintained, and Conversely, if set to "False",beanfactory will create a new instance each time it returns. The default is true.
The way to do it is for the first timeGetbeanwhen placedMapThe second time, and then directly in theMapin the class namedKey, the instance isvalue. BeanAdditional scopes forprototype: Prototype mode: in Getprototypedefined byBeangeneration of new instances, whose life cycle is maintained by the client. Sessionfor eachHTTPsessionto produce a new instance. Global Sessiononly when usingPortletcontextis effective when it is used.Singletonand theprototype
⑷init-method
Initializes the method, which executes after beanfactory creates the JavaBean instance before returning the reference to the application layer. Typically used for initialization of some resources. Create the init method in JavaBean, and then add the property init-method= "Init" .
⑸destroy-method
Method of Destruction. This method is executed when the beanfactory is destroyed, and is typically used for resource deallocation. Similar to init usage
⑹depends-on
The Bean dependency relationship. In general, no setting is required. Spring organizes the construction of individual dependencies according to the circumstances (the depends-on attribute in this example is not required).
Only some special cases, such as some static variables in JavaBean, need to be initialized (this is a Badsmellthat should be avoided in design). specifying its dependencies through depends-on will ensure that the resources specified by depends-on are loaded first before this Bean is loaded .
⑺<value>
through <VALUE/> beanfactory will be automatically based on the java bean
The following "desc" property provides an Example of setting a null value. Note <value></value> represents an empty string, and if you need to set the property value to null, you must use the < The null/> node.
⑻<ref> Specifies the reference relationship of the property to other beans in the beanfactory .
Description of XML configuration file properties in Spring