2016-04-19 36 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位於相同的應用程序上下文中。沒有看到你的上下文文件,我不能提供更多。

相關問題