Created
August 17, 2014 10:48
-
-
Save toshi0383/f7d5b1b74946238b18f0 to your computer and use it in GitHub Desktop.
Spring Batch 動かしてみた ref: http://qiita.com/toshi0383/items/afbb505cdb99636a6d05
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── batch | |
│ └── BatchConfiguration.java | |
└── hello | |
├── Application.java (main) | |
├── Person.java | |
└── PersonItemProcessor.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── batch | |
│ ├── Application.java | |
│ └── BatchConfiguration.java | |
└── hello | |
├── Person.java | |
└── PersonItemProcessor.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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