使用 queryForObject() 方法检索计数时,JDBCTemplate 中的参数索引超出范围(1 > 参数数量,即 0)

Parameter index out of range (1 > number of parameters, which is 0) in JDBCTemplate while retrieving count from with queryForObject() method

我正在尝试使用 jdbctemplate.queryForObject(query,Object[]{},Integer.class) 方法获取行数,我在 mysql.properties 文件中定义了查询并传递了一个object[] 的参数但仍然出现异常,请帮助

 mysql.properties :
    getCustomerRows=SELECT count(cm.`customer_master_id`) FROM customer_master cm WHERE cm.branch_code =?;
  CustMasterDaoImpl :
    private @Value("${getCustomerRows") String getCustomerRows;
    @Override
    public Integer getCustomerRows(Integer branchCode) {
        try {


            return getJdbcTemplate().queryForObject(getCustomerRows,new Object[] {branchCode},Integer.class) ;
        }catch (Exception e) {
            logger.error("select Query failed : " + e.getMessage());
            System.out.println("catch ::: " + e.getMessage());
            e.printStackTrace();
            return 0;
        }
    }

Exception :

org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [${getKycComplinedCustomerRowsNonIndividual]; Parameter index out of range (1 > number of parameters, which is 0).; nested exception is java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

我发现了这个错误,实际上,我没有为变量 getCustomerRows 正确地设置值 @Value 注释,@Value 注释中缺少右花括号,它给出了 (in这种情况)java.sql.SQLException: Parameter index out of range.异常