2
Spring 배치의 ItemReader에서 @Beforestep을 사용하는 것에 약간 혼란 스럽다.Beforestep annotation이 인수를 취하지 않는다
내가 사용하는 경우
public class MyItemReader implements ItemReader<String> {
long teller = 0L;
@BeforeStep
public void beforeStep(StepExecution se) {
}
@Override
public String read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
if(teller == 11)
return null;
return String.valueOf(++teller);
}
}
나는 예외 어떻게해야합니까 :
@BeforeStep
public void beforeStep() {
}
그러나, 첫 번째 상황에서 설명 :이 상황은 예외가 발생하지 않습니다
Caused by: java.lang.IllegalArgumentException: The method [beforeStep] on target class [MyItemReader] is incompatible with the signature [(StepExecution)] expected for the annotation [BeforeStep].
을 문서.
예상되는 내용은 무엇입니까? 그리고 어떻게 그것을 인수 목록에 추가 할 수없는 경우 SendExecution 객체를 객체에 보냅니 까? 나는 스프링 부팅 스타터 배치 1.1.6.RELEASE 사용하고
는
bean을'scope = "step"'으로 설정 했습니까? – Xstian
아니, 나는하지 않았다. 지금은 그렇게하려고했지만 여전히 같은 오류가 발생합니다. –
다음과 같이 xml을 사용할 수 있습니다 ..' ' 범위가 없으면 singleton bean을 정의합니다. –
Xstian