如何在Kotlin类中注入JOOQ的DSLcontext

时间:2017-10-31 23:47:37

标签: spring kotlin jooq

我正在使用JOOQ与Kotlin,Spring和PostgreSQL。我能够运行JOOQ生成器和查询数据。问题是我无法在存储库类构造函数中注入DSLcontext。

抛出以下异常:

someRepository中的字段dslContext需要找不到找不到的org.jooq.DSLContext类型的bean。

注射看起来像这样:

@Repository
class SomeRepositoryImpl(private val dslContext: DSLContext): SomeRepository
{

}

干杯, 的Ondrej

1 个答案:

答案 0 :(得分:1)

Lukas Eder指出,我有一个错误的配置。在我将以下依赖项添加到pom.xml文件后,它开始工作:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-jooq</artifactId>
</dependency>

感谢您的帮助, 的Ondrej

相关问题