Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6756797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:34:03+00:00 2026-05-26T13:34:03+00:00

I have the following configuration in the file dataloader.properties filepath = /xx exchange =

  • 0

I have the following configuration in the file dataloader.properties

filepath = /xx
exchange = M00,M01,MF2,MF3

I need the MultiResourcePartitioner to process the files from all these folders such as

/xx/M00/*
/xx/M01/*
/xx/MF2/*
/xx/MF3/*

There can be other folders under /xx , but it should process only the files from folder M00,M01,MF2,MF3

<bean id="filepartitioner" class="org.springframework.batch.core.partition.support.MultiResourcePartitioner">
    <property name="resources" value="classpath:./${filepath}" />
</bean>

kindly let me know , how to do this in spring batch .I had a look at a filesystemresource and ResourcesItemReader api , but no idea how to inject it to the MultiResourceParitioner

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:34:04+00:00Added an answer on May 26, 2026 at 1:34 pm

    simple solution – if possible at all
    if the pattern stays stable you could try it with

    <bean id="filepartitioner" class="org.springframework.batch.core.partition.support.MultiResourcePartitioner">
        <property name="resources" value="classpath:./${filepath}/M*/*" />
    </bean>
    

    customized MultiResourcePartitioner – filters folders

    public class CustomM... extends MultiResourcePartitioner {
        // constructor with filePath and exchange argument
        // convert exchange argument to list of folder patterns,
        // or let it convert by spring magic
        // use one of the "list all files.." methods from below
        // call setResources(...)
    }
    
    <bean id="filepartitioner" class="org.springframework.batch.core.partition.support.CustomMultiResourcePartitioner">
        <constructor-arg type="java.lang.String" value="${filePath}" />
        <!-- spring can convert comma separated values to array and list
             just look into the spring documentation -->
        <constructor-arg type="java.lang.String" value="${exchange}" />
    </bean>
    

    a working example is available on my github repo at https://github.com/langmi/spring-batch-examples-playground/blob/4e733dce09daffca1c10d4907f410ac5bead6887/src/main/resources/spring/batch/job/file-multiresourcepartitioner-filter-folders-factory-job.xml, check file-multiresourcepartitioner-filter-folders-job.xml

    more pluggable solution: Factory which creates the Resources for the MultiResourcePartitioner

    public class FilterFactory {
      public static Resource[] getInstance(final String filePath, final List<String> acceptedFolders) {
        final List<FileSystemResource> files = new ArrayList<FileSystemResource>();
        yourListAllFilesButFilterFoldersMethod(files, filePath, acceptedFolders)
        return files.toArray(new Resource[0]);
      }
    }
    
    <bean id="resources" class="de.langmi.spring.batch.examples.playground.resource.FiltersFoldersResourceFactory" factory-method="getInstance">
        <constructor-arg name="filePath" type="java.lang.String" value="${filePath}" />
        <constructor-arg name="acceptedFolders" type="java.util.List" value="${acceptedFolders}" />
    </bean>
    

    a working example is available on my github repo at https://github.com/langmi/spring-batch-examples/tree/master/playground/src/main/resources/spring/batch/job, check file-multiresourcepartitioner-filter-folders-factory-job.xml

    you can pick the method to set the Resources array from List all files from a directory recursively with Java and similar solutions across the net, only thing left is the filter, there is one solution in the link provided

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following configuration file for NHibernate : <?xml version=1.0 encoding=utf-8 ?> <hibernate-configuration
I have a configuration file in the following JSON format: { key1: value1, key2:
I have a spring beans configuration file where I define the following jackson classes
I have the following configuration (shortened) in the dependencies file of my Play! application:
I have the following declared in my spring security configuration file ( http://www.springframework.org/schema/security/spring-security-2.0.1.xsd ):
Lets assume that I have the following configuration in my conf/InjectionConfig.groovy file: x {
I have the following code in my configuration file to establish the root path
I have the following configuration file for WCF service. There is a host defined
Man's manual have the following Specify the configuration file to use; the default is
I have following configuration file - <hibernate-configuration> <session-factory name=HibernateSessionFactory> <property name=hibernate.connection.driver_class>com.mysql.jdbc.Driver</property> <property name=hibernate.connection.password>mysql</property> <property

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.