Helidon, Micronaut
For Java developers who use Helidon or Micronaut and want to take advantage of a pre-configured Java driver instance. This page should give an overview of the existing support for the driver in other Java frameworks. Please consult the linked documentations for more information.
Driver integration
The goal with both integrations is to provide support for getting a managed instances of the Neo4j driver. Like in the Spring Framework, you can provide the driver properties to an application.properties file (or yaml) to configure your application. In the end you will have an injectable driver instance that can be used with
@Inject
Driver driver;
in the business operation code base.
Additional to the managed driver bean creation, the integrations also expose health metrics for the driver and connection to your Neo4j instance.
Helidon
In a Helidon-based application you need to declare the Neo4j Java driver dependency in your Maven pom.xml.
<dependency>
<groupId>io.helidon.integrations.neo4j</groupId>
<artifactId>helidon-integrations-neo4j</artifactId>
<version>${helidon.version}</version>
</dependency>
Providing the essential connection parameters will give you a managed instance of the Java driver.
neo4j.uri = bolt://localhost:7687
neo4j.authentication.username = neo4j
neo4j.authentication.password = secret
# Enable metrics
neo4j.pool.metricsEnabled = true
If you want to use the health and metrics system, you have to also declare those dependencies provided by the Helidon framework.
<dependency>
<groupId>io.helidon.integrations.neo4j</groupId>
<artifactId>helidon-integrations-neo4j-health</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.integrations.neo4j</groupId>
<artifactId>helidon-integrations-neo4j-metrics</artifactId>
<version>${helidon.version}</version>
</dependency>
Now you can put together the configuration
Neo4JSupport neo4j = Neo4JSupport.builder()
.config(config)
.helper(Neo4JMetricsSupport.create())
.helper(Neo4JHealthSupport.create())
.build();
Routing.builder()
.register(health)
.register(metrics)
.register(movieService)
.build();
and get the managed driver bean.
Micronaut
To enable the Neo4j Driver support in Micronaut, the micronaut-neo4j-bolt dependency needs to get declared.
<dependency>
<groupId>io.micronaut.neo4j</groupId>
<artifactId>micronaut-neo4j-bolt</artifactId>
</dependency>
Adding the needed connection parameters to the application.properties.
neo4j.uri = bolt://localhost:7687
neo4j.username = neo4j
neo4j.password = secret
The module will automatically add its information to the built-in /health endpoint.
Was this page helpful?