Specify the 3 modes of dependency with the properties of ref
local\bean\parent
Local
If a bean is in the same XML file as the referenced bean and the referenced bean is named by ID, then the local property of ref can be used. This will allow the parser in the project to validate the Bean's ID earlier in parsing the XML document.
<bean id= "Signle" class= "Com.st.sig.Single" autowire= "Default" >
<property name= "Name" >
<ref local= "Mege"/>
</property>
</bean>
<bean id= "Mege" name= "Mege" class= "Com.st.sig.Mege" ></bean>
Bean
The Bean property of a ref element specifies that the referenced bean is the most common form in spring, allowing the bean to point to the same XML, or not to the same XML. The value of the Bean property can be the same as the id attribute of the bean referenced by the reference, or the same as the property of the bean referenced by the reference.
<bean id= "Signle" class= "Com.st.sig.Single" autowire= "Default" >
<property name= "Name" >
<ref bean= "Mege"/>
</property>
</bean>
<bean id= "Mege" name= "Mege" class= "Com.st.sig.Mege" ></bean>
Parent
When using the Parent property to specify the bean referenced by the reference, allow reference to the bean in the parent beanfactory or ApplicationContext of the current beanfactory or ApplicationContext. The value of the parent property can be the same as the name of the bean referenced by the reference or the same as the ID of the bean referenced by the reference
<bean id= "Signle" class= "Com.st.sig.Single" autowire= "Default" >
<property name= "Name" >
<ref parent= "Mege"/>
</property>
</bean>
<bean id= "Mege" name= "Mege" class= "Com.st.sig.Mege" ></bean>
same point for bean and Local:
Both beans and IDs can use the Bean's ID reference reference to reference the bean in the same XML
Different points of the
Bean and Local:
Specify dependencies with the Bean property to refer to the bean's name, and reference references to beans in different XML