Cannot convert value of type [] to required type [] for property 'cursorItemReaders[0]': no matching editors or conversion strategy found
<p>I am developing <code>Spring Batch</code> example. In this example I am looking to develop <code>compositeJdbcReader</code> and <code>compositeJdbcWritter</code> API to convert database tables data into single XML file. When trying to do that I am facing below error:</p>

<pre><code>Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compositeJdbcReaderStep': Cannot resolve reference to bean 'compositeItemReader' while setting bean property 'itemReader'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compositeItemReader' defined in class path resource [composite/xml-jdbc-composite-item-reader-job.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type [java.util.ArrayList] to required type [java.util.List] for property 'cursorItemReaders'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.batch.core.job.flow.FlowJob] to required type [org.springframework.batch.item.database.AbstractCursorItemReader] for property 'cursorItemReaders[0]': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
    at com.common.batch.main.CompositeXMLMain.main(CompositeXMLMain.java:17)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compositeItemReader' defined in class path resource [composite/xml-jdbc-composite-item-reader-job.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type [java.util.ArrayList] to required type [java.util.List] for property 'cursorItemReaders'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.batch.core.job.flow.FlowJob] to required type [org.springframework.batch.item.database.AbstractCursorItemReader] for property 'cursorItemReaders[0]': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 15 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type [java.util.ArrayList] to required type [java.util.List] for property 'cursorItemReaders'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.batch.core.job.flow.FlowJob] to required type [org.springframework.batch.item.database.AbstractCursorItemReader] for property 'cursorItemReaders[0]': no matching editors or conversion strategy found
    at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:591)
    at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:603)
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:204)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1527)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1486)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    ... 21 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.batch.core.job.flow.FlowJob] to required type [org.springframework.batch.item.database.AbstractCursorItemReader] for property 'cursorItemReaders[0]': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:302)
    at org.springframework.beans.TypeConverterDelegate.convertToTypedCollection(TypeConverterDelegate.java:570)
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:216)
    at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:576)
    ... 27 more
</code></pre>

<p><strong>Not sure what is going wrong here. Please guide</strong></p>

<p>xml-jdbc-composite-item-reader-job.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:batch="http://www.springframework.org/schema/batch"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd"&gt;

    &lt;import resource="classpath:context-datasource.xml" /&gt;

    &lt;!-- JobRepository and JobLauncher are configuration/setup classes --&gt;
    &lt;bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean" /&gt;

    &lt;bean id="jobLauncher"  class="org.springframework.batch.core.launch.support.SimpleJobLauncher"&gt;
        &lt;property name="jobRepository" ref="jobRepository" /&gt;
    &lt;/bean&gt;


    &lt;!-- Step will need a transaction manager --&gt;
    &lt;bean id="transactionManager"
        class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" /&gt;


    &lt;!-- =========================================================== --&gt;    
    &lt;job id="compositeJdbcReaderJob" xmlns="http://www.springframework.org/schema/batch"&gt;
        &lt;step id="compositeJdbcReaderStep" next="compositeJdbcReaderStep2"&gt;
            &lt;tasklet&gt;
                &lt;chunk reader="compositeItemReader" writer="itemWriter" commit-interval="5" /&gt;
            &lt;/tasklet&gt;
        &lt;/step&gt;

        &lt;step id="compositeJdbcReaderStep2"&gt;
            &lt;tasklet&gt;
                &lt;chunk reader="compositeItemReader2" writer="itemWriter2" commit-interval="5" /&gt;
            &lt;/tasklet&gt;
        &lt;/step&gt;
    &lt;/job&gt;


    &lt;!-- ============= Composite Item Reader ================ --&gt;
    &lt;bean id="compositeItemReader" class="com.common.batch.reader.CompositeCursorItemReader"&gt;
        &lt;property name="unifyingMapper"&gt;
            &lt;bean class="com.common.batch.mapper.DefaultUnifyingStringItemsMapper" /&gt;
        &lt;/property&gt;
        &lt;property name="cursorItemReaders"&gt;
            &lt;list&gt;
                &lt;ref bean="itemReader1" /&gt;
            &lt;/list&gt;
        &lt;/property&gt;
    &lt;/bean&gt;

    &lt;bean id="compositeItemReader2" class="com.common.batch.reader.CompositeCursorItemReader"&gt;
        &lt;property name="unifyingMapper"&gt;
            &lt;bean class="com.common.batch.mapper.DefaultUnifyingStringItemsMapper" /&gt;
        &lt;/property&gt;
        &lt;property name="cursorItemReaders"&gt;
            &lt;list&gt;
                &lt;ref bean="itemReader2" /&gt;                 
            &lt;/list&gt;
        &lt;/property&gt;
    &lt;/bean&gt;


    &lt;!-- ========== ItemReader =============== --&gt;
    &lt;bean id="itemReader1" class="org.springframework.batch.item.database.JdbcCursorItemReader"&gt;
        &lt;property name="dataSource" ref="dataSource" /&gt;

        &lt;property name="saveState" value="true" /&gt;

        &lt;property name="sql"&gt;
            &lt;value&gt;
                &lt;![CDATA[ ${select.sql.customers} ]]&gt;
            &lt;/value&gt;
        &lt;/property&gt;
        &lt;property name="rowMapper"&gt;
            &lt;bean class="com.common.batch.mapper.CustomerMapper" /&gt;
        &lt;/property&gt;
    &lt;/bean&gt;


    &lt;bean id="itemReader2" class="org.springframework.batch.item.database.JdbcCursorItemReader"&gt;
        &lt;property name="dataSource" ref="dataSource" /&gt;

        &lt;property name="saveState" value="true" /&gt;

        &lt;property name="sql"&gt;
            &lt;value&gt;
                &lt;![CDATA[ ${select.sql.employees} ]]&gt;
            &lt;/value&gt;
        &lt;/property&gt;
        &lt;property name="rowMapper"&gt;
            &lt;bean class="com.common.batch.mapper.EmployeeMapper" /&gt;
        &lt;/property&gt;
    &lt;/bean&gt;


    &lt;!-- ItemWritter --&gt;
    &lt;bean id="itemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter"&gt;
        &lt;property name="resource" value="file:xml/customers.xml" /&gt;

        &lt;property name="marshaller" ref="customerUnmarshaller" /&gt;

        &lt;property name="rootTagName" value="customers" /&gt;
    &lt;/bean&gt;

    &lt;!-- ======= Customer Unmarshaller ======== --&gt;
    &lt;bean id="customerUnmarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"&gt;
        &lt;property name="aliases"&gt;
            &lt;util:map id="aliases"&gt;
                &lt;entry key="customer" value="com.common.batch.model.Customer" /&gt;
            &lt;/util:map&gt;
        &lt;/property&gt;
    &lt;/bean&gt;


    &lt;bean id="itemWriter2" class="org.springframework.batch.item.xml.StaxEventItemWriter"&gt;
        &lt;property name="resource" value="file:xml/customers.xml" /&gt;

        &lt;property name="marshaller" ref="employeeUnmarshaller" /&gt;

        &lt;property name="rootTagName" value="employees" /&gt;
    &lt;/bean&gt;

    &lt;!-- ======= Employee Unmarshaller ======== --&gt;
    &lt;bean id="employeeUnmarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"&gt;
        &lt;property name="aliases"&gt;
            &lt;util:map id="aliases"&gt;
                &lt;entry key="employee" value="com.common.batch.model.Employee" /&gt;
            &lt;/util:map&gt;
        &lt;/property&gt;
    &lt;/bean&gt;


    &lt;bean id="itemCustomerProcessor" class="com.common.batch.processor.CustomerProcessor" /&gt;
    &lt;bean id="itemEmployeeProcessor" class="com.common.batch.processor.EmployeeProcessor" /&gt;


    &lt;job id="itemReader1" xmlns="http://www.springframework.org/schema/batch"&gt;
        &lt;step id="step1"&gt;
            &lt;tasklet transaction-manager="transactionManager"&gt;
                &lt;chunk reader="compositeItemReader" writer="itemWriter" processor="itemCustomerProcessor" commit-interval="1" /&gt;
            &lt;/tasklet&gt;
        &lt;/step&gt;
    &lt;/job&gt;


    &lt;job id="itemReader2" xmlns="http://www.springframework.org/schema/batch"&gt;
        &lt;step id="step2"&gt;
            &lt;tasklet transaction-manager="transactionManager"&gt;
                &lt;chunk reader="compositeItemReader2" writer="itemWriter2" processor="itemEmployeeProcessor" commit-interval="1" /&gt;
            &lt;/tasklet&gt;
        &lt;/step&gt;
    &lt;/job&gt;

&lt;/beans&gt;
</code></pre>

<p>CompositeXMLMain.java</p>

<pre><code>public class CompositeXMLMain {
    @SuppressWarnings("resource")
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("composite/xml-jdbc-composite-item-reader-job.xml");

        JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");
        Job job = (Job) context.getBean("compositeJdbcReaderJob");

        JobExecution execution;
        try {
            execution = jobLauncher.run(job, new JobParameters());
            System.out.println("Job Exit Status : "+ execution.getStatus());

        } catch (JobExecutionAlreadyRunningException | JobRestartException
                | JobInstanceAlreadyCompleteException | JobParametersInvalidException e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
        System.out.println("Done !!");
    }
}
</code></pre>