2016-04-19 34 views
0

我已成功安装spring-batch-admin示例项目。现在我开始将自定义bean注入itemreader,itemprocessor等。在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; 
    } 
} 

TestAutoWire豆我已经在applicationContext.xml中定义,并且它被包含在servlet的config.xml文件。

任何帮助将不胜感激。 感谢和问候

回答

0

确保您的TestReader bean与您的TestAutoWire bean位于相同的应用程序上下文中。没有看到你的上下文文件,我不能提供更多。

相关问题