如何在Kotlin类中注入JOOQ的DSLcontext
我用Kotlin,Spring和PostgreSQL使用JOOQ。 我能够运行JOOQ生成器和查询数据。 问题是我无法在资源库类的构造函数中注入DSLcontext。
它抛出以下异常:
dslContext
中的字段dslContext
需要一个无法找到的类型为org.jooq.DSLContext
的bean。
注射看起来像这样:
@Repository class SomeRepositoryImpl(private val dslContext: DSLContext): SomeRepository { }
干杯,翁德里
卢卡斯·艾德指出,我的配置错误。 在向pom.xml文件添加以下依赖项后,它开始工作:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jooq</artifactId> </dependency>
感谢您的帮助,Ondrej