springboot之springbatch入门,2024Java研发必问高级面试题

org.hibernate

hibernate-validator

org.springframework.boot

spring-boot-starter-test

test

org.springframework.batch

spring-batch-test

test

application.properties

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/数据库名?useUnicode=true&characterEncoding=utf-8&useSSL=false

spring.datasource.username=用户名

spring.datasource.password=密码

spring.datasource.driver-class-name=com.mysql.jdbc.Driver

server.port=9001

#启动时要执行的Job,默认执行全部Job

spring.batch.job.names = importJob

#是否自动执行定义的Job,默认是

spring.batch.job.enabled=true

#是否初始化Spring Batch的数据库,默认为是

spring.batch.initializer.enabled=true

spring.batch.initialize-schema=ALWAYS

#spring.batch.schema=

#spring.batch.table-prefix= #设置SpringBatch的数据库表的前缀

spring.main.allow-bean-definition-overriding=true

resource下创建person.csv

Person

package com.hlvy.entity;

import java.io.Serializable;

/**

  • @author heng

  • @since 2019-06-03

*/

public class Person implements Serializable {

private static final long serialVersionUID = 1L;

private Integer id;

private String name;

private Integer age;

private String nation;

private String address;

public Integer getId() {

return id;

}

public void setId(Integer id) {

this.id = id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public Integer getAge() {

return age;

}

public void setAge(Integer age) {

this.age = age;

}

public String getNation() {

return nation;

}

public void setNation(String nation) {

this.nation = nation;

}

public String getAddress() {

return addr

  • 10
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值