Skip to content

Instantly share code, notes, and snippets.

@toshi0383
Created August 17, 2014 10:48
Show Gist options
  • Save toshi0383/f7d5b1b74946238b18f0 to your computer and use it in GitHub Desktop.
Save toshi0383/f7d5b1b74946238b18f0 to your computer and use it in GitHub Desktop.
Spring Batch 動かしてみた ref: http://qiita.com/toshi0383/items/afbb505cdb99636a6d05
.
├── batch
│   └── BatchConfiguration.java
└── hello
├── Application.java (main)
├── Person.java
└── PersonItemProcessor.java
.
├── batch
│   ├── Application.java
│   └── BatchConfiguration.java
└── hello
├── Person.java
└── PersonItemProcessor.java
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
List<Person> results =
ctx.getBean(JdbcTemplate.class)
.query("SELECT first_name, last_name FROM people",
(ResultSet rs, int row) -> {
return new Person(rs.getString(1), rs.getString(2));
}
);
System.out.println(results.size() + " Persons was found.");
for (Person person : results) {
System.out.println("Found <" + person + "> in the database.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment