Sunday, December 9, 2018

How to pass values using Setter and Constructor injuction ?

Setter Injection 


<bean id="obj" class="com.java.Employee">  
    

    <property name="id">  
       <value>20</value>  
    </property>  


    <property name="name">  
       <value>Arun</value>  
    </property> 
 
   <property name="city">  
      <value>ghaziabad</value>  
   </property>  
  
</bean> 
 

Constructor Injection

<bean id="e" class="com.javatpoint.Employee">  
    <constructor-arg value="34" type="int" ></constructor-arg>  
    <constructor-arg value="Virat Kohli"></constructor-arg>  
</bean>  

No comments:

Post a Comment

How to pass values using Setter and Constructor injuction ?

Setter Injection  <bean id= "obj"   class = "com.java.Employee" >            <property name= "id...