Spring Batch Job Scope Unavailable

穿精又带淫゛_ 提交于 2019-12-12 01:43:04

问题


It seems like the Spring Batch 3.0.6 release points to the 2.2 schema by default.

In the spring.schemas file there is this definition

http\://www.springframework.org/schema/batch/spring-batch.xsd=/org/springframework/batch/core/configuration/xml/spring-batch-2.2.xsd

And when I add this namespace to my spring file, I then get the scope="step" option (in my IDE, although IntelliJ has been pretty reliable matching runtime issues)

...
xmlns:batch="http://www.springframework.org/schema/batch"
...

But everything seems to claim that scope="job" is invalid.

Is it the spring.schemas file doing this? Why would the 3.xx iteration point back to the 2.2 schemas?

I can't seem to get a declaration like xmlns:batch="http://www.springframework.org/schema/batch/spring-batch-3.0.xsd" to work. Surprisingly that totally invalidates the batch namespace. Even though the spring.schemas file points to 3.xx like so

http\://www.springframework.org/schema/batch/spring-batch-3.0.xsd=/org/springframework/batch/core/configuration/xml/spring-batch-3.0.xsd

If I do this:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:batch="http://www.springframework.org/schema/batch"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:p="http://www.springframework.org/schema/p"
   xsi:schemaLocation="http://www.springframework.org/schema/batch
    http://www.springframework.org/schema/batch/spring-batch-3.0.xsd
    http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
      ...
 </beans>

I can then get the scope="step" to be valid, and everything seems to point to batch-3.0, but scope="job" is still invalid.

Does anyone have a clean example of importing batch & using a job scope declaration on a bean?

Thanks!

来源:https://stackoverflow.com/questions/35560555/spring-batch-job-scope-unavailable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!