我已经成功地设置了spring-batch-admin示例项目。现在我开始将我的自定义bean注入到项目阅读器、项目处理器等中。
我已经在WEB-INF内的applicationContext.xml中定义了我的自定义bean。但在运行作业时,我仍然得到No bean命名为已定义的异常。
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;
}
}我在applicationContext.xml中定义了servlet bean,并将其包含在TestAutoWire -config.xml文件中。
任何帮助都将不胜感激。感谢并致以问候
发布于 2016-04-20 00:08:30
确保您的TestReader bean与TestAutoWire bean位于相同的应用程序上下文中。如果不看你的上下文文件,我不能提供更多。
https://stackoverflow.com/questions/36723156
复制相似问题