Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class XmlParsingApplication {
public StaxEventItemReader itemReader() throws Exception {
StaxEventItemReader reader = new StaxEventItemReader<>();
reader.setResource(new ClassPathResource("all_members.xml"));
Jaxb2Marshaller unmarshaller = new Jaxb2Marshaller();
unmarshaller.setClassesToBeBound(ClubMember.class, Membership.class);
return reader;
public CustomProcessor customProcessor() {
return new CustomProcessor<ClubMember, ClubMember>() {
//makes a network call with the club member's information
//to get the member's birthday
//and then sets the birthday attribute on the member to that birthday
public ItemWriter itemWriter() {
return new ItemWriter() {
public void write(List<? extends ClubMember>; items) throws Exception {
for (ClubMember item : items) {
System.out.println("item.getName() + 's birthday is " + item.getBirthdate());
public JobBuilderFactory jobBuilderFactory;
public StepBuilderFactory stepBuilderFactory;
public Job job() throws Exception {
return jobBuilderFactory.get("job")
.<ClubMember, ClubMember>chunk(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment