【问题标题】:How to inject JOOQ's DSLcontext in Kotlin class如何在 Kotlin 类中注入 JOOQ 的 DSLcontext
【发布时间】:2018-04-13 06:09:38
【问题描述】:

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

它抛出以下异常:

someRepository 中的字段 dslContext 需要 org.jooq.DSLContext 类型的 bean,但无法找到。

注入看起来像这样:

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

}

干杯, 翁德瑞

【问题讨论】:

  • 我怀疑这个问题需要更多的上下文。你的完整配置是什么?您的注射剂DSLContext 配置在哪里?
  • 我遵循了 jooq kotlin 示例和 jooq spring boot 示例。我将创建一个小示例项目来演示我的问题。

标签: spring kotlin jooq


【解决方案1】:

正如 Lukas Eder 指出的那样,我的配置有误。在我向 pom.xml 文件添加以下依赖项后,它开始工作:

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

感谢您的帮助, 翁德瑞

【讨论】:

    猜你喜欢
    • 2020-10-02
    • 2021-10-19
    • 1970-01-01
    • 2015-03-02
    • 1970-01-01
    • 2023-02-23
    • 2021-07-22
    • 2021-08-03
    • 1970-01-01
    相关资源
    最近更新 更多