Программисты JAVA общаются здесь
-
Anonymous
Как получить доступ к параметрам задания из ItemReader в Spring Batch?
Сообщение
Anonymous »
Это часть моего job.xml:
Это программа чтения элементов:
Код: Выделить всё
import org.springframework.batch.item.ItemReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component("foo-reader")
public final class MyReader implements ItemReader {
@Override
public MyData read() throws Exception {
//...
}
@Value("#{jobParameters['fileName']}")
public void setFileName(final String name) {
//...
}
}
Вот что говорит Spring Batch во время выполнения:
Код: Выделить всё
Field or property 'jobParameters' cannot be found on object of
type 'org.springframework.beans.factory.config.BeanExpressionContext'
Что здесь не так? Где я могу прочитать больше об этих механизмах в Spring 3.0?
Подробнее здесь:
https://stackoverflow.com/questions/607 ... ring-batch
1761822352
Anonymous
Это часть моего job.xml:
[code]
[/code]
Это программа чтения элементов:
[code]import org.springframework.batch.item.ItemReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component("foo-reader")
public final class MyReader implements ItemReader {
@Override
public MyData read() throws Exception {
//...
}
@Value("#{jobParameters['fileName']}")
public void setFileName(final String name) {
//...
}
}
[/code]
Вот что говорит Spring Batch во время выполнения:
[code]Field or property 'jobParameters' cannot be found on object of
type 'org.springframework.beans.factory.config.BeanExpressionContext'
[/code]
Что здесь не так? Где я могу прочитать больше об этих механизмах в Spring 3.0?
Подробнее здесь: [url]https://stackoverflow.com/questions/6078009/how-to-get-access-to-job-parameters-from-itemreader-in-spring-batch[/url]