JavaSpring事务性(传播=propagation.REQUIRES_NEW)错误com。太阳代理$Proxy60
使用Spring批处理,我有一个包含2个方法的类。其中一个具有事务性注释。 尝试运行批处理时,我收到一个错误: 自动连线依赖项的注入失败;嵌套的例外是java。lang.IllegalArgumentException:com。太阳代理$Proxy60
背景。xml:
<batch:job id="data-update" parent="raptorBaseJob">
<batch:step id="load-info" parent="raptorBaseStep">
<tasklet ref="loadInfoTasklet" />
<batch:next on="COMPLETED" to="update-info" />
</batch:step>
<batch:step id="update-info" parent="raptorBaseStep">
<tasklet ref="updateInfoTasklet" />
</batch:step>
</batch:job>
loadInfoTasklet。爪哇:
@Component
public class LoadInfoTasklet implements Tasklet {
@Autowired
private InfoManager infoManager;
@Trace
@Override
public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {
try {
infoManager.load();
} catch(Exception ex) {
stepContribution.setExitStatus(new ExitStatus("FAILED_LOADING"));
}
return RepeatStatus.FINISHED;
}
}
UpdateInfo Tasklet。爪哇:
@Component
public class UpdateInfoTasklet implements Tasklet{
@Autowired
private InfoManager infoManager;
@Trace
@Override
public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {
try {
infoManager.update();
} catch (Exception ex) {
stepContribution.setExitStatus(new ExitStatus("FAILED"));
}
return RepeatStatus.FINISHED;
}
}
信息经理。爪哇:
@Component
public class InfoManager {
@Autowired
private NameInfo namesInfo;
protected List<String> names;
@Trace
public void load() throws Exception {
names = namesInfo.getNames();
}
@Trace
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void update() {
System.out.println("Updating...");
}
}
完整堆栈错误消息:
12:40:54.071 [main] ERROR o.s.b.c.l.s.CommandLineJobRunner - Job Terminated in error: Error creating bean with name 'loadInfoTasklet': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private InfoManager LoadInfoTasklet.infoManager; nested exception is java.lang.IllegalArgumentException: Can not set infoManager field LoadInfoTasklet.infoManager to com.sun.proxy.$Proxy60
共 (0) 个答案