datastax / cassandra-quarkus

An Apache Cassandra(R) extension for Quarkus
Apache License 2.0
40 stars 28 forks source link

Provide automatic Mapper and Dao beans registration #113

Closed adutra closed 3 years ago

adutra commented 4 years ago

Currently we require from users to write some boilerplate code to register Dao beans:

public class FruitDaoProducer {

  private final FruitDao fruitDao;

  @Inject
  public FruitDaoProducer(QuarkusCqlSession session) {
    FruitMapper mapper = new FruitMapperBuilder(session).build();
    fruitDao = mapper.fruitDao();
  }

  @Produces
  @ApplicationScoped
  FruitDao produceFruitDao() {
    return fruitDao;
  }
}

It would be nice if we could detect all interfaces annotated with @Mapper and @Dao and automatically expose all the Dao implementations.

This may be related to #112.

┆Issue is synchronized with this Jira Task by Unito

adutra commented 4 years ago

This may prevent Daos from being parameterized by keyspace or table.