Skip to content

Commit 20e1de1

Browse files
committed
aligned the demo to the reference documentation (DE-948)
1 parent a47c507 commit 20e1de1

File tree

1 file changed

+40
-18
lines changed

1 file changed

+40
-18
lines changed

tutorial/README.md

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@ Spring Boot Starter ArangoDB.
77
A more extensive demo about the features of Spring Data ArangoDB can be found in the
88
[Spring Boot Starter ArangoDB Demo](https://github.com/arangodb/spring-boot-starter/tree/main/demo).
99

10-
# Getting Started
10+
## Get started
1111

12-
## Build a project with Maven
12+
This tutorial is about how to configure [Spring Data ArangoDB](https://github.com/arangodb/spring-data)
13+
without using Spring Boot Starter ArangoDB.
1314

14-
First, we have to set up a project and add every needed dependency.
15-
We use `Maven` and `Spring Boot` for this demo.
15+
For a more extensive tutorial about the features of Spring Data ArangoDB and
16+
Spring Boot support, see the [Spring Boot Starter](../spring-boot-arangodb.md)
17+
documentation.
1618

17-
We have to create a Maven `pom.xml`:
19+
### Build a project with Maven
20+
21+
Set up a project and add every needed dependency. This demo uses Maven and
22+
Spring Boot.
23+
24+
Create a Maven `pom.xml`:
1825

1926
```xml
2027
<?xml version="1.0" encoding="UTF-8"?>
@@ -57,7 +64,10 @@ We have to create a Maven `pom.xml`:
5764
</project>
5865
```
5966

60-
## Entity classes
67+
Substitute the versions with the latest available versions that are compatible.
68+
See the [Supported versions](#supported-versions) for details.
69+
70+
### Entity classes
6171

6272
For this tutorial we will model our entity with a Java record class:
6373

@@ -72,7 +82,7 @@ public record Character(
7282
}
7383
```
7484

75-
## Create a repository
85+
### Create a repository
7686

7787
Now that we have our data model, we want to store data. For this, we create a repository interface which
7888
extends `ArangoRepository`. This gives us access to CRUD operations, paging, and query by example mechanics.
@@ -82,15 +92,15 @@ public interface CharacterRepository extends ArangoRepository<Character, String>
8292
}
8393
```
8494

85-
## Create a Configuration class
95+
### Create a Configuration class
8696

8797
We need a configuration class to set up everything to connect to our ArangoDB instance and to declare that all
8898
needed Spring Beans are processed by the Spring container.
8999

90100
- `@EnableArangoRepositories`: Defines where Spring can find your repositories
91101
- `arango()`: Method to configure the connection to the ArangoDB instance
92102
- `database()`: Method to define the database name
93-
- `returnOriginalEntities()`: Method to configures the behaviour of repository save methods to either return the
103+
- `returnOriginalEntities()`: Method to configures the behavior of repository save methods to either return the
94104
original entities (updated where possible) or new ones. Set to `false` to use java records.
95105

96106
```java
@@ -118,7 +128,26 @@ public class AdbConfig implements ArangoConfiguration {
118128
}
119129
```
120130

121-
## Create a CommandLineRunner
131+
Note that, in case the driver is configured to use a protocol with `VPACK`
132+
content type (i.e. `HTTP_VPACK` or `HTTP2_VPACK`), then the
133+
`ArangoConfiguration#contentType()` method must be overridden to return
134+
`ContentType.VPACK` as shown in the following example:
135+
136+
```java
137+
@Override
138+
public ArangoDB.Builder arango() {
139+
new ArangoDB.Builder()
140+
// ...
141+
.protocol(Protocol.HTTP2_VPACK);
142+
}
143+
144+
@Override
145+
public ContentType contentType() {
146+
return ContentType.VPACK;
147+
}
148+
```
149+
150+
### Create a CommandLineRunner
122151

123152
To run our demo as command line application, we have to create a class implementing `CommandLineRunner`:
124153

@@ -148,7 +177,7 @@ public class CrudRunner implements CommandLineRunner {
148177
}
149178
```
150179

151-
## Run the applucation
180+
### Run the application
152181

153182
Finally, we create a main class:
154183

@@ -174,10 +203,3 @@ This should produce a console output similar to:
174203
```
175204
Ned Stark saved in the database: Character[id=2029, name=Ned, surname=Stark]
176205
```
177-
178-
# Learn more
179-
180-
* [ArangoDB](https://www.arangodb.com)
181-
* [Spring Data ArangoDB](https://github.com/arangodb/spring-data)
182-
* [ArangoDB Java Driver](https://github.com/arangodb/arangodb-java-driver)
183-
* [Spring Boot Starter ArangoDB Demo](https://github.com/arangodb/spring-boot-starter/tree/main/demo)

0 commit comments

Comments
 (0)