我一直在尝试进行设置,在其中创建实现 JdbcCursorItemReader 的 PostDatedAchInReader,然后将其注入 PostDatedAchInAggregatingJdbcItemReader,后者根据特定条件收集读取对象并将它们分组到一个列表中,基本上按客户端 ID 保留所有 ach 请求组。但是,我不断收到没有合格的 bean 错误,但 bean 在这里并已定义。我很困惑问题是什么或如何解决它。所以我有以下配置文件@Configurationpublic class PostDatedAchInBatchConfig extends AbstractCommonBatchJobConfig { private static final String ACH_FULFILLMENT_POST_DATED_ACH_IN_STEP1_NAME = "achFulfillment_postDatedAchInJob_step1_scheduleAchIns"; @Autowired DataSource prodDataSource; /** * This method defines the Job. * * @return postdatedachinjob * return the configured job. */ @Bean(name = "achFulfillmentPostDatedAchInJob") public Job job() throws Exception { mmLogMgr.info("AchFulfillmentEmailBatchConfig : job"); return getJobBuilderFactory().get("achFulfillmentPostDatedAchInJob") .listener(postDatedAchInListener()) .start(step1()) .on(ExitStatus.COMPLETED.getExitCode()) .end() // end of TransactionBuilder .end() // end of FlowBuilder .build(); }.. /** * @return postDatedAchInAggregatingJdbcItemReader. */ @Bean @Scope(value = "step", proxyMode = ScopedProxyMode.DEFAULT) public ItemReader<ArrayList<PostDatedAchIn>> postDatedAchInAggregatingJdbcItemReader(@Qualifier("postDatedAchInReader") final PostDatedAchInReader postDatedAchInReader) throws Exception { PostDatedAchInAggregatingJdbcItemReader postDatedAchInAggregatingJdbcItemReader = new PostDatedAchInAggregatingJdbcItemReader(); postDatedAchInAggregatingJdbcItemReader.setDatabaseItemReader(postDatedAchInReader); return postDatedAchInAggregatingJdbcItemReader; }我很困惑它如何说它在类中定义时找不到该类型的 bean。我怎样才能解决这个问题?
1 回答
慕虎7371278
TA贡献1802条经验 获得超4个赞
因此,我们能够通过在步骤配置中更改对聚合读取器的调用以发送游标读取器的方法/bean 来解决此问题。我们改变了这一行:
.reader(postDatedAchInAggregatingJdbcItemReader(postDatedAchInReader()))
并删除了@Qualifier。这停止了这个错误,它确实正确地连接了所有东西。对我来说感觉有点笨重,但它有效。如果有人有其他解决方案,我愿意接受其他解决方案。
添加回答
举报
0/150
提交
取消