首页 > 其他分享 >Spring Batch中Listener配置

Spring Batch中Listener配置

时间:2023-02-16 23:14:42浏览次数:51  
标签:Spring 配置 Batch Listener 子类 父类

记录开发过程遇到的一些问题。

1. extends ItemListenerSupport

参照官方文档

  1.1 直接继承并配置到Step并不起作用,需要注解标记

   1.2 父类声明中存在泛型,子类指明具体类型后通过反射找方法签名,会得到参数不同的相同方法(一个父类中的,一个子类中的)

父类:

 子类:

 结果:

 推荐还是各自定义ItemReadListener, ItemProcessListener, ItemWriteListener。

 

标签:Spring,配置,Batch,Listener,子类,父类
From: https://www.cnblogs.com/hello-yz/p/17128625.html

相关文章

  • SpringCloudGateway启动报错解决
    报错启动项目后报错,提示如下2023-02-1621:51:35.786ERROR[main]o.s.boot.diagnostics.LoggingFailureAnalysisReporter.report:40-***************************APP......
  • 基于springboot实现SSM整合
    (1)SpringBoot整合Spring(不存在)(2)SpringBoot整合SpringMVC(不存在)(3)SpringBoot整合MyBatis(主要)一、新建springboot项目。  在application.yml配置文件中添加数据源......
  • Spring 整合 RabbitMQ
    Spring整合RabbitMQ创建spring项目引入pompom依赖<?xmlversion="1.0"encoding="UTF-8"?><projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns......
  • SpringMVC07 - RESTful
    RESTful简介REST:RepresentationalStateTransfer,表现层资源状态转移。①资源资源是一种看待服务器的方式,即,将服务器看作是由很多离散的资源组成。每个资源是服务器上一......
  • SpringMVC08 - 处理ajax请求
    SpringMVC处理ajax请求@RequestBody@RequestBody可以获取请求体信息,使用@RequestBody注解标识控制器方法的形参,当前请求的请求体就会为当前注解所标识的形参赋值<!--此......
  • 引入spring-cloud-starter-bootstrap但不建bootstrap文件,导致nacos config 报错.longP
    使用SpringCloud添加了一个新服务,上线报错:[ERROR]2023-02-1612:40:29785[com.alibaba.nacos.client.config.http.ServerHttpAgent][com.alibaba.nacos.client.Worke......
  • springboot整合junit
    packagecom.itheima1;importcom.itheima.Springboot07TestApplication;importcom.itheima.service.BookService;importorg.junit.jupiter.api.Test;importorg.s......
  • SpringMVC源码(八):Controller控制器执行流程
    在MVC请求流程中,获取到HandlerAdapter适配器后,会执行handler处理器(Controller控制器)的相关逻辑,通过适配器的handle()方法,完成目标Controller处理器的调用。在源码(七......
  • spring security学习笔记
    1.创建springboot工程,添加lombok插件2.引入springsecurity包3.引入MybatisPuls和mysql驱动包 4.密码加密存储 5.PreAuthorize("hasAuthority('test'......
  • springboot多环境开发兼容问题(Maven和boot)
    <?xmlversion="1.0"encoding="UTF-8"?><projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:sch......