java - Spring injecting implementation bean -
i have following snippet conf spring file:
<bean id="taskletstep" abstract="true" class="org.springframework.batch.core.step.tasklet.taskletstep"> <property name="jobrepository" ref="jobrepository"/> <property name="transactionmanager" ref="transactionmanager"/> </bean> <bean id="hello" class="com.techavalanche.batch.printtasklet"> <property name="message" value="hello"/> </bean> <bean id="world" class="com.techavalanche.batch.printtasklet"> <property name="message" value=" world!"/> </bean> <bean id="mysimplejob" class="org.springframework.batch.core.job.simplejob"> <property name="name" value="mysimplejob" /> <property name="steps"> <list> <bean parent="taskletstep"> <property name="tasklet" ref="hello"/> </bean> <bean parent="taskletstep"> <property name="tasklet" ref="world"/> </bean> </list> </property>
to me not clear following bit:
<bean parent="taskletstep"> <property name="tasklet" ref="hello"/> </bean>
taskletstep interface , not have property. code works fine, seems bean id "hello" gets injected. therefore asking, standard way config file inject bean implementation (id: hello) interface bean (id: taskletstep)?
it's tasklet step in spring batch job. doing fine. alternatively, can this:
<job id="mysimplejob"> <step id="step1"> <tasklet ref="hello"/> </step> <step id="step2"> <tasklet ref="world"/> </step> </job>
here complete reference: http://docs.spring.io/spring-batch/reference/htmlsingle/
Comments
Post a Comment