Inspiration

Last month I started the task of migrating our service layer based largely on Spring Boot (and some on Wildfly). In both cases there is a set of common technologies (standards or pseudo standards such as Spring Data) that are common to both developments (Spring Data Jpa is used as a pseudo standard in addition to JAX-RS, JPA, JWT, OAUTH, etc). Taking one of the most critical services, the work to recondition the services was greater than desired due to the already known limitations of Quarkus Spring Data Jpa Api Extension (for example, @Query and named queries is common in this technology). Also, on my journey, I stumbled across some minor issues until I reached a critical one (https://github.com/quarkusio/quarkus/issues/9357) that affects queries with Slice return types in performance.

Given these limitations that prevent having a single source compatible with both services, I began the development of this extension in order to provide a reliable and fully compatible solution that allows Quarkus to also be passed at a minimum cost and to be able to develop and new services on the same platform but with Panache in place (which is expected to be more optimal and the default solution despite its differences with Spring Data). This extension will allow the code to be migrated almost without any necessary modifications regarding the persistence layer and opens the door to quickly include the rest of the extensions of the Spring Data family (ElasticSearch, Mongo, Jdbc, etc!).

What it does

It integrates a version of Spring Data Jpa with some small improvements for better CDI compatibility that I have made (although nowadays with the latest changes that Spring Data has been incorporating it is possible to also use the main branch directly). In this way it is possible to have all the functionalities and behaviors that this tool has without emulations or alternative implementations that no matter how good they are, no matter how much effort it takes, maintenance is usually really hard.

How I built it

Create an extension by following the tutorials and available documentation, navigate the quarkus code and the existing extensions trying to understand some concepts. In fact it is a first version, a starting point, with the help of the community if this project is well received, I can improve the performance with static generation of certain configurations and optimize performance.

I developed more than 300 tests to check the different functionalities and the correct operation of the framework, covering things like multiple configurations, read, write, delete, projections, late loading, transactions, common interfaces, different ways of creating queries like @Query , query methods, SimpleJpaRepository implementation, Custom base repositories, Persistables, Fragments, etc.

Challenges I ran into

Develop my first quarkus extension. Understand the handling of classloaders and compilation stages, and many other concepts that I still have to improve. And of course, migrate a typical project with Spring Data Jpa without having to touch anything other than configuration!

Accomplishments that I'm proud of

  • Get the integration working great!
  • Migrate a complete project in only minutes!!!
  • Support all the functionalities that were not yet supported by the current extension (Spring Data Jpa API)!
  • Open the possibilities (if the community and this project is well received), to continue improving it and implementing the complete Spring Data Stack for those who don't want to wait to migrate their stack to Quarkus!
  • Learn how to make my first Quarkus extension!

What I learned

That the development of the Quarkus extensions, while more complex than CDI, has amazing power ... The Quarkus team has been very helpful in Zulip and Gitlab to understand some events that one is unaware of.

What's next for Quarkus Spring Data Jpa Integration (no Api / no Panache)

Perform an optimization stage and start using it to migrate services. Then if this project is well received, continue integrating the rest of the Spring Data stack projects (Jdbc, Mongo, ElasticSearch, etc).

Built With

  • hibernate
  • java
  • jdk11
  • jpa
  • quarkus
  • spring-data
  • spring-data-jpa
Share this project:

Updates