我在尝试运行系统时收到 SAXParserException 该标记无效。
下面是我的 xml:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch.xsd"
default-lazy-init="true">
<bean id="myItemProcessor" class="com.MyItemProcessor"/>
<bean id="myItemReader" class="com.MyItemReader"/>
<bean id="myItemWriter" class="com.MyItemWriter"/>
<batch:job id="helloWorldJob">
<batch:step id="step1">
<batch:tasklet>
<batch:chunk reader="myItemReader" writer="myItemWriter"
processor="myItemProcessor" commit-interval="10">
</batch:chunk>
</batch:tasklet>
</batch:step>
</batch:job>
以下是我不断遇到的异常:
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'batch:job'.
尝试执行以下操作,但没有成功:
1) 尝试从类路径引用 xsd
2) 尝试修改 xsd 的不同点版本。但问题仍然是一样的。
我在这里做错了什么吗?
最佳答案
替换
http://www.springframework.org/schema/batch/spring-batch.xsd
与
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-2.2.xsd
您错过了声明的一部分。
关于java - Spring 批处理 : Invalid Content was found starting with element 'batch:job' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41247100/