GithubHelp home page GithubHelp logo

Comments (3)

Okwori avatar Okwori commented on August 15, 2024 4

You can replace this method in SpringBatchConfig.java

@Bean
    public FlatFileItemReader<User> itemReader() {
        FlatFileItemReader<User> flatFileItemReader = new FlatFileItemReader<>();
        flatFileItemReader.setResource(new ClassPathResource("users.csv"));
        flatFileItemReader.setName("CSV-Reader");
        flatFileItemReader.setLinesToSkip(1);
        flatFileItemReader.setLineMapper(lineMapper());
        return flatFileItemReader;
    }

from spring-batch-example-1.

sessam avatar sessam commented on August 15, 2024

Hi TechPrimers,
Thanks for your code share, I have couple of queries, answering my queries will be appreciated.

  1. We noticed the error as below with given code base, Please take a look:
    Caused by: java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode): URL [file:/Users/apple/Downloads/spring-batch-example-1/src/main/resources/users.csv]
    at org.springframework.batch.item.file.FlatFileItemReader.doOpen(FlatFileItemReader.java:251) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]
    at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:144) ~[spring-batch-infrastructure-3.0.9.RELEASE.jar:3.0.9.RELEASE]... 76 common frames omitted
    PS: Hope you changed the file path in application.properties (I resolved this by adding mine)
    2.Currently I am running this application by hardcording the resource input, and its runnign as expected, But how can I run this application to pick the source file((~5 millions records) from shared drive location, instead of pickign from resource folder, What changes are required for it?

3.What are the changes required to switch it to other data sources(sql server). ?
Please suggest the code changes, thanks in advance.

from spring-batch-example-1.

surajarvind avatar surajarvind commented on August 15, 2024

what if i give the file from postman

from spring-batch-example-1.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.