Spring integration ExpressionEvaluationSqlParameterSourceFactory中静态方法参数的语法正确

Spring integration ExpressionEvaluationSqlParameterSourceFactory中静态方法参数的语法正确,spring-integration,Spring Integration,当作为参数传递给ExpressionEvaluationSqlParameterSourceFactory时,用于引用静态函数调用的字符串表达式的正确语法是什么 例如,我有一个静态函数,它在实用程序类中返回java.util.Date: public class DateTimeUtils { private DateTimeUtils() {throw new IllegalStateException("Utility class");} public static Date c

当作为参数传递给ExpressionEvaluationSqlParameterSourceFactory时,用于引用静态函数调用的字符串表达式的正确语法是什么

例如,我有一个静态函数,它在实用程序类中返回java.util.Date:

public class DateTimeUtils {

  private DateTimeUtils() {throw new IllegalStateException("Utility class");}

  public static Date currentDeliveryDate() {

    ZonedDateTime today = ZonedDateTime.now(ZoneOffset.UTC);

    return new DateTime(
        today.getYear(),
        today.getMonthValue(),
        today.getDayOfMonth(),
        5,
        0,
        0)
    .toDate();
  }
我想将该函数的结果用作SQL参数。SQL遵循以下原则:

select zip
  from delivery_status
  where delivery_date = :deliverydate
设置参数有点像这样:

public SqlParameterSourceFactory sourceFactory() {

    ExpressionEvaluatingSqlParameterSourceFactory sourceFactory =
    new ExpressionEvaluatingSqlParameterSourceFactory();

    Map<String, String> params = new HashMap<>();

    params.put("deliverydate", "#T(com.acme.util.DateTimeUtils).currentDeliveryDate()");

    sourceFactory.setParameterExpressions(params);

    return sourceFactory;
}
"T(com.acme.util.DateTimeUtils).currentDeliveryDate()"
你们谁能帮我念正确的咒语吗

干杯,大家。

必须这样工作:

public SqlParameterSourceFactory sourceFactory() {

    ExpressionEvaluatingSqlParameterSourceFactory sourceFactory =
    new ExpressionEvaluatingSqlParameterSourceFactory();

    Map<String, String> params = new HashMap<>();

    params.put("deliverydate", "#T(com.acme.util.DateTimeUtils).currentDeliveryDate()");

    sourceFactory.setParameterExpressions(params);

    return sourceFactory;
}
"T(com.acme.util.DateTimeUtils).currentDeliveryDate()"

T
接线员面前没有英镑符号。

我真不敢相信你们这么快就回复了!谢谢你,阿泰姆。原来我混淆了JdbcPollingChannelAdapter上的setSelectSqlParameterSource和setUpdateSqlParameterSourceFactory。我只是一个愚蠢的新手,在错误的函数上寻找结果。干杯