Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit 8c5e805

Browse files
Restructure manual.
1 parent 898d74e commit 8c5e805

File tree

14 files changed

+225
-132
lines changed

14 files changed

+225
-132
lines changed

README.adoc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
= Neo4j Spring Boot Starter
12
:sectanchors:
3+
// tag::properties[]
4+
:groupId: org.neo4j.driver
5+
:artifactId: neo4j-java-driver-spring-boot-starter
6+
:neo4j-java-driver-spring-boot-starter_version: 4.0.0.1
27
:spring-boot_version: 2.2.4.RELEASE
3-
image:https://img.shields.io/maven-central/v/org.neo4j.driver/neo4j-java-driver-spring-boot-starter.svg[Maven Central,link=http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.neo4j.driver%22%20AND%20a%3A%22neo4j-java-driver-spring-boot-starter%22]
8+
:neo4j_version: 4.0.0
9+
:config_prefix: org.neo4j.driver
10+
:gh_base: https://github.com/neo4j/neo4j-java-driver-spring-boot-starter
411

5-
= neo4j-java-driver-spring-boot-starter
12+
// end::properties[]
613

14+
image:https://img.shields.io/maven-central/v/org.neo4j.driver/neo4j-java-driver-spring-boot-starter.svg[Maven Central,link=http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.neo4j.driver%22%20AND%20a%3A%22neo4j-java-driver-spring-boot-starter%22]
715

816
[abstract]
917
--
@@ -26,5 +34,5 @@ The starter supports Neo4j server mode only, that is: A connection against a Neo
2634
== Manual
2735

2836
For a gentle introduction and some getting started guides, please use our
29-
link:docs/manual.adoc[Manual].
37+
link:https://neo4j.github.io/neo4j-java-driver-spring-boot-starter/[Manual].
3038
The manual contains descriptions of all examples, which you'll find in the project source directory under https://github.com/neo4j/neo4j-java-driver-spring-boot-starter/tree/master/examples[examples].
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
false== Configuration options
2-
:config_prefix: org.neo4j.driver
1+
= Configuration options
32

43
[cols="1,1,2", options="header"]
54
|===

docs/appendix/index.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:leveloffset: +1
2+
[[appendix]]
3+
= Appendix
4+
5+
:numbered!:
6+
:leveloffset: +1
7+
include::configuration-options.adoc[]
8+
:leveloffset: -1
9+
:leveloffset: -1
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
:leveloffset: +1
2+
[[examples]]
13
= Examples
2-
:sectanchors:
3-
ifndef::manualIncludeDir[]
4-
:manualIncludeDir: ../
5-
endif::[]
4+
5+
== Introduction
66

77
We provide several examples how to use this starter.
88
The reactive demo can only be used with Neo4j version 4.
@@ -42,7 +42,7 @@ public class SimpleApplication {
4242
To make playing with the examples a bit easier, we have support for https://code.visualstudio.com/docs/remote/remote-overview[VS Code Remote Development].
4343
Please follow the instructions at the link above for setting up your Visual Studio Code environment.
4444

45-
You can open `web`, `reactive-web` and `simple` in Visual Studio Code and let it build the container.
45+
You can open `web`, `reactive-web` and `simple` in Visual Studio Code and let it build the container.
4646
The development container will contain a Neo4j 4.0 database as well as the example project.
4747
The database can be reached under http://localhost:7474[http://localhost:7474] with the username / password combination `neo4j/secret`.
4848

@@ -51,12 +51,6 @@ The example than can be build and run via Visual Studios support for Spring Boot
5151
The web examples are reachable on http://localhost:8080[http://localhost:8080] from both outside and inside Visual Studio Code.
5252
Any changes to the code will be automatically reloaded and available.
5353

54-
include::{manualIncludeDir}examples/web/README.adoc[]
55-
56-
include::{manualIncludeDir}examples/reactive-web/README.adoc[]
57-
58-
include::{manualIncludeDir}examples/testing-with-neo4j-harness/README.adoc[]
59-
6054
== Collecting metrics
6155

6256
NOTE: This refers only to Driver metrics, not to the Neo4j server metrics.
@@ -116,4 +110,14 @@ curl localhost:8080/actuator/metrics/neo4j.driver.connections.acquired|jq
116110
}
117111
----
118112

119-
include::{manualIncludeDir}examples/dedicated-routing-driver/README.adoc[]
113+
include::{manualIncludeDir}../examples/web/README.adoc[leveloffset=+1]
114+
115+
include::{manualIncludeDir}../examples/reactive-web/README.adoc[leveloffset=+1]
116+
117+
include::{manualIncludeDir}../examples/testing-with-neo4j-harness/README.adoc[leveloffset=+1]
118+
119+
include::{manualIncludeDir}../examples/dedicated-routing-driver/README.adoc[leveloffset=+1]
120+
121+
include::{manualIncludeDir}../examples/ogm-integration/README.adoc[leveloffset=+1]
122+
123+
:leveloffset: -1

docs/index.adoc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
= Neo4j Spring Boot Starter
2+
Gerrit Meier <gerrit.meier@neo4j.com>; Michael Simons <michael.simons@neo4j.com>
3+
:toc:
4+
:doctype: book
5+
:lang: en
6+
:listing-caption: Listing
7+
:source-highlighter: coderay
8+
:icons: font
9+
:sectlink: true
10+
:sectanchors: true
11+
:numbered: true
12+
:xrefstyle: short
13+
14+
ifndef::manualIncludeDir[]
15+
:manualIncludeDir: ../
16+
endif::[]
17+
18+
include::{manualIncludeDir}/README.adoc[tags=properties]
19+
20+
:copyright: 2020 Neo4j, Inc.,
21+
:gh-base: https://github.com/neo4j/neo4j-java-driver-spring-boot-starter
22+
23+
(C) {copyright}
24+
25+
License: link:license.html[Creative Commons 4.0]
26+
27+
[abstract]
28+
--
29+
This is the manual for the Spring Boot Starter for Neo4j's Java Driver (a.k.a. the Bolt Driver).
30+
--
31+
32+
_Who should read this?_
33+
34+
This manual is written for:
35+
36+
* engineers setting up a Neo4j connection to a single Neo4j instance or a Neo4j cluster over the wire, without the need for object mapping
37+
* engineers who want to use Neo4j-OGM inside Spring Boot but needs access to the configuration options of the underlying Bolt driver.
38+
39+
include::manual/index.adoc[]
40+
41+
include::examples/index.adoc[]
42+
43+
include::appendix/index.adoc[]
Lines changed: 10 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,5 @@
1-
= Using Neo4j's Spring Boot integration for the Java Driver
2-
:toc:
3-
ifndef::manualIncludeDir[]
4-
:manualIncludeDir: ../
5-
endif::[]
6-
:neo4j-java-driver-spring-boot-starter_version: 4.0.0.1
7-
:groupId: org.neo4j.driver
8-
:artifactId: neo4j-java-driver-spring-boot-starter
9-
:spring-boot_version: 2.2.4.RELEASE
10-
:neo4j_version: 4.0.0
11-
:config_prefix: org.neo4j.driver
12-
:driver_manual_base: https://neo4j.com/docs/driver-manual/1.7/
13-
:gh_base: https://github.com/neo4j/neo4j-java-driver-spring-boot-starter
14-
15-
== Intro
16-
17-
=== What's in the box?
18-
19-
The Neo4j Java Driver Spring Boot starter provides both a Spring Boot `autoconfigure` and a `starter` module.
20-
The `autoconfigure` module adds a single instance of `org.neo4j.driver.Driver` as a bean to the Spring Context if there is none
21-
and registers health- and metric endpoints for all Driver-beans if the necessary Spring infrastructure is in place.
22-
23-
It does not bring any mapping facilities in addition the available functions of the driver nor Spring Data integration.
24-
Have a look at https://github.com/neo4j/sdn-rx[Spring Data Neo4j⚡️RX] for reactive Spring Data Neo4j repositories.
25-
26-
IMPORTANT: The driver instance is a long living object that provides short living sessions as needed.
27-
The instance does not need to be closed manually, that is done automatically when the application shuts down.
28-
There is no need for external connection pooling.
29-
This is done already in the driver and can be configured via properties.
30-
Please have a look at the chapter {driver_manual_base}/sessions-transactions/[Sessions and transactions].
31-
32-
=== Do I need the Neo4j Java Driver Spring Boot starter?
33-
34-
We recommend this starter for all new Spring Boot applications that want to use our new generation of drivers ("4.0").
35-
The next generation of drivers is compatible with both 4.0.x and 3.5.x community and enterprise databases.
36-
The starter takes away all the boilerplate code of configuring an instance of the driver and does support
37-
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html[externalized configuration]
38-
for all aspects of the driver.
39-
40-
* [*] _You want to work directly with a 4.0 driver?_
41-
The starter is for you.
42-
* [*] _You want Spring Data Neo4j⚡️RX repositories?_
43-
The automatic configuration for SDN-RX is dependent on this starter, so it is already there and you would use exactly
44-
the same as described in this manual to configure your connection
45-
* [*] _You have the previous generation of Spring Data Neo4j or Neo4j-OGM?_
46-
While you cannot use the 4.0.x line of this starter, as Spring Data Neo4j + OGM is based on the previous generation of the Java driver,
47-
you can use the 1.7.x line of this starter. This configures a bean of the previous generation of the Neo4j driver and
48-
also configures Neo4j-OGM to use that bean instead of an internal one.
49-
50-
=== Does it work with the 1.7 series of the driver?
51-
52-
The 1.7.x line of the starter is for the 1.7.x line of the driver, the 4.0.x line for the 4.0..x of the driver.
53-
54-
=== Does it work with the embedded database?
55-
56-
No.
57-
58-
=== What's with the long name?
59-
60-
`neo4j-java-driver-spring-boot-starter` is quite a long name for a module, we get that.
61-
However, it follows the official Spring Boot convention described https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-auto-configuration.html#boot-features-custom-starter-naming[here].
62-
63-
> As a rule of thumb, you should name a combined module after the starter. For example, assume that you are creating a starter for "acme" and that you name the auto-configure module acme-spring-boot-autoconfigure and the starter acme-spring-boot-starter. If you only have one module that combines the two, name it acme-spring-boot-starter.
64-
65-
Our "acme" module is the Neo4j Java Driver, project name `neo4j-java-driver` and things add up from there, that's all.
66-
67-
== Getting started
1+
[[manual-getting-started]]
2+
= Getting started
683

694
As with any other Spring Boot starter, the only thing you have to do is to include the starter module via your dependency management.
705
If you don't configure anything, than the starter assumes `bolt://localhost:7687` as Neo4j URI and a server that has disabled authentication.
@@ -85,7 +20,7 @@ The reactive programming model however requires a 4.0 Neo4j server on the databa
8520
To make the following intro as accessible as possible, we only display the blocking database access.
8621
Have a look at the {gh_base}/tree/master/examples[examples directory] for a reactive web application example.
8722

88-
=== Preparing the database
23+
== Preparing the database
8924

9025
For this example, we stay within the https://neo4j.com/developer/movie-database/[movie graph],
9126
as it comes for free with every Neo4j instance.
@@ -104,7 +39,7 @@ At first visit, you have to change your password. We chose `secret` in the exam
10439
Note the command ready to run in the prompt.
10540
Execute it to fill your database with some test data.
10641

107-
=== Create a new Spring Boot project
42+
== Create a new Spring Boot project
10843

10944
The easiest way to setup a Spring Boot project is https://start.spring.io[start.spring.io]
11045
(which is integrated in the major IDEs as well, in case you don't want to use the website).
@@ -115,7 +50,7 @@ with all the files and settings in place for the selected build tool.
11550

11651
WARNING: Don't choose Spring Data Neo4j here, as it will get you the previous generation of Spring Data Neo4j including OGM and additional abstraction over the driver.
11752

118-
==== Maven
53+
=== Maven
11954

12055
You can issue a CURL request against the Spring Initializer to create a basic Maven project:
12156

@@ -146,7 +81,7 @@ As this starter is not yet on the initializer, you'll have to add the following
14681

14782
You would also add the dependency manually in case of an existing project.
14883

149-
==== Gradle
84+
=== Gradle
15085

15186
The idea is the same, just generate a Gradle project:
15287

@@ -174,7 +109,7 @@ dependencies {
174109

175110
You would also add the dependency manually in case of an existing project.
176111

177-
==== Configuration
112+
=== Configuration
178113

179114
Now open any of those projects in your favorite IDE.
180115
Find `application.properties` and configure your Neo4j credentials:
@@ -198,7 +133,7 @@ NOTE: It is not necessary to add any programmatically configuration of the drive
198133
While it may work, we strongly discourage and don't support additional, pragmatical configuration of the Neo4j driver when using this starter.
199134

200135

201-
==== Example CRUD Controller
136+
=== Example CRUD Controller
202137

203138
Add the following `@RESTController` to your application:
204139

@@ -294,7 +229,7 @@ dependencies {
294229

295230
We support both the https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html#production-ready-health[health-] and https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-metrics.html[metrics-actuator].
296231

297-
=== Health information
232+
== Health information
298233

299234
Both reactive and imperative health checks are available,
300235
with the reactive health checks having precedence when Project Reactor is detected.
@@ -332,7 +267,7 @@ In case no instance is reachable, the status will be `DOWN` and the details carr
332267

333268
To disable the Neo4j health indicator, use the standard Spring Boot property `management.health.neo4j.enabled` with a value of `false`.
334269

335-
=== Driver metrics
270+
== Driver metrics
336271

337272
`neo4j-java-driver-spring-boot-starter` comes with support for https://micrometer.io[Micrometer metrics] out of the box.
338273
It detects Micrometer on the classpath and binds the metrics of all instances of `org.neo4j.driver.Driver`, that have enabled their metrics, to a micrometer registry.
@@ -351,9 +286,3 @@ The following metrics are exposes
351286

352287
All metrics will have the tags `name` (the bean of the driver they belong to)
353288
and `poolId` (the id of the connection pool, that contributed to the corresponding counter or gauge).
354-
355-
include::{manualIncludeDir}docs/configuration-options.adoc[]
356-
357-
:leveloffset: +1
358-
include::{manualIncludeDir}examples/README.adoc[]
359-
:leveloffset: -1

docs/manual/index.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include::intro.adoc[leveloffset=+1]
2+
3+
include::getting-started.adoc[leveloffset=+1]

docs/manual/intro.adoc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[[manual-introduction]]
2+
= Intro
3+
4+
== What's in the box?
5+
6+
The Neo4j Java Driver Spring Boot starter provides both a Spring Boot `autoconfigure` and a `starter` module.
7+
The `autoconfigure` module adds a single instance of `org.neo4j.driver.Driver` as a bean to the Spring Context if there is none
8+
and registers health- and metric endpoints for all Driver-beans if the necessary Spring infrastructure is in place.
9+
10+
It does not bring any mapping facilities in addition the available functions of the driver nor Spring Data integration.
11+
Have a look at https://github.com/neo4j/sdn-rx[Spring Data Neo4j⚡️RX] for reactive Spring Data Neo4j repositories.
12+
13+
IMPORTANT: The driver instance is a long living object that provides short living sessions as needed.
14+
The instance does not need to be closed manually, that is done automatically when the application shuts down.
15+
There is no need for external connection pooling.
16+
This is done already in the driver and can be configured via properties.
17+
Please have a look at the chapter {driver_manual_base}/sessions-transactions/[Sessions and transactions].
18+
19+
== Do I need the Neo4j Java Driver Spring Boot starter?
20+
21+
We recommend this starter for all new Spring Boot applications that want to use our new generation of drivers ("4.0").
22+
The next generation of drivers is compatible with both 4.0.x and 3.5.x community and enterprise databases.
23+
The starter takes away all the boilerplate code of configuring an instance of the driver and does support
24+
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html[externalized configuration]
25+
for all aspects of the driver.
26+
27+
* [*] _You want to work directly with a 4.0 driver?_
28+
The starter is for you.
29+
* [*] _You want Spring Data Neo4j⚡️RX repositories?_
30+
The automatic configuration for SDN-RX is dependent on this starter, so it is already there and you would use exactly
31+
the same as described in this manual to configure your connection
32+
* [*] _You have the previous generation of Spring Data Neo4j or Neo4j-OGM?_
33+
While you cannot use the 4.0.x line of this starter, as Spring Data Neo4j + OGM is based on the previous generation of the Java driver,
34+
you can use the 1.7.x line of this starter. This configures a bean of the previous generation of the Neo4j driver and
35+
also configures Neo4j-OGM to use that bean instead of an internal one.
36+
37+
== Does it work with the 1.7 series of the driver?
38+
39+
The 1.7.x line of the starter is for the 1.7.x line of the driver, the 4.0.x line for the 4.0..x of the driver.
40+
41+
== Does it work with the embedded database?
42+
43+
No.
44+
45+
== What's with the long name?
46+
47+
`neo4j-java-driver-spring-boot-starter` is quite a long name for a module, we get that.
48+
However, it follows the official Spring Boot convention described https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-auto-configuration.html#boot-features-custom-starter-naming[here].
49+
50+
> As a rule of thumb, you should name a combined module after the starter. For example, assume that you are creating a starter for "acme" and that you name the auto-configure module acme-spring-boot-autoconfigure and the starter acme-spring-boot-starter. If you only have one module that combines the two, name it acme-spring-boot-starter.
51+
52+
Our "acme" module is the Neo4j Java Driver, project name `neo4j-java-driver` and things add up from there, that's all.

examples/dedicated-routing-driver/README.adoc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
== Dedicated routing driver
2-
ifndef::manualIncludeDir[]
3-
:manualIncludeDir: ./
4-
endif::[]
1+
= Dedicated routing driver
52

63
Usually, a Neo4j cluster should be identified by one logical `neo4j://` URL.
74
This can be a load balancer, a DNS resolver, anything that turns the URL into a clusters entry point.
@@ -24,5 +21,6 @@ To use the custom URIs, add a configuration class like this:
2421
include::src/main/java/org/neo4j/doc/driver/springframework/boot/dedicated_routing_driver/RoutingDriverConfiguration.java[tags=custom-config]
2522
----
2623
<1> Map your custom property with `@Value` onto a list of Strings or URIs.
27-
<2> Let our machinery inject `Neo4jDriverProperties`, that include all of our properties
28-
<3> Use the convenience methods to create `org.neo4j.driver.AuthToken` and `org.neo4j.driver.Driver` as needed.
24+
<2> Let our machinery inject `Neo4jDriverProperties`, that includes all of our properties
25+
<3> Use the convenience methods to create `org.neo4j.driver.AuthToken` and `org.neo4j.driver.Config` as needed.
26+
<4> Call the dedicated `routingDriver` method
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
= Neo4j-OGM Integration
2+
3+
The current Spring Boot starter you get on https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.2.5.RELEASE&packaging=jar&jvmVersion=1.8&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=data-neo4j[start.spring.io] recognizes the driver bean created by this starter here.
4+
That means you can add this starter via `{groupId}:{artifactId}:{neo4j-java-driver-spring-boot-starter_version}` and use the properties under `{config_prefix}` to configure the connection.
5+
Thus you don't have to work your way into Neo4j-OGM to manipulate the encapsulated driver but inject a correctly configured driver bean into the Neo4j-OGM session factory.

0 commit comments

Comments
 (0)