1

Could you please let me know how to use spring-jdbc in Quarkus, as I am converting my application from spring to Quarkus, for now I required to use JdbcTemplate but I don't see how to use it.

I am using below dependencies:

<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-spring-data-jpa</artifactId>
</dependency>
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-spring-web</artifactId>
</dependency>

But I didn't find anything for spring-jdbc

user3458271
  • 638
  • 12
  • 31
  • 1
    JDBC isn't a great fit for reactive stacks, because it blocks on the IOs. Try to migrate to one of the non-blocking SQL clients Quarkus supports instead: https://quarkus.io/guides/reactive-sql-clients. – sp00m Feb 24 '21 at 10:31
  • Yes we are going to do it, but for now we have to start existing one with JdbcTemplate so I am looking for it. – user3458271 Feb 24 '21 at 10:34

2 Answers2

4

There isn't such thing as JdbcTemplate in Quarkus, nor a support for spring-jdbc.

So the answer is that you cannot use them, you need to convert the usage to Spring Data (or HIbernate with Panache), or inject a DataSource object and directly work with it.

loicmathieu
  • 5,181
  • 26
  • 31
1

We found that past version works perfectly fine with native compilation. Hope that's good enough in your case. Replacing logging is also required for native compilation, because of Class.forName usages.

<spring.jdbc.version>4.3.30.RELEASE</spring.jdbc.version>

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-jdbc</artifactId>
  <version>${spring.jdbc.version}</version>
  <exclusions>
    <exclusion>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
    </exclusion>
  </exclusions>
</dependency>

<dependency>
  <groupId>org.jboss.logging</groupId>
  <artifactId>commons-logging-jboss-logging</artifactId>
</dependency>
evgenii
  • 1,190
  • 1
  • 8
  • 21