Search code examples
springspring-bootspring-datajooqr2dbc

How to fix "Consider defining a bean of type 'org.jooq.DSLContext' in your configuration." after update to jOOQ 3.15.0


In my Vaadin and Spring Boot application, I have updated from jOOQ 3.14.12 to 3.15.0. After this update my application is not starting up again. This is the error I get:

***************************
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.

I don't understand why I have to define this bean, because with jOOQ 3.14.12 I did not have to. As far as I know, this is done by JooqAutoConfiguration automatically.


Solution

  • Spring Boot 2.6 answer

    With Spring Boot 2.6, this issue no longer reproduces, see https://github.com/spring-projects/spring-boot/issues/26439

    Spring Boot 2.5 answer

    Starting from jOOQ 3.15.0, jOOQ ships with a built-in R2DBC dependency. Spring Boot 2.5 is not yet aware of this, and as such, you'll have to explicitly exclude R2dbcAutoConfiguration (not R2dbcDataAutoConfiguration!) from your spring boot application (unless you're using R2DBC with jOOQ, of course):

    @SpringBootApplication(exclude = { R2dbcAutoConfiguration.class })
    

    Note, you may see the following error message:

    No qualifying bean of type 'org.jooq.DSLContext' available: expected at least 1 bean which qualifies as autowire candidate.

    Which I'm adding here, because otherwise, people might not find this answer from Google.