Java API

Let's return to the Swarm class. We have already seen that we are able to create the fraction class with our own configuration and hand it on to the Swarm class. In fact, we are able to steer the whole Swarm configuration programmatically. To create a more elaborate example, let's extend our CatalogService so that it stores its data in a database.

Examples reference: chapter4/catalog-service-database.

Let's start with editing the pom.xml:

(...)    <properties>        (...)        <version.hibernate.api>1.0.0.Final</version.hibernate.api>        <version.h2>1.4.187</version.h2>    </properties>    (...)    <dependencies>        (...)        <dependency>            <groupId>org.wildfly.swarm</groupId>            <artifactId>cdi</artifactId>            <version>${version.wildfly.swarm}</version>        </dependency>

Get Hands-On Cloud Development with WildFly now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.