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 8557077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:29:37+00:00 2026-06-11T15:29:37+00:00

I am getting a list of items in my reader. There is a property

  • 0

I am getting a list of items in my reader.

There is a property called Code in each item object having several possible values not known to me before hand.

1) Based on the value of Codein each item, I want to write that particular item in a output file pertaining to that Code. For e.g. if my current item’s Code is “abc”, the item should be written in to abc.txt in the writer.

2) If there is a Code “xyz” in current item, for which the file is not present, a new file should get created and the item should go to that file.

3) For all such multiple files created based on Code, I also want to add a header and footer call back to enter some details e.g. count of items in each file.

Is it possible to have a writer, which satisfies above 3 requirements ?

I know that using multiresourceitemwriter, one can divide the data among multiple output files. But as far as I know, this division is based on the number of items. For e.g. first 10 items in file1, next 10 in file2 and so on.

But how to route data to output files based on an item property as mentioned in my question ?

I am well acquainted with Spring Batch and just need a little guidance since this is the first time I am facing this kind of issue.

Thanks for reading!

  • 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-06-11T15:29:38+00:00Added an answer on June 11, 2026 at 3:29 pm

    i would try it with at least 2 strategies

    1. the batch writes all data into a temporary database table and simple tool/batch/script creates the individual files – i’m not sure about header/footer but as always one could say “let’s keep it cheap”
    2. the itemWriter creates and manages the needed writers on the fly, maybe with an abstract pre-configured writer/bean as template, as long as you ignore restart scenarios it sounds “easy”
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble getting click events from list items. In this page: http://bec-systems.com/list-click.html The
I am getting from database list of items ordered by descending date. I use
I have the code below for getting a list of child processes on windows
Im getting the following error for the piece of code below : expression list
I have an unordered list and each of the item in the ul has
I am having issues with retrieving list items from a different site collection. I
So far I've got scrolling list items on click using the code below: $('li#news-back').click(function(){
When getting a list of items via a json call is it better to
I have a question - I'm using CURL and PROXY. I'm getting list with
I keep getting a 'List does not exist' error whenever I try and use

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.