spring-batch - 如何验证 Reader 中的参数以进行查询
问题描述
我需要在阅读器中验证我的查询的参数,我在 RunConfiguration 中发送参数,我给你我的代码工作,感谢你的帮助(我用“*”谴责部分代码用于数据保护)
<bean class="**.*****.absis.batch.arch.internal.reader.***ItemReader" id="readerBBDD_Step1">
<property name="dataSource" ref="appDataSource"></property>
<property name="sql" value="select conf.repte, imp.IMPREPTE1 , imp.IMPREPTE2, imp.IMPREPTE3,imp.IMPREPTE4,imp.IMPREPTE5,imp.IMPREPTE6, subrepte, negocio, asignacion, tipus, origen from **************BATCH0003 conf inner join
TDE_IMPORTREPTES_BATCH0003 imp on CONF.REPTE = imp.repte
where conf.anyo = imp.anyo and conf.repte = '****' and esquema = '*****' and tipus='${param1}'" ></property>
<property name="rowMapper">
<bean class="****.****.absis.batch.arch.internal.reader.****sBaseRowMapper">
<property name="rowMapper">
<bean class="***.***.absis.batch.app.****.util.MapperStep1"></bean>
</property>
</bean>
</property>
</bean>
我的目标是控制参数1
解决方案
我在 RunConfiguration 中发送参数
您可以将param1
作为参数传递给您的作业并使用JobParametersValidator
.
然后,一旦它被验证,它可以通过以下方式传递给您的读者:
tipus='#{jobParameters[param1]}'
希望这可以帮助。
推荐阅读
- android - androidx 包未导入。(灰色。像未使用的进口)
- python - 如何遍历数据框中的列表?
- docker - Docker从文件中编写构建时间参数
- python - Python - 通过用户定义的函数解析 JSON 数据
- java - 用于登录的 WebSecurityConfigurerAdapter 的配置
- php - 为什么“single-{custom-posttype}.php”不起作用?
- python - 用于显示高值范围差异的 Python Colormap
- elasticsearch - Kibana“可用字段”未显示数组内的(字符串)字段
- microsoft-dynamics - Windows 重新启动后运行 Microsoft Dynamics NAV 实例但没有响应
- java - 实例化 groovy 类的正确方法