I'm trying to use jOOQ in my Micronaut application, and have the jOOQ DSLContext automatically provided as an injected bean to my constructor, but it is failing to find the bean.
I've configured my datasources in my application.yml to connect to my postgres db, and have declared my constructor as follows:
@Singleton
public class RepositoryImpl implements Repository
{
private final DSLContext context;
public RepositoryImpl(DSLContext context)
{
this.context = context;
}
}
and my application.yml as:
datasources:
default:
url: "jdbc:postgresql://localhost:5432/my_db"
username: "user"
password: "password"
driver-class-name: "org.postgresql.Driver"
I've included the following dependencies in my build.gradle
compile 'io.micronaut.configuration:micronaut-jooq'
runtime 'org.postgresql:postgresql:42.2.4'
I would expect that I can access the DSLContext and write queries within my RepositoryImpl class, but upon trying to use the implementation class, the code fails with the following exception:
Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [org.jooq.DSLContext] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Has anyone been able to successfully have this bean used as described in the micronaut-sql guide here? https://micronaut-projects.github.io/micronaut-sql/snapshot/guide/index.html#jooq