0

I am working on a simple app that will allow a user to upload a .csv file through a reactjs client and store it in a mysql database. I found a few tutorials on how to do something similar online (https://spring.io/guides/gs/batch-processing/) but they all use .csv files that are locally saved in the project directories. I have experience designing a RESTful interface using Spring Boot and it looks like Spring Batch is easy enough to figure out but what I don't know how to do is:

  1. Call a Spring Batch application from my existing Spring Boot application
  2. Pass along a .csv file from the client's drive to the Spring Batch app

Do I have to upload the .csv file from the client's drive to the server that the Spring Batch(or Spring Boot) app is being run on? If so, is there a hosting service that would allow me to host a single .csv file AND my Spring applications?

1
  • For accepting CSV file from client, you can create rest API, for loading file, i would suggest use MySQL inbuilt functionality "LOAD DATA INFILE" call through your application which will be more faster compared to Spring Batch if you are not doing Business processing as such on csv file data. Commented Dec 19, 2019 at 23:01

2 Answers 2

1

You don't need two separate applications - you can embed your Spring Batch jobs/steps in a Spring Boot app.

You will need to create an endpoint that receives a multi-part file upload to store the CSV file somewhere. Otherwise your batch steps will have nothing to process. You could store that file on the application server's hard drive, or in a hosted storage solution like Amazon S3.

Sign up to request clarification or add additional context in comments.

Comments

0

Of course, csv is very simple format, but anything there are convenient libraries which can do all work 'from the box'. Look at OpenCSV ... it can read csv from stream and you can customize it with CSVReader, for example, reading line by line from db or get large block with data. I think it's most powerful library for working with CSV format.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.