开发者

Load jobs at startup to Spring Batch Admin

From the Spring Batch Admin documentation, it mentioned that jobs w开发者_JAVA百科ill be loaded if job configuration file is located in classpath under META-INF/spring/batch/jobs/*.xml

Documentation

In the spring-batch-admin-sample that comes with STS, the jobs are loaded when the admin web application is deployed, under the file classpath:\META-INF\batch\module-context.xml And it is bootstrapped at deployment. Not sure how that works...

While I can load the job configuration by uploading in the user interface, http://localhost:8080/simple-batch-admin/configuration, some of my custom beans were not autowired for some reason. So the desirable behavior would be to load all the jobs when Admin is deployed.

Thank you in advance.


After several round of digging, I was able to load the job file. I have to place my job file in /META-INF/spring/batch/jobs/ folder not /META-INF/batch/ Also, in order for my jobLauncher, jobRepository, dataSource, etc. to get discover at load time. I have to put it in src/main/resources/META-INF/spring/batch/spring/batch/bootstrap/**/

All because of two files in spring-batch-admin-resources-1.2.0.RELEASE.jar in org.springframework.batch.admin.web.resources

servlet-config.xml

<import resource="classpath*:/META-INF/spring/batch/servlet/resources/*.xml" />
<import resource="classpath*:/META-INF/spring/batch/servlet/manager/*.xml" />
<import resource="classpath*:/META-INF/spring/batch/servlet/override/*.xml" />

which allows me to add menu and controller under the src/main/resources/META-INF/spring/batch/servlet/override/*xml

and

webapp-config.xml

<import resource="classpath*:/META-INF/spring/batch/bootstrap/**/*.xml" />
<import resource="classpath*:/META-INF/spring/batch/override/**/*.xml" />

where I put my launch context

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜