Skip to content

Commit

Permalink
build: upgrade to Spring Boot 3 + Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
aoudiamoncef committed Nov 6, 2023
1 parent 391d468 commit 25d8d55
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 24 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/bulk-update-with-spring-data-mongodb-reactive" # Location of package manifests
schedule:
interval: "monthly" # Check for updates every month
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

env:
COMMIT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
BRANCH: ${{ github.event_name == 'pull_request' && format('refs/heads/{0}', github.event.pull_request.head.ref) || github.ref }}

jobs:
build:
name: Build PinStack API
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK 21 for x64
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
architecture: x64
cache: maven

- name: Build and test Maven projects
run: |
for project in $(find . -name "pom.xml" -exec dirname {} \;); do
echo "Building and testing project in folder: $project"
(cd "$project" && mvn --batch-mode --update-snapshots clean verify)
if [ $? -ne 0 ]; then
echo "Failed to build or test project in folder: $project"
exit 1
fi
done
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,37 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
6 changes: 3 additions & 3 deletions bulk-update-with-spring-data-mongodb-reactive/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ The following guides illustrate how to use some features concretely:
For further reference, please consider the following sections:

* https://maven.apache.org/guides/index.html/[Official Apache Maven documentation]
* https://docs.spring.io/spring-boot/docs/2.7.0/maven-plugin/reference/html/[Spring Boot Maven Plugin Reference Guide]
* https://docs.spring.io/spring-boot/docs/2.7.0/maven-plugin/reference/html/#build-image/[Create an OCI image]
* https://docs.spring.io/spring-boot/docs/3.1.5/maven-plugin/reference/html/[Spring Boot Maven Plugin Reference Guide]
* https://docs.spring.io/spring-boot/docs/3.1.5/maven-plugin/reference/html/#build-image/[Create an OCI image]
* https://www.testcontainers.org/modules/databases/mongodb/[Testcontainers MongoDB Module Reference Guide]
* https://docs.spring.io/spring-boot/docs/2.7.0/reference/htmlsingle/#data.nosql.mongodb/[Spring Data Reactive MongoDB]
* https://docs.spring.io/spring-boot/docs/3.1.5/reference/htmlsingle/#data.nosql.mongodb/[Spring Data Reactive MongoDB]
* https://www.testcontainers.org/[Testcontainers]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: '3.1'
services:
mongodb:
container_name: maoudia-mongodb
image: mongo:5.0.8
image: mongo:7.0.2
environment:
- MONGO_INITDB_DATABASE=test
- MONGO_INITDB_ROOT_USERNAME=admin
Expand All @@ -15,7 +16,7 @@ services:

mongo-express:
container_name: maoudia-mongo-express
image: mongo-express:0.54.0
image: mongo-express:1.0.0
depends_on:
- mongodb
networks:
Expand All @@ -24,6 +25,8 @@ services:
- ME_CONFIG_MONGODB_SERVER=maoudia-mongodb
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
- ME_CONFIG_MONGODB_ADMINPASSWORD=password
- ME_CONFIG_BASICAUTH_USERNAME=admin
- ME_CONFIG_BASICAUTH_PASSWORD=password
ports:
- 1515:8081
volumes:
Expand Down
17 changes: 2 additions & 15 deletions bulk-update-with-spring-data-mongodb-reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<version>3.1.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.maoudia</groupId>
Expand All @@ -14,8 +14,7 @@
<name>Bulk Update with Spring data MongoDB Reactive</name>
<description>Bulk Update with Spring data MongoDB Reactive</description>
<properties>
<java.version>1.8</java.version>
<testcontainers.version>1.17.2</testcontainers.version>
<java.version>21</java.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -48,17 +47,6 @@
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>${testcontainers.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
Expand All @@ -67,5 +55,4 @@
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.maoudia.tutorial;

import com.mongodb.bulk.BulkWriteResult;
import com.mongodb.bulk.BulkWriteUpsert;
import com.mongodb.internal.bulk.WriteRequest;
import org.bson.BsonValue;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -29,7 +26,7 @@
class CollectionServiceTest {

@Container
private static final MongoDBContainer mongoDBContainer = new MongoDBContainer("mongo:5.0.8")
private static final MongoDBContainer mongoDBContainer = new MongoDBContainer("mongo:7.0.2")
.withReuse(true);

@DynamicPropertySource
Expand Down

0 comments on commit 25d8d55

Please sign in to comment.