What is difference between Anonymous vs ID in Spring Bean ?

Beans that do not need to be referenced elsewhere can be defined anonymously
This bean is identified (has an id) and can be accessed to inject it into another bean
 

<bean id="exampleBean" class="org.example.ExampleBean">
       <property name="anotherBean" ref="someOtherBean" />
</bean>


This bean is anonymous (no id)

<bean class="org.example.ExampleBean">
       <property name="anotherBean" ref="someOtherBean" />
</bean>


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email