JDBI 错误没有为类型注册映射器

JDBI erro No mapper registered for type

我正在尝试创建一种方法,使我的数据库中 return 来自客户 table 的所有用户,但此代码:

    try {
        List<Customer> customer = jdbi.open().createQuery("SELECT * FROM customer")
        .mapTo(Customer.class).list();
    } catch (Exception e) {
        System.out.println(e);
    }

return 错误:

org.jdbi.v3.core.mapper.NoSuchMapperException: No mapper registered for type com.customer.Customer

我看到另一个 post 这个错误,他们说这个错误的发生是因为 class 模型和数据库 table 之间的映射,但我的应用程序是内置的纯 java 和 JDBI 3 我没有使用 Spring 那么如何映射此代码的结果以将此结果转换为客户列表?

我修复了这个创建这个 class

public class CustomerMapper implements RowMapper<Customer>{

  @Override
  public Customer map(ResultSet rs, StatementContext ctx) throws SQLException {
    return new Customer(rs.getInt("id"), rs.getString("uuid"), rs.getString("name"), rs.getString("email"), rs.getString("birthDate"), rs.getString("cpf"), rs.getString("gender"), rs.getDate("createdAt"), rs.getDate("updateAt"));
  }
}

.mapTo(Customer.class).list(); 我把 .map(new CustomerMapper()).list(); 放在哪里引用我创建的地图