The <ref> element is the used to set the value of the specified property to be a reference to another bean. It is used inside the <constructor-arg/> or <property/> definition element. Such beans which work together with other beans are known as Collaborators. The syntax of <ref> is as follows:-
<ref bean="someBean"/> or <ref local="someBean"/>
The advantage of using local attribute give the ability of the XML parser to validate XML
id references within the same file. The XML parser will issue an error if no matching element is found in the same file.
Jun 2, 2008 4:31:54 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@c4bcdc: display name [org.springframework.context.support.ClassPathXmlApplicationContext@c4bcdc]; startup date [Mon Jun 02 16:31:54 IST 2008]; root of context hierarchy
Jun 2, 2008 4:31:54 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [com/visualbuilder/xml/spring-beans.xml]
afterPropertiesSet method is called
Jun 2, 2008 4:31:55 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@c4bcdc]: org.springframework.beans.factory.support.DefaultListableBeanFactory@2a5330
Jun 2, 2008 4:31:55 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2a5330: defining beans [test,disposableBean,collectionExample,typeCollectionExample,constructorInjection,setterInjection,wrapperBean]; root of factory hierarchy