From c5c89f13b9989c3d9ab3b368d64862daab5ce211 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Tue, 24 Sep 2024 13:16:32 +0200 Subject: [PATCH 01/16] fixed javadoc --- .../com/arangodb/springframework/annotation/QueryOptions.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/com/arangodb/springframework/annotation/QueryOptions.java b/src/main/java/com/arangodb/springframework/annotation/QueryOptions.java index c2373fb7..30c891e7 100644 --- a/src/main/java/com/arangodb/springframework/annotation/QueryOptions.java +++ b/src/main/java/com/arangodb/springframework/annotation/QueryOptions.java @@ -144,16 +144,13 @@ /** * Set this option to true to make it possible to retry fetching the latest batch from a cursor. - *

* This makes possible to safely retry invoking {@link com.arangodb.ArangoCursor#next()} in * case of I/O exceptions (which are actually thrown as {@link com.arangodb.ArangoDBException} * with cause {@link java.io.IOException}) - *

* If set to false (default), then it is not safe to retry invoking * {@link com.arangodb.ArangoCursor#next()} in case of I/O exceptions, since the request to * fetch the next batch is not idempotent (i.e. the cursor may advance multiple times on the * server). - *

* Note: once you successfully received the last batch, you should call * {@link com.arangodb.ArangoCursor#close()} so that the server does not unnecessary keep the * batch until the cursor times out ({@link AqlQueryOptions#ttl(Integer)}). From e9c82bdc99ff68a676c8ab71402b50f4ee0b9ce1 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Wed, 9 Oct 2024 10:24:57 +0200 Subject: [PATCH 02/16] CI: fixed external pipeline (#321) --- .circleci/config.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2a3c1930..fc1c696e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: docker-img: type: 'string' - default: "" + default: '' commands: timeout: @@ -23,7 +23,7 @@ commands: parameters: docker-img: type: 'string' - default: <> + default: 'docker.io/arangodb/arangodb:latest' topology: type: 'string' default: 'single' @@ -118,7 +118,7 @@ jobs: parameters: docker-img: type: 'string' - default: <> + default: 'docker.io/arangodb/arangodb:latest' topology: type: 'string' default: 'single' @@ -144,7 +144,7 @@ jobs: parameters: docker-img: type: 'string' - default: <> + default: 'docker.io/arangodb/arangodb:latest' spring-boot-version: type: 'string' default: '3.2.6' @@ -211,10 +211,14 @@ workflows: name: test-<> matrix: parameters: + docker-img: + - <> topology: - 'single' - 'cluster' test-protocol: + when: + not: <> jobs: - test: name: test-<> @@ -229,6 +233,8 @@ workflows: - 'HTTP2_VPACK' - 'HTTP2_JSON' test-spring-version: + when: + not: <> jobs: - integration-test: name: test-<> From e498ae5419f6ac2a5462cd7df49a65b1627bf5fb Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Thu, 17 Oct 2024 11:29:05 +0200 Subject: [PATCH 03/16] [DE-878] added tutorial (#322) * added tutorial --- .circleci/config.yml | 25 +++ tutorial/README.md | 183 ++++++++++++++++++ tutorial/pom.xml | 41 ++++ .../com/arangodb/spring/demo/AdbConfig.java | 29 +++ .../arangodb/spring/demo/DemoApplication.java | 35 ++++ .../spring/demo/entity/Character.java | 33 ++++ .../demo/repository/CharacterRepository.java | 27 +++ .../spring/demo/runner/CrudRunner.java | 58 ++++++ 8 files changed, 431 insertions(+) create mode 100644 tutorial/README.md create mode 100644 tutorial/pom.xml create mode 100644 tutorial/src/main/java/com/arangodb/spring/demo/AdbConfig.java create mode 100644 tutorial/src/main/java/com/arangodb/spring/demo/DemoApplication.java create mode 100644 tutorial/src/main/java/com/arangodb/spring/demo/entity/Character.java create mode 100644 tutorial/src/main/java/com/arangodb/spring/demo/repository/CharacterRepository.java create mode 100644 tutorial/src/main/java/com/arangodb/spring/demo/runner/CrudRunner.java diff --git a/.circleci/config.yml b/.circleci/config.yml index fc1c696e..1fda904f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -167,6 +167,27 @@ jobs: working_directory: integration-tests - report - store_cache + + tutorial: + parameters: + docker-img: + type: 'string' + default: 'docker.io/arangodb/arangodb:latest' + executor: 'j21' + steps: + - timeout + - checkout + - setup_remote_docker + - start-db: + docker-img: <> + - load_cache + - mvn-install + - run: + name: Run tutorial + command: mvn spring-boot:run + working_directory: tutorial + - store_cache + deploy: executor: 'j17' steps: @@ -177,6 +198,7 @@ jobs: - config_gpg - deploy - store_cache + release: executor: 'j17' steps: @@ -243,6 +265,9 @@ workflows: spring-boot-version: - '3.2.6' - '3.3.0' + tutorial: + jobs: + - tutorial deploy: jobs: - deploy: diff --git a/tutorial/README.md b/tutorial/README.md new file mode 100644 index 00000000..0221b895 --- /dev/null +++ b/tutorial/README.md @@ -0,0 +1,183 @@ +![ArangoDB-Logo](https://www.arangodb.com/wp-content/uploads/2016/05/ArangoDB_logo_@2.png) + +# Spring Data ArangoDB - Tutorial + +This is a tutorial on how to configure [Spring Data ArangoDB](https://github.com/arangodb/spring-data), without using +Spring Boot Starter ArangoDB. +A more extensive demo about the features of Spring Data ArangoDB can be found in the +[Spring Boot Starter ArangoDB Demo](https://github.com/arangodb/spring-boot-starter/tree/main/demo). + +# Getting Started + +## Build a project with Maven + +First, we have to set up a project and add every needed dependency. +We use `Maven` and `Spring Boot` for this demo. + +We have to create a Maven `pom.xml`: + +```xml + + + 4.0.0 + + + + org.springframework.boot + spring-boot-starter-parent + 3.3.4 + + + com.arangodb + spring-data-arangodb-tutorial + 1.0.0 + + spring-data-arangodb-tutorial + ArangoDB Spring Data Tutorial + + + 21 + UTF-8 + + + + + org.springframework.boot + spring-boot-starter + + + com.arangodb + arangodb-spring-data + 4.4.0 + + + + +``` + +## Entity classes + +For this tutorial we will model our entity with a Java record class: + +```java +@Document("characters") +public record Character( + @Id + String id, + String name, + String surname +) { +} +``` + +## Create a repository + +Now that we have our data model, we want to store data. For this, we create a repository interface which +extends `ArangoRepository`. This gives us access to CRUD operations, paging, and query by example mechanics. + +```java +public interface CharacterRepository extends ArangoRepository { +} +``` + +## Create a Configuration class + +We need a configuration class to set up everything to connect to our ArangoDB instance and to declare that all +needed Spring Beans are processed by the Spring container. + +- `@EnableArangoRepositories`: Defines where Spring can find your repositories +- `arango()`: Method to configure the connection to the ArangoDB instance +- `database()`: Method to define the database name +- `returnOriginalEntities()`: Method to configures the behaviour of repository save methods to either return the + original entities (updated where possible) or new ones. Set to `false` to use java records. + +```java +@Configuration +@EnableArangoRepositories(basePackages = {"com.arangodb.spring.demo"}) +public class AdbConfig implements ArangoConfiguration { + + @Override + public ArangoDB.Builder arango() { + return new ArangoDB.Builder() + .host("localhost", 8529) + .user("root") + .password("test"); + } + + @Override + public String database() { + return "spring-demo"; + } + + @Override + public boolean returnOriginalEntities() { + return false; + } +} +``` + +## Create a CommandLineRunner + +To run our demo as command line application, we have to create a class implementing `CommandLineRunner`: + +```java +@ComponentScan("com.arangodb.spring.demo") +public class CrudRunner implements CommandLineRunner { + + @Autowired + private ArangoOperations operations; + + @Autowired + private CharacterRepository repository; + + @Override + public void run(String... args) { + // first drop the database so that we can run this multiple times with the same dataset + operations.dropDatabase(); + + System.out.println("# CRUD operations"); + + // save a single entity in the database + // there is no need of creating the collection first. This happen automatically + Character nedStark = new Character(null, "Ned", "Stark"); + Character saved = repository.save(nedStark); + System.out.println("Ned Stark saved in the database: " + saved); + } +} +``` + +## Run the applucation + +Finally, we create a main class: + +```java +@SpringBootApplication +public class DemoApplication { + public static void main(final String... args) { + System.exit(SpringApplication.exit( + SpringApplication.run(CrudRunner.class, args) + )); + } +} +``` + +And run it with: + +```shell +mvn spring-boot:run +``` + +This should produce a console output similar to: + +``` +Ned Stark saved in the database: Character[id=2029, name=Ned, surname=Stark] +``` + +# Learn more + +* [ArangoDB](https://www.arangodb.com) +* [Spring Data ArangoDB](https://github.com/arangodb/spring-data) +* [ArangoDB Java Driver](https://github.com/arangodb/arangodb-java-driver) +* [Spring Boot Starter ArangoDB Demo](https://github.com/arangodb/spring-boot-starter/tree/main/demo) diff --git a/tutorial/pom.xml b/tutorial/pom.xml new file mode 100644 index 00000000..d9946ff2 --- /dev/null +++ b/tutorial/pom.xml @@ -0,0 +1,41 @@ + + 4.0.0 + + + + org.springframework.boot + spring-boot-starter-parent + 3.3.4 + + + com.arangodb + spring-data-arangodb-tutorial + 1.0.0 + + spring-data-arangodb-tutorial + ArangoDB Spring Data Tutorial + + + 21 + UTF-8 + + + + + org.springframework.boot + spring-boot-starter + + + com.arangodb + arangodb-spring-data + 4.4.0 + + + org.assertj + assertj-core + + + + diff --git a/tutorial/src/main/java/com/arangodb/spring/demo/AdbConfig.java b/tutorial/src/main/java/com/arangodb/spring/demo/AdbConfig.java new file mode 100644 index 00000000..bfdcdde0 --- /dev/null +++ b/tutorial/src/main/java/com/arangodb/spring/demo/AdbConfig.java @@ -0,0 +1,29 @@ +package com.arangodb.spring.demo; + +import com.arangodb.ArangoDB; +import com.arangodb.springframework.annotation.EnableArangoRepositories; +import com.arangodb.springframework.config.ArangoConfiguration; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableArangoRepositories(basePackages = {"com.arangodb.spring.demo"}) +public class AdbConfig implements ArangoConfiguration { + + @Override + public ArangoDB.Builder arango() { + return new ArangoDB.Builder() + .host("172.28.0.1", 8529) + .user("root") + .password("test"); + } + + @Override + public String database() { + return "spring-demo"; + } + + @Override + public boolean returnOriginalEntities() { + return false; + } +} diff --git a/tutorial/src/main/java/com/arangodb/spring/demo/DemoApplication.java b/tutorial/src/main/java/com/arangodb/spring/demo/DemoApplication.java new file mode 100644 index 00000000..e4bee91f --- /dev/null +++ b/tutorial/src/main/java/com/arangodb/spring/demo/DemoApplication.java @@ -0,0 +1,35 @@ +/* + * DISCLAIMER + * + * Copyright 2017 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.spring.demo; + +import com.arangodb.spring.demo.runner.CrudRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +public class DemoApplication { + public static void main(final String... args) { + System.exit(SpringApplication.exit( + SpringApplication.run(CrudRunner.class, args) + )); + } +} diff --git a/tutorial/src/main/java/com/arangodb/spring/demo/entity/Character.java b/tutorial/src/main/java/com/arangodb/spring/demo/entity/Character.java new file mode 100644 index 00000000..ea68c4fa --- /dev/null +++ b/tutorial/src/main/java/com/arangodb/spring/demo/entity/Character.java @@ -0,0 +1,33 @@ +/* + * DISCLAIMER + * + * Copyright 2017 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.spring.demo.entity; + +import com.arangodb.springframework.annotation.Document; +import org.springframework.data.annotation.Id; + +@Document("characters") +public record Character( + @Id + String id, + String name, + String surname +) { +} diff --git a/tutorial/src/main/java/com/arangodb/spring/demo/repository/CharacterRepository.java b/tutorial/src/main/java/com/arangodb/spring/demo/repository/CharacterRepository.java new file mode 100644 index 00000000..630f0209 --- /dev/null +++ b/tutorial/src/main/java/com/arangodb/spring/demo/repository/CharacterRepository.java @@ -0,0 +1,27 @@ +/* + * DISCLAIMER + * + * Copyright 2017 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.spring.demo.repository; + +import com.arangodb.spring.demo.entity.Character; +import com.arangodb.springframework.repository.ArangoRepository; + +public interface CharacterRepository extends ArangoRepository { +} diff --git a/tutorial/src/main/java/com/arangodb/spring/demo/runner/CrudRunner.java b/tutorial/src/main/java/com/arangodb/spring/demo/runner/CrudRunner.java new file mode 100644 index 00000000..b20d7bff --- /dev/null +++ b/tutorial/src/main/java/com/arangodb/spring/demo/runner/CrudRunner.java @@ -0,0 +1,58 @@ +/* + * DISCLAIMER + * + * Copyright 2017 ArangoDB GmbH, Cologne, Germany + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright holder is ArangoDB GmbH, Cologne, Germany + */ + +package com.arangodb.spring.demo.runner; + +import com.arangodb.spring.demo.entity.Character; +import com.arangodb.spring.demo.repository.CharacterRepository; +import com.arangodb.springframework.core.ArangoOperations; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.context.annotation.ComponentScan; + +import static org.assertj.core.api.Assertions.assertThat; + +@ComponentScan("com.arangodb.spring.demo") +public class CrudRunner implements CommandLineRunner { + + @Autowired + private ArangoOperations operations; + + @Autowired + private CharacterRepository repository; + + @Override + public void run(String... args) { + // first drop the database so that we can run this multiple times with the same dataset + operations.dropDatabase(); + + System.out.println("# CRUD operations"); + + // save a single entity in the database + // there is no need of creating the collection first. This happen automatically + Character nedStark = new Character(null, "Ned", "Stark"); + Character saved = repository.save(nedStark); + System.out.println("Ned Stark saved in the database: " + saved); + + assertThat(saved.id()).isNotNull(); + assertThat(saved.name()).isEqualTo(nedStark.name()); + assertThat(saved.surname()).isEqualTo(nedStark.surname()); + } +} From f99669936d713fc7c3fa3f10b6a08ab92ade2200 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Wed, 23 Oct 2024 10:42:04 +0200 Subject: [PATCH 04/16] updated Java Driver to version 7.10.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fb66f122..4c518fcc 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ com.arangodb.springframework - 7.9.0 + 7.10.0 2.0.16 From cb4dda74a7e6696bb9d1a9cfbc425bb38543e504 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Wed, 23 Oct 2024 10:44:21 +0200 Subject: [PATCH 05/16] v4.4.1 --- ChangeLog.md | 5 +++++ integration-tests/pom.xml | 2 +- pom.xml | 2 +- tutorial/README.md | 2 +- tutorial/pom.xml | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 71211f39..c25cc5c7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [4.4.1] - 2024-10-23 + +- updated Java Driver to version `7.10.0` + + ## [4.4.0] - 2024-09-24 - updated Java Driver to version `7.9.0` diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 74107d03..b69b90b0 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -11,7 +11,7 @@ com.arangodb arangodb-spring-data-integration-tests - 4.4.0 + 4.4.1 arangodb-spring-data-integration-tests ArangoDB Spring Data Integration Tests diff --git a/pom.xml b/pom.xml index 4c518fcc..81a483a0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.arangodb arangodb-spring-data - 4.4.0 + 4.4.1 2017 jar diff --git a/tutorial/README.md b/tutorial/README.md index 0221b895..0bf94a72 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -50,7 +50,7 @@ We have to create a Maven `pom.xml`: com.arangodb arangodb-spring-data - 4.4.0 + 4.4.1 diff --git a/tutorial/pom.xml b/tutorial/pom.xml index d9946ff2..28d70ac9 100644 --- a/tutorial/pom.xml +++ b/tutorial/pom.xml @@ -30,7 +30,7 @@ com.arangodb arangodb-spring-data - 4.4.0 + 4.4.1 org.assertj From 2b46fb58522c422bd48b88288c329b169d49c503 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Fri, 8 Nov 2024 17:12:42 +0100 Subject: [PATCH 06/16] updated Java Driver to version 7.12.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 81a483a0..61bbde5c 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ com.arangodb.springframework - 7.10.0 + 7.12.0 2.0.16 From 4f2e6507d6d04d3521812b3ef0c8dca9f7e96a99 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Fri, 8 Nov 2024 17:14:07 +0100 Subject: [PATCH 07/16] v4.4.2 --- ChangeLog.md | 5 +++++ integration-tests/pom.xml | 2 +- pom.xml | 2 +- tutorial/README.md | 2 +- tutorial/pom.xml | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index c25cc5c7..18440973 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [4.4.2] - 2024-11-08 + +- updated Java Driver to version `7.12.0` + + ## [4.4.1] - 2024-10-23 - updated Java Driver to version `7.10.0` diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index b69b90b0..370ffd66 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -11,7 +11,7 @@ com.arangodb arangodb-spring-data-integration-tests - 4.4.1 + 4.4.2 arangodb-spring-data-integration-tests ArangoDB Spring Data Integration Tests diff --git a/pom.xml b/pom.xml index 61bbde5c..111e727b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.arangodb arangodb-spring-data - 4.4.1 + 4.4.2 2017 jar diff --git a/tutorial/README.md b/tutorial/README.md index 0bf94a72..92421b1b 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -50,7 +50,7 @@ We have to create a Maven `pom.xml`: com.arangodb arangodb-spring-data - 4.4.1 + 4.4.2 diff --git a/tutorial/pom.xml b/tutorial/pom.xml index 28d70ac9..68229599 100644 --- a/tutorial/pom.xml +++ b/tutorial/pom.xml @@ -30,7 +30,7 @@ com.arangodb arangodb-spring-data - 4.4.1 + 4.4.2 org.assertj From 341df22aa03c3012a6591cca6eb62772504936b7 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Wed, 13 Nov 2024 15:09:02 +0100 Subject: [PATCH 08/16] updated Spring Boot v3.3.5 --- integration-tests/pom.xml | 2 +- pom.xml | 2 +- tutorial/README.md | 2 +- tutorial/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 370ffd66..8f25e1b1 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.4 + 3.3.5 diff --git a/pom.xml b/pom.xml index 111e727b..5f44f886 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springframework.data.build spring-data-parent - 3.3.4 + 3.3.5 diff --git a/tutorial/README.md b/tutorial/README.md index 92421b1b..4b86fec2 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -27,7 +27,7 @@ We have to create a Maven `pom.xml`: org.springframework.boot spring-boot-starter-parent - 3.3.4 + 3.3.5 com.arangodb diff --git a/tutorial/pom.xml b/tutorial/pom.xml index 68229599..7b646fc9 100644 --- a/tutorial/pom.xml +++ b/tutorial/pom.xml @@ -7,7 +7,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.4 + 3.3.5 com.arangodb From 0541dc12638ad9b94770c1e503c7a121f93f130b Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Thu, 14 Nov 2024 10:32:34 +0100 Subject: [PATCH 09/16] CI: test tutorial with ADB 3.11 (#323) --- .circleci/config.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1fda904f..43f61a05 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -267,7 +267,13 @@ workflows: - '3.3.0' tutorial: jobs: - - tutorial + - tutorial: + name: tutorial-<> + matrix: + parameters: + docker-img: + - 'docker.io/arangodb/arangodb:3.11' + - 'docker.io/arangodb/arangodb:3.12' deploy: jobs: - deploy: From 895b1cdb564c7b20fbb53bf3841bdb4e38506181 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Thu, 12 Dec 2024 09:07:44 +0100 Subject: [PATCH 10/16] update java driver to version 7.15.0 (#324) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5f44f886..833f07ac 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ com.arangodb.springframework - 7.12.0 + 7.15.0 2.0.16 @@ -262,7 +262,7 @@ com.arangodb jackson-dataformat-velocypack - 4.4.0 + 4.5.0 test From 72ec7c6e9a0a3954f40fd27c8f9fe4291b3bad54 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Thu, 12 Dec 2024 09:45:36 +0100 Subject: [PATCH 11/16] Spring Boot 3.4 (#325) * updated Spring Boot 3.4 * v4.5.0-SNAPSHOT --- .circleci/config.yml | 4 ++-- ChangeLog.md | 3 +++ integration-tests/pom.xml | 4 ++-- pom.xml | 4 ++-- tutorial/README.md | 4 ++-- tutorial/pom.xml | 4 ++-- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 43f61a05..16667d2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -263,8 +263,8 @@ workflows: matrix: parameters: spring-boot-version: - - '3.2.6' - - '3.3.0' + - '3.3.6' + - '3.4.0' tutorial: jobs: - tutorial: diff --git a/ChangeLog.md b/ChangeLog.md index 18440973..f26872ae 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +- added support to Spring Data `3.4` +- updated Java Driver to version `7.15.0` +- updated Jackson Dataformat Velocypack to version `4.5.0` ## [4.4.2] - 2024-11-08 diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 8f25e1b1..2dcad5f8 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -5,13 +5,13 @@ org.springframework.boot spring-boot-starter-parent - 3.3.5 + 3.4.0 com.arangodb arangodb-spring-data-integration-tests - 4.4.2 + 4.5.0-SNAPSHOT arangodb-spring-data-integration-tests ArangoDB Spring Data Integration Tests diff --git a/pom.xml b/pom.xml index 833f07ac..8e133c7e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,14 @@ com.arangodb arangodb-spring-data - 4.4.2 + 4.5.0-SNAPSHOT 2017 jar org.springframework.data.build spring-data-parent - 3.3.5 + 3.4.0 diff --git a/tutorial/README.md b/tutorial/README.md index 4b86fec2..10ddc980 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -27,7 +27,7 @@ We have to create a Maven `pom.xml`: org.springframework.boot spring-boot-starter-parent - 3.3.5 + 3.4.0 com.arangodb @@ -50,7 +50,7 @@ We have to create a Maven `pom.xml`: com.arangodb arangodb-spring-data - 4.4.2 + 4.5.0-SNAPSHOT diff --git a/tutorial/pom.xml b/tutorial/pom.xml index 7b646fc9..68025dbc 100644 --- a/tutorial/pom.xml +++ b/tutorial/pom.xml @@ -7,7 +7,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.5 + 3.4.0 com.arangodb @@ -30,7 +30,7 @@ com.arangodb arangodb-spring-data - 4.4.2 + 4.5.0-SNAPSHOT org.assertj From a47c507b027acf004d3fa8201ce79d4e690ff2f7 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Thu, 12 Dec 2024 09:48:27 +0100 Subject: [PATCH 12/16] v4.5.0 --- ChangeLog.md | 2 ++ integration-tests/pom.xml | 2 +- pom.xml | 2 +- tutorial/README.md | 2 +- tutorial/pom.xml | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index f26872ae..7876241e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [4.5.0] - 2024-12-12 + - added support to Spring Data `3.4` - updated Java Driver to version `7.15.0` - updated Jackson Dataformat Velocypack to version `4.5.0` diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 2dcad5f8..dbe889a8 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -11,7 +11,7 @@ com.arangodb arangodb-spring-data-integration-tests - 4.5.0-SNAPSHOT + 4.5.0 arangodb-spring-data-integration-tests ArangoDB Spring Data Integration Tests diff --git a/pom.xml b/pom.xml index 8e133c7e..42b83d95 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.arangodb arangodb-spring-data - 4.5.0-SNAPSHOT + 4.5.0 2017 jar diff --git a/tutorial/README.md b/tutorial/README.md index 10ddc980..e3751326 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -50,7 +50,7 @@ We have to create a Maven `pom.xml`: com.arangodb arangodb-spring-data - 4.5.0-SNAPSHOT + 4.5.0 diff --git a/tutorial/pom.xml b/tutorial/pom.xml index 68025dbc..9aebd72b 100644 --- a/tutorial/pom.xml +++ b/tutorial/pom.xml @@ -30,7 +30,7 @@ com.arangodb arangodb-spring-data - 4.5.0-SNAPSHOT + 4.5.0 org.assertj From 20e1de1665ee86cc8600122acceea4f989d61cee Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Thu, 12 Dec 2024 10:21:53 +0100 Subject: [PATCH 13/16] aligned the demo to the reference documentation (DE-948) --- tutorial/README.md | 58 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/tutorial/README.md b/tutorial/README.md index e3751326..53aceb4b 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -7,14 +7,21 @@ Spring Boot Starter ArangoDB. A more extensive demo about the features of Spring Data ArangoDB can be found in the [Spring Boot Starter ArangoDB Demo](https://github.com/arangodb/spring-boot-starter/tree/main/demo). -# Getting Started +## Get started -## Build a project with Maven +This tutorial is about how to configure [Spring Data ArangoDB](https://github.com/arangodb/spring-data) +without using Spring Boot Starter ArangoDB. -First, we have to set up a project and add every needed dependency. -We use `Maven` and `Spring Boot` for this demo. +For a more extensive tutorial about the features of Spring Data ArangoDB and +Spring Boot support, see the [Spring Boot Starter](../spring-boot-arangodb.md) +documentation. -We have to create a Maven `pom.xml`: +### Build a project with Maven + +Set up a project and add every needed dependency. This demo uses Maven and +Spring Boot. + +Create a Maven `pom.xml`: ```xml @@ -57,7 +64,10 @@ We have to create a Maven `pom.xml`: ``` -## Entity classes +Substitute the versions with the latest available versions that are compatible. +See the [Supported versions](#supported-versions) for details. + +### Entity classes For this tutorial we will model our entity with a Java record class: @@ -72,7 +82,7 @@ public record Character( } ``` -## Create a repository +### Create a repository Now that we have our data model, we want to store data. For this, we create a repository interface which extends `ArangoRepository`. This gives us access to CRUD operations, paging, and query by example mechanics. @@ -82,7 +92,7 @@ public interface CharacterRepository extends ArangoRepository } ``` -## Create a Configuration class +### Create a Configuration class We need a configuration class to set up everything to connect to our ArangoDB instance and to declare that all needed Spring Beans are processed by the Spring container. @@ -90,7 +100,7 @@ needed Spring Beans are processed by the Spring container. - `@EnableArangoRepositories`: Defines where Spring can find your repositories - `arango()`: Method to configure the connection to the ArangoDB instance - `database()`: Method to define the database name -- `returnOriginalEntities()`: Method to configures the behaviour of repository save methods to either return the +- `returnOriginalEntities()`: Method to configures the behavior of repository save methods to either return the original entities (updated where possible) or new ones. Set to `false` to use java records. ```java @@ -118,7 +128,26 @@ public class AdbConfig implements ArangoConfiguration { } ``` -## Create a CommandLineRunner +Note that, in case the driver is configured to use a protocol with `VPACK` +content type (i.e. `HTTP_VPACK` or `HTTP2_VPACK`), then the +`ArangoConfiguration#contentType()` method must be overridden to return +`ContentType.VPACK` as shown in the following example: + +```java +@Override +public ArangoDB.Builder arango() { + new ArangoDB.Builder() + // ... + .protocol(Protocol.HTTP2_VPACK); +} + +@Override +public ContentType contentType() { + return ContentType.VPACK; +} +``` + +### Create a CommandLineRunner To run our demo as command line application, we have to create a class implementing `CommandLineRunner`: @@ -148,7 +177,7 @@ public class CrudRunner implements CommandLineRunner { } ``` -## Run the applucation +### Run the application Finally, we create a main class: @@ -174,10 +203,3 @@ This should produce a console output similar to: ``` Ned Stark saved in the database: Character[id=2029, name=Ned, surname=Stark] ``` - -# Learn more - -* [ArangoDB](https://www.arangodb.com) -* [Spring Data ArangoDB](https://github.com/arangodb/spring-data) -* [ArangoDB Java Driver](https://github.com/arangodb/arangodb-java-driver) -* [Spring Boot Starter ArangoDB Demo](https://github.com/arangodb/spring-boot-starter/tree/main/demo) From 98d3b1c121483a94a56bb565d26a56c53e2d0f9e Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Wed, 18 Dec 2024 13:10:57 +0100 Subject: [PATCH 14/16] CI: docker cache --- .circleci/config.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 16667d2e..d21e146e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,10 @@ parameters: default: '' commands: + setup_docker: + steps: + - setup_remote_docker: + docker_layer_caching: true timeout: parameters: duration: @@ -129,7 +133,7 @@ jobs: steps: - timeout - checkout - - setup_remote_docker + - setup_docker - start-db: docker-img: <> topology: <> @@ -152,7 +156,7 @@ jobs: steps: - timeout - checkout - - setup_remote_docker + - setup_docker - start-db: docker-img: <> - run: @@ -177,7 +181,7 @@ jobs: steps: - timeout - checkout - - setup_remote_docker + - setup_docker - start-db: docker-img: <> - load_cache From 6b5bb4496b1592b8fd03ed656489665ce356509a Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Thu, 19 Dec 2024 11:30:06 +0100 Subject: [PATCH 15/16] Revert "CI: docker cache" This reverts commit 98d3b1c121483a94a56bb565d26a56c53e2d0f9e. --- .circleci/config.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d21e146e..16667d2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,10 +6,6 @@ parameters: default: '' commands: - setup_docker: - steps: - - setup_remote_docker: - docker_layer_caching: true timeout: parameters: duration: @@ -133,7 +129,7 @@ jobs: steps: - timeout - checkout - - setup_docker + - setup_remote_docker - start-db: docker-img: <> topology: <> @@ -156,7 +152,7 @@ jobs: steps: - timeout - checkout - - setup_docker + - setup_remote_docker - start-db: docker-img: <> - run: @@ -181,7 +177,7 @@ jobs: steps: - timeout - checkout - - setup_docker + - setup_remote_docker - start-db: docker-img: <> - load_cache From c047d5fbc426964eb3b17ba8c08c9cbc31da80cc Mon Sep 17 00:00:00 2001 From: Simran Date: Tue, 13 May 2025 22:15:53 +0200 Subject: [PATCH 16/16] Update README.md (#326) --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 250208fe..4816adc3 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.arangodb/arangodb-spring-data/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.arangodb/arangodb-spring-data) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/arangodb/spring-data/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/arangodb/spring-data/tree/main) -- [Reference](https://www.arangodb.com/docs/stable/drivers/spring-data-reference.html) -- [Tutorial](https://university.arangodb.com/courses/spring-data-tutorial) -- [Migration](https://www.arangodb.com/docs/stable/drivers/spring-data-migration.html) +- [Reference & Tutorial](https://docs.arangodb.com/stable/develop/integrations/spring-data-arangodb/) +- [Migration](https://docs.arangodb.com/stable/develop/integrations/spring-data-arangodb/migration/) ## Learn more -- [ArangoDB](https://www.arangodb.com/) -- [Demo](https://github.com/arangodb/spring-data-demo) +- [ArangoDB](https://arangodb.com/) +- [Demo without Spring Boot Starter](https://github.com/arangodb/spring-data/tree/main/tutorial/src/main/java/com/arangodb/spring/demo) +- [Demo with Spring Boot Starter](https://github.com/arangodb/spring-boot-starter/tree/main/demo) - [Changelog](ChangeLog.md) -- [JavaDoc](https://www.javadoc.io/doc/com.arangodb/arangodb-spring-data/latest) +- [JavaDoc](https://www.javadoc.io/doc/com.arangodb/arangodb-spring-data/latest/index.html)