Adding the required dependencies

The first batch of dependencies to add to the Maven pom.xml file are those for the web processing and rendering:

  1. <dependency>
  2. <groupId>io.vertx</groupId>
  3. <artifactId>vertx-web</artifactId>
  4. </dependency>
  5. <dependency>
  6. <groupId>io.vertx</groupId>
  7. <artifactId>vertx-web-templ-freemarker</artifactId>
  8. </dependency>
  9. <dependency>
  10. <groupId>com.github.rjeschke</groupId>
  11. <artifactId>txtmark</artifactId>
  12. <version>0.13</version>
  13. </dependency>
Tip
As the vertx-web-templ-freemarker name suggests, Vert.x web provides pluggable support for popular template engines: Handlebars, Jade, MVEL, Pebble, Thymeleaf and of course Freemarker.

The second set of dependencies are those required for JDBC database access:

  1. <dependency>
  2. <groupId>io.vertx</groupId>
  3. <artifactId>vertx-jdbc-client</artifactId>
  4. </dependency>
  5. <dependency>
  6. <groupId>org.hsqldb</groupId>
  7. <artifactId>hsqldb</artifactId>
  8. <version>2.3.4</version>
  9. </dependency>

The Vert.x JDBC client library provides access to any JDBC-compliant database, but of course our project needs to have a JDBC driver on the classpath.

HSQLDB is well-known relational database that is written in Java. It is quite popular when used as an embedded database to avoid the requirement of having a third-party database server running separately. It is also popular for unit and integration testing as it offers a (volatile) in-memory storage.

HSQLDB as an embedded database is a good fit to get us started. It stores data in local files, and since the HSQLDB library Jar provides a JDBC driver the Vert.x JDBC configuration will be straightforward.

Note

Vert.x also offers dedicated MySQL and PostgreSQL client libraries.

Of course you can use the general-purpose Vert.x JDBC client to connect to MySQL or PostgreSQL databases, but these libraries offers better performance by working with these 2 database server network protocols rather than going through the (blocking) JDBC APIs.

Note
Vert.x also provides libraries to deal with the popular non-relational databases MongoDB and Redis. The larger community offers integration with other storage systems like Apache Cassandra, OrientDB or ElasticSearch.