Wednesday, 20 April 2016

How to use index instead of type in constructor injection ?


<bean id="billingService" class="com.genius.spring.BillingService">
  <constructor-arg index="0" value="shaan" />
  <constructor-arg index="1" value="100" />
</bean>

Best practice is to prefer type over index for constructor argument matching.
<constructor-arg type="java.lang.String"  value="shaan" />

No comments:

Post a Comment

Note: only a member of this blog may post a comment.