本文采用Springbatch+Scheduler实现批处理作业
spring-batch-core-4.1.2.RELEASE
json文件格式:
[
{
id: "station0111",
title: "莘庄",
description: "莘庄",
pin: "hidden",
fill: "#4d5e6d",
x: "0.2972",
y: "0.6264",
zoom: "12",
distance: null
},
{
id: "station0112",
title: "外环路",
description: "外环路",
pin: "hidden",
fill: "#4d5e6d",
x: "0.3078",
y: "0.6162",
zoom: "12",
distance: null
}
]
1.直接上Reader,注意注释部分,都是坑
<!-- springbatch读取json文件默认为json数组,不为数组时会报错 -->
<bean id="jsonFileReader"
class="org.springframework.batch.item.json.JsonItemReader"
scope="step">
<!-- JsonItemReader截止此版本没有无参构造方法,所以不能用属性注入(<property>),只能用构造方法注入 -->
<constructor-arg name="resource"
value="file:E:/temp/lin