title: Using MultiResourceItemReader with jsonItemReader in Spring Batch
body: <p>I have multiple .json files to read from my classpath (/resources/input/*.json) in my Spring Batch application. Below is the my code:</p>
  <pre><code>@Value(&quot;${search.folder}&quot;)
  private Resource[] inputResources;
  
  @Bean
   public MultiResourceItemReader&lt;Trade&gt; multiResourceItemReader() {
  
          return new MultiResourceItemReaderBuilder&lt;Trade&gt;()
                      .delegate(jsonItemReader())
                      .resources(inputResources)
                      .build();
      }
  
  
      @Bean
      public JsonItemReader&lt;Trade&gt; jsonItemReader() {
  
          logger.info(&quot;In Item reader method to read the file.&quot;);
  
          ObjectMapper objectMapper = new ObjectMapper();
  
          JacksonJsonObjectReader&lt;Trade&gt; jsonObjectReader =
                  new JacksonJsonObjectReader&lt;&gt;(Trade.class);
  
          jsonObjectReader.setMapper(objectMapper);
  
          return new JsonItemReaderBuilder&lt;Trade&gt;()
                  .jsonObjectReader(jsonObjectReader)
                  .resource(new ClassPathResource(inputResources))
                  .name(&quot;tradeJsonItemReader&quot;)
                  .build();
  
      }
  
  application.yml
  
  search:
    folder: input\*.json
  </code></pre>
  <p>THe exception which I am getting is:</p>
  <blockquote>
  <p>Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.item.json.JsonItemReader]: Factory method 'jsonItemReader' threw exception; nested exception is java.lang.IllegalArgumentException: A resource is required.</p>
  </blockquote>
  <p>From the above exception I do understand that a resource is required in jsonItemReader. But how do I give a resource in jsonItemReader() as the resource is already coming from MultiResourceItemReader.</p>