如何在int-jdbc:outbound-gateway?
中为s查询属性注入sql背景: 我收到一个带有where子句的amqp消息,用于查询表并执行一些逻辑。 where子句可以是(' ca',' ma)或zipcode =' 01760' 是否有使用int-jdbc的示例:outbound-gateway传递可根据收到的消息更改的查询?
例如: 我们收到amqp消息: 1:{" whereClause":"陈述(' ca',' ma')"} 2:{" whereClause":" id = 1"}
如何在int-jdbc:outbound-gateway中注入查询prop,如下所示?
query =" SELECT id FROM account in(' ca',' ma')" query =" SELECT id FROM account其中id = 1"
答案 0 :(得分:2)
不,你不能用开箱即用的Spring Integration JDBC组件做到这一点。
query
属性为final
,无法在运行时更改。
考虑使用<service-activator>
直接使用JdbcTemplate.query()
。