我创建了一个简单的ItemReader:
public class SimpleReader extends AbstractItemReader {
@Inject @BatchProperty
private String number;
@Inject
JobContext jobContext;
@Override
public Object readItem() throws Exception {
// .....
}
}
当我将此代码部署到JBoss EAP 6时,我得到以下注入错误:
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies
for type [String] with qualifiers [@BatchProperty] at injection point
[[field] @Inject @BatchProperty private ....SimpleReader.number]
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies
for type [JobContext] with qualifiers [@Default] at injection point
[[field] @Inject ....SimpleWriter.jobContext]
如果我理解正确,当Weld开始注射时,Spring-Batch尚未初始化。如何初始化Spring-Batch,以便这种注入有效?