From 20e1de1665ee86cc8600122acceea4f989d61cee Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Thu, 12 Dec 2024 10:21:53 +0100 Subject: [PATCH 1/9] 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 2/9] 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 3/9] 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 4/9] 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) From 8992e4673b0ac8a03b64c80e082e43f25a5b5b3b Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Tue, 10 Jun 2025 20:00:06 +0200 Subject: [PATCH 5/9] fix CollectionCacheValue concurrency (#328) --- .../springframework/core/template/CollectionCacheValue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/arangodb/springframework/core/template/CollectionCacheValue.java b/src/main/java/com/arangodb/springframework/core/template/CollectionCacheValue.java index 51e88983..1f8d1a42 100644 --- a/src/main/java/com/arangodb/springframework/core/template/CollectionCacheValue.java +++ b/src/main/java/com/arangodb/springframework/core/template/CollectionCacheValue.java @@ -1,7 +1,7 @@ package com.arangodb.springframework.core.template; -import java.util.ArrayList; import java.util.Collection; +import java.util.concurrent.CopyOnWriteArrayList; import com.arangodb.ArangoCollection; @@ -13,7 +13,7 @@ class CollectionCacheValue { public CollectionCacheValue(final ArangoCollection collection) { super(); this.collection = collection; - this.entities = new ArrayList<>(); + this.entities = new CopyOnWriteArrayList<>(); } public ArangoCollection getCollection() { From 7bf1b45f10452ea18ddfffa81e3fad88143b6217 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Wed, 18 Jun 2025 16:03:45 +0200 Subject: [PATCH 6/9] [DE-1027] Spring Data 3.5 (#329) * updated spring data version to 3.5 * fix dependency convergence * updated Java driver to version 7.20.0 --- .circleci/config.yml | 1 + ChangeLog.md | 3 +++ integration-tests/pom.xml | 4 ++-- pom.xml | 13 +++++++++---- tutorial/README.md | 4 ++-- tutorial/pom.xml | 4 ++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 16667d2e..f034526e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -265,6 +265,7 @@ workflows: spring-boot-version: - '3.3.6' - '3.4.0' + - '3.5.0' tutorial: jobs: - tutorial: diff --git a/ChangeLog.md b/ChangeLog.md index 7876241e..36e86ceb 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.5` (DE-1027, #329) +- updated Java Driver to version `7.20.0` + ## [4.5.0] - 2024-12-12 - added support to Spring Data `3.4` diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index dbe889a8..654708b1 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -5,13 +5,13 @@ org.springframework.boot spring-boot-starter-parent - 3.4.0 + 3.5.0 com.arangodb arangodb-spring-data-integration-tests - 4.5.0 + 4.6.0-SNAPSHOT arangodb-spring-data-integration-tests ArangoDB Spring Data Integration Tests diff --git a/pom.xml b/pom.xml index 42b83d95..d41684a7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,14 @@ com.arangodb arangodb-spring-data - 4.5.0 + 4.6.0-SNAPSHOT 2017 jar org.springframework.data.build spring-data-parent - 3.4.0 + 3.5.0 @@ -61,10 +61,10 @@ com.arangodb.springframework - 7.15.0 + 7.20.0 - 2.0.16 + 2.0.17 @@ -309,6 +309,11 @@ vst-protocol ${arangodb.version} + + ch.qos.logback + logback-core + 1.5.12 + diff --git a/tutorial/README.md b/tutorial/README.md index 53aceb4b..ab81eb44 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -34,7 +34,7 @@ Create a Maven `pom.xml`: org.springframework.boot spring-boot-starter-parent - 3.4.0 + 3.5.0 com.arangodb @@ -57,7 +57,7 @@ Create a Maven `pom.xml`: com.arangodb arangodb-spring-data - 4.5.0 + 4.6.0-SNAPSHOT diff --git a/tutorial/pom.xml b/tutorial/pom.xml index 9aebd72b..9aba0ab0 100644 --- a/tutorial/pom.xml +++ b/tutorial/pom.xml @@ -7,7 +7,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.0 + 3.5.0 com.arangodb @@ -30,7 +30,7 @@ com.arangodb arangodb-spring-data - 4.5.0 + 4.6.0-SNAPSHOT org.assertj From e6a0f6006f9976f9316957a9c9deb8e46ef67e7d Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Wed, 18 Jun 2025 16:06:55 +0200 Subject: [PATCH 7/9] v4.6.0 --- ChangeLog.md | 3 +++ integration-tests/pom.xml | 2 +- pom.xml | 2 +- tutorial/README.md | 2 +- tutorial/pom.xml | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 36e86ceb..9c0bcf35 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -6,8 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [4.6.0] - 2025-06-18 + - added support to Spring Data `3.5` (DE-1027, #329) - updated Java Driver to version `7.20.0` +- fixed `CollectionCacheValue` concurrency (#328) ## [4.5.0] - 2024-12-12 diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 654708b1..9cd1974f 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -11,7 +11,7 @@ com.arangodb arangodb-spring-data-integration-tests - 4.6.0-SNAPSHOT + 4.6.0 arangodb-spring-data-integration-tests ArangoDB Spring Data Integration Tests diff --git a/pom.xml b/pom.xml index d41684a7..c6b95424 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.arangodb arangodb-spring-data - 4.6.0-SNAPSHOT + 4.6.0 2017 jar diff --git a/tutorial/README.md b/tutorial/README.md index ab81eb44..ab2403b0 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -57,7 +57,7 @@ Create a Maven `pom.xml`: com.arangodb arangodb-spring-data - 4.6.0-SNAPSHOT + 4.6.0 diff --git a/tutorial/pom.xml b/tutorial/pom.xml index 9aba0ab0..194d1b9f 100644 --- a/tutorial/pom.xml +++ b/tutorial/pom.xml @@ -30,7 +30,7 @@ com.arangodb arangodb-spring-data - 4.6.0-SNAPSHOT + 4.6.0 org.assertj From 4232bcbce8dfa1c249de0cfa6a20e8c5552b27c8 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Tue, 29 Jul 2025 11:36:09 +0200 Subject: [PATCH 8/9] CI: set enterprise as test default (DE-1046) --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f034526e..81e96e2c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ commands: parameters: docker-img: type: 'string' - default: 'docker.io/arangodb/arangodb:latest' + default: 'docker.io/arangodb/enterprise:latest' topology: type: 'string' default: 'single' @@ -118,7 +118,7 @@ jobs: parameters: docker-img: type: 'string' - default: 'docker.io/arangodb/arangodb:latest' + default: 'docker.io/arangodb/enterprise:latest' topology: type: 'string' default: 'single' @@ -144,7 +144,7 @@ jobs: parameters: docker-img: type: 'string' - default: 'docker.io/arangodb/arangodb:latest' + default: 'docker.io/arangodb/enterprise:latest' spring-boot-version: type: 'string' default: '3.2.6' @@ -172,7 +172,7 @@ jobs: parameters: docker-img: type: 'string' - default: 'docker.io/arangodb/arangodb:latest' + default: 'docker.io/arangodb/enterprise:latest' executor: 'j21' steps: - timeout From a29e5ec970f579955a8c423e7654c3c8341ab863 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Tue, 29 Jul 2025 21:05:05 +0200 Subject: [PATCH 9/9] [DE-1050] Migrate to Maven Central Publishing Portal (#332) * [DE-1050] Migrate to Maven Central Publishing Portal * maven flatten plugin --- .circleci/config.yml | 29 --------- .circleci/maven-release-settings.xml | 8 +-- .gitignore | 1 + integration-tests/pom.xml | 2 +- pom.xml | 89 +++++++++++----------------- tutorial/README.md | 2 +- tutorial/pom.xml | 2 +- 7 files changed, 42 insertions(+), 91 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 81e96e2c..6b785d3d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,14 +96,6 @@ commands: - run: name: Deploy to Apache Maven Central command: mvn -s .circleci/maven-release-settings.xml -Dmaven.test.skip=true deploy - release: - steps: - - run: - name: Release to Apache Maven Central - command: mvn -s .circleci/maven-release-settings.xml -Dmaven.test.skip=true nexus-staging:release - environment: - MAVEN_OPTS: "--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED" - executors: j17: @@ -199,18 +191,6 @@ jobs: - deploy - store_cache - release: - executor: 'j17' - steps: - - timeout - - checkout - - load_cache - - mvn-info - - config_gpg - - deploy - - release - - store_cache - workflows: test-adb-version: when: @@ -284,12 +264,3 @@ workflows: only: /^deploy.*/ branches: ignore: /.*/ - release: - jobs: - - release: - context: java-release - filters: - tags: - only: /^release.*/ - branches: - ignore: /.*/ diff --git a/.circleci/maven-release-settings.xml b/.circleci/maven-release-settings.xml index be5b9aef..d8e10fc5 100644 --- a/.circleci/maven-release-settings.xml +++ b/.circleci/maven-release-settings.xml @@ -3,7 +3,7 @@ - ossrh + central true @@ -16,9 +16,9 @@ - ossrh - ${env.OSSRH_USERNAME} - ${env.OSSRH_PASSWORD} + central + ${env.CENTRAL_USERNAME} + ${env.CENTRAL_PASSWORD} diff --git a/.gitignore b/.gitignore index 9b90181b..6e6b15c8 100644 --- a/.gitignore +++ b/.gitignore @@ -248,3 +248,4 @@ fabric.properties .idea arangodb-spring-data.iml +/.flattened-pom.xml diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 9cd1974f..24bc9fb1 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -11,7 +11,7 @@ com.arangodb arangodb-spring-data-integration-tests - 4.6.0 + 4.7.0-SNAPSHOT arangodb-spring-data-integration-tests ArangoDB Spring Data Integration Tests diff --git a/pom.xml b/pom.xml index c6b95424..560d8cea 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.arangodb arangodb-spring-data - 4.6.0 + 4.7.0-SNAPSHOT 2017 jar @@ -35,21 +35,10 @@ - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - arangodb-snapshots - https://oss.sonatype.org/content/groups/staging + https://central.sonatype.com/repository/maven-snapshots/ true @@ -89,44 +78,6 @@ - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.7.0 - true - - ossrh - https://oss.sonatype.org/ - 84aff6e87e214c - false - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.4.1 - - - assembly - package - - single - - - - - - ${project.artifactId}-${project.version}-standalone - - false - false - - jar-with-dependencies - - - - org.apache.maven.plugins maven-compiler-plugin @@ -189,11 +140,14 @@ - org.apache.maven.plugins - maven-deploy-plugin - 3.1.1 + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true - 10 + central + true + published @@ -218,6 +172,31 @@ + + org.codehaus.mojo + flatten-maven-plugin + 1.7.1 + + oss + + + + flatten + prepare-package + + flatten + + + + flatten.clean + clean + + clean + + + + + diff --git a/tutorial/README.md b/tutorial/README.md index ab2403b0..f599a099 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -57,7 +57,7 @@ Create a Maven `pom.xml`: com.arangodb arangodb-spring-data - 4.6.0 + 4.7.0-SNAPSHOT diff --git a/tutorial/pom.xml b/tutorial/pom.xml index 194d1b9f..3c2ca493 100644 --- a/tutorial/pom.xml +++ b/tutorial/pom.xml @@ -30,7 +30,7 @@ com.arangodb arangodb-spring-data - 4.6.0 + 4.7.0-SNAPSHOT org.assertj