0
votes

i have successfully setup spring-batch-admin sample project. Now i started injecting my custom beans into itemreader, itemprocessor etc.

I have defined my custom bean in applicationContext.xml inside WEB-INF. But still while running job i am getting No bean named defined exception.

TestReader.java

import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.NonTransientResourceException;
import org.springframework.batch.item.ParseException;
import org.springframework.batch.item.UnexpectedInputException;
import org.springframework.beans.factory.annotation.Autowired;

public class TestReader implements ItemReader<String>{

    @Autowired
    private TestAutoWire testAutoWire;

    @Override
    public String read() throws Exception, UnexpectedInputException,
            ParseException, NonTransientResourceException {
        // TODO Auto-generated method stub
        System.out.println("test");
        return null;
    }
}

TestAutoWire bean i have defined in applicationContext.xml and it is being included in servlet-config.xml file.

Any help will be greatly appreciated. Thanks and Regards

1

1 Answers

0
votes

Make sure your TestReader bean is in the same application context as your TestAutoWire bean. Without seeing your context files, I can't offer much more.