Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已将我的作业 xml 放在 spring/batch/jobs 目录中,并且可以通过单击启动按钮从控制台启动作业。我希望在部署管理控制台的 Tomcat 实例启动时启动该作业。谢谢。
要在启动时启动作业,请创建一个在其构造函数或 init 方法中启动作业的 bean。从那里开始,如果您在 Spring 中将其配置为 bean,默认情况下它将是一个单例,创建一次,因此一旦上下文准备好就启动作业。