Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 571
McPringle Avatar asked Jul 08 '21 07:07

McPringle


People also ask

What is spring boot JOOQ?

Java Object Oriented Querying (jOOQ) is a popular product from Data Geekery which generates Java code from your database, and lets you build type safe SQL queries through its fluent API. Both the commercial and open source editions can be used with Spring Boot.

Can I use scalar subselects in UPDATE statements in jOOQ?

Most databases allow for using scalar subselects in UPDATE statements in one way or another. jOOQ models this through a set (Field<T>, Select<? extends Record1<T>>) method in the UPDATE DSL API: jOOQ supports formal row value expressions in various contexts, among which the UPDATE statement. Only one row value expression can be updated at a time.

How many jOOQ beans are required to qualify as autowire candidate?

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.

Is there support for multi-table updates in jOOQ?

Support for multi-table updates will be implemented in the near future. An example update query is given here: Most databases allow for using scalar subselects in UPDATE statements in one way or another. jOOQ models this through a set (Field<T>, Select<? extends Record1<T>>) method in the UPDATE DSL API:


1 Answers

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.

like image 59
Lukas Eder Avatar answered Oct 19 '22 06:10

Lukas Eder