Q4 Question about Development standards I want the full exa

^^^

Q4. Question about Development standards I want the full example for the given data

            Use Inner beans when you don\'t want a particular bean to available without its parent’s bean. Though it doesn\'t look agreeable to most eyes, it is still worth if you don\'t want bean factory to use this bean write the example program for it

Thank you in advance

Solution

public class Customer

{

   private Person person;

   …

}

Usage of Inner bean

               <bean id=\"CustomerBean\" class=\"com.mkyong.common.Customer\">

                               <property name=\"person\">

                                              <bean class=\"com.mkyong.common.Person\">

                                                             <property name=\"name\" value=\"mkyong\" />

                                                              <property name=\"address\" value=\"address1\" />

                                                             <property name=\"age\" value=\"28\" />

                                              </bean>

                               </property>

               </bean>

Using bean as Reference

               <bean id=\"CustomerBean\" class=\"com.mkyong.common.Customer\">

                               <property name=\"person\" ref=\"PersonBean\" />

               </bean>

               <bean id=\"PersonBean\" class=\"com.mkyong.common.Person\">

                               <property name=\"name\" value=\"mkyong\" />

                               <property name=\"address\" value=\"address1\" />

                               <property name=\"age\" value=\"28\" />

               </bean>

^^^ Q4. Question about Development standards I want the full example for the given data Use Inner beans when you don\'t want a particular bean to available with

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site