Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependency injection/ORM in Vertx for Java

I am learning vertx framework with Java, and I was wondering if there is any "framework" such as Spring Core to perform dependency injection or a library ?

And also, I was looking for an ORM to interact with a Relational Database (eg. Hibernate, Spring Data in Spring.

Thank you for you recommendation !

like image 823
the_tourist Avatar asked Dec 24 '18 15:12

the_tourist


1 Answers

You can use an integration between Spring and Vert.x in your project:

You can see examples here:

https://www.baeldung.com/spring-vertx

https://github.com/vert-x3/vertx-examples/tree/master/spring-examples

The general idea is to use Spring for configuring your application and use all its powerful annotations and dependency injection features and use Vert.x for for creating http server to handle your requests using Vert.x reactive model.

But if you find yourself writing all your code for handling requests inside an executeBlocking (for example, if you are using Spring Data and all your requests retrieve from DB) please don't do that. Instead try to find alternative asynchronous ways for doing things (for example, for DB you can use Vert.x async clients).

like image 133
Mohamed Elsayed Avatar answered Oct 30 '22 17:10

Mohamed Elsayed