我目前正在开发一个 Spring Batch,它在第一步中将 Excel (.xsls) 文件转换为 CSV,然后读取 CSV,处理它并将其数据存储在数据库中。第一步效果很好。批处理在第二步停止并抛出此警告:Input resource does not exist class path resource [C:/work/referentielAgenceCE.csv]。在我的代码之后:
spring-config.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:aop="http://www.springframework.org/schema/aop"
xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-2.1.xsd">
<!-- import config Spring générale -->
<import resource="classpath*:spring/***-batch-spring.xml" />
<bean id="pathFichier" class="java.lang.String">
<constructor-arg value="${batch.referentielAgenceCE.inputFilePathCSV}" />
</bean>
<batch:job id="simpleFileImportJob" xmlns="http://www.springframework.org/schema/batch">
<batch:step id="convertStep" next="processingStep">
<batch:tasklet ref="convert"/>
</batch:step>
<batch:step id="processingStep">
<batch:tasklet>
<batch:chunk reader="agenceCEReader" processor="agenceCEProcessor" writer="agenceCEWriter"
commit-interval="5" />
</batch:tasklet>
</batch:step>
</batch:job>
<bean id="convert"
class="com.***.referentielAgenceCE.convertTasklet.convertXLSXtoCVS" />
<!-- Reader -->
<bean id="agenceCEReader" scope="step" …Run Code Online (Sandbox Code Playgroud)