更新到 jOOQ 3.15.0 后如何修复"Consider defining a bean of type 'org.jooq.DSLContext' in your configuration



在我的Vaadin和Spring Boot应用程序中,我已经从jOOQ 3.14.12更新到3.15.0。更新后,我的应用程序不会再次启动。这是我得到的错误:

***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in org.komunumo.data.service.MemberService required a bean of type 'org.jooq.DSLContext' that could not be found.

Action:
Consider defining a bean of type 'org.jooq.DSLContext' in your configuration.

我不明白为什么我必须定义这个bean,因为在jOOQ 3.14.12中我不必定义。据我所知,这是由JooqAutoConfiguration自动完成的。

Spring Boot 2.6答案

对于Spring Boot 2.6,此问题不再重现,请参阅https://github.com/spring-projects/spring-boot/issues/26439

Spring Boot 2.5答案

从jOOQ 3.15.0开始,jOOQ附带了一个内置的R2DBC依赖项。Spring Boot 2.5还没有意识到这一点,因此,您必须从您的Spring Boot应用程序中明确排除R2dbcAutoConfiguration(而不是R2dbcDataAutoConfiguration!((当然,除非您将R2DBC与jOOQ一起使用(:

@SpringBootApplication(exclude = { R2dbcAutoConfiguration.class })

注意,您可能会看到以下错误消息:

没有可用的"org.jooq.DSLContext"类型的合格bean:应至少有1个bean符合autowire候选者的条件。

我在这里添加了它,因为否则,人们可能无法从谷歌找到这个答案。

相关内容

最新更新