spring 网络和 spring 批处理兼容性?

spring web and spring batch compatibility?

我在公司有一个项目是运行 spring web,他们问我要一个批处理作业,他们想在其中实现spring 批处理。我试图详细说明它,但它总是给我一个错误 The web server cannot be started。 我想知道 spring web 是否与 spring batch 运行 在同一个项目中同时兼容

是的,它们兼容。你能post你得到的错误吗?

顺便说一下,如果可能的话,考虑在你的项目上使用@Schedule。

@Scheduled(fixedRate = 1000)
public void executeJob() {

}

在某些情况下,它可以解决问题,您无需放置中间件来增加业务的复杂性。