diff --git a/apache-olingo/pom.xml b/apache-olingo/pom.xml
index 5de0dfd511..25aab0ec97 100644
--- a/apache-olingo/pom.xml
+++ b/apache-olingo/pom.xml
@@ -83,4 +83,4 @@
2.0.11
-
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-9-new-features/pom.xml b/core-java-modules/core-java-9-new-features/pom.xml
index ce90a0f04a..78ffaff010 100644
--- a/core-java-modules/core-java-9-new-features/pom.xml
+++ b/core-java-modules/core-java-9-new-features/pom.xml
@@ -34,6 +34,28 @@
+
+ core-java-9-new-features
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+
+
+
+
+
+
+
+ apache.snapshots
+ https://repository.apache.org/snapshots/
+
+
+
incubator-features
@@ -126,28 +148,6 @@
-
- core-java-9-new-features
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
- ${maven.compiler.source}
- ${maven.compiler.target}
-
-
-
-
-
-
-
- apache.snapshots
- https://repository.apache.org/snapshots/
-
-
-
3.0.0
4.0.2
diff --git a/core-java-modules/core-java-concurrency-basic-3/pom.xml b/core-java-modules/core-java-concurrency-basic-3/pom.xml
index 20615e3250..7771d1200c 100644
--- a/core-java-modules/core-java-concurrency-basic-3/pom.xml
+++ b/core-java-modules/core-java-concurrency-basic-3/pom.xml
@@ -24,4 +24,4 @@
-
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-date-operations-1/pom.xml b/core-java-modules/core-java-date-operations-1/pom.xml
index ea9f94fa56..c5d46723d8 100644
--- a/core-java-modules/core-java-date-operations-1/pom.xml
+++ b/core-java-modules/core-java-date-operations-1/pom.xml
@@ -25,7 +25,6 @@
commons-lang3
${commons-lang3.version}
-
com.darwinsys
hirondelle-date4j
diff --git a/core-java-modules/core-java-jar/pom.xml b/core-java-modules/core-java-jar/pom.xml
index 714a370287..19da9b8a56 100644
--- a/core-java-modules/core-java-jar/pom.xml
+++ b/core-java-modules/core-java-jar/pom.xml
@@ -259,7 +259,7 @@
-
+
diff --git a/core-java-modules/core-java-jvm/pom.xml b/core-java-modules/core-java-jvm/pom.xml
index e4c0f949c2..d26c72323f 100644
--- a/core-java-modules/core-java-jvm/pom.xml
+++ b/core-java-modules/core-java-jvm/pom.xml
@@ -64,13 +64,6 @@
-
- 3.27.0-GA
- 1.8.0
- 0.10
- 8.0.1
- 6.5.0
-
@@ -181,4 +174,12 @@
+
+ 3.27.0-GA
+ 1.8.0
+ 0.10
+ 8.0.1
+ 6.5.0
+
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-serialization/pom.xml b/core-java-modules/core-java-serialization/pom.xml
index 315ed8cdad..c82ae9d1d6 100644
--- a/core-java-modules/core-java-serialization/pom.xml
+++ b/core-java-modules/core-java-serialization/pom.xml
@@ -64,7 +64,6 @@
true
-
org.apache.maven.plugins
diff --git a/core-java-modules/core-java-string-algorithms-3/pom.xml b/core-java-modules/core-java-string-algorithms-3/pom.xml
index dc8ad3851d..147ea22375 100644
--- a/core-java-modules/core-java-string-algorithms-3/pom.xml
+++ b/core-java-modules/core-java-string-algorithms-3/pom.xml
@@ -54,4 +54,5 @@
1.7
3.12.0
+
\ No newline at end of file
diff --git a/core-java-modules/core-java/pom.xml b/core-java-modules/core-java/pom.xml
index 188c6a6f63..bb19b525d0 100644
--- a/core-java-modules/core-java/pom.xml
+++ b/core-java-modules/core-java/pom.xml
@@ -69,7 +69,6 @@
true
-
org.apache.maven.plugins
diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml
index 60319b4de4..2f684beea0 100644
--- a/core-java-modules/pom.xml
+++ b/core-java-modules/pom.xml
@@ -137,4 +137,4 @@
-
+
\ No newline at end of file
diff --git a/ddd-modules/infrastructure/pom.xml b/ddd-modules/infrastructure/pom.xml
index abf90935c3..232e5ff4b4 100644
--- a/ddd-modules/infrastructure/pom.xml
+++ b/ddd-modules/infrastructure/pom.xml
@@ -1,13 +1,11 @@
-
4.0.0
com.baeldung.dddmodules.infrastructure
infrastructure
1.0
-
jar
diff --git a/ddd-modules/mainapp/pom.xml b/ddd-modules/mainapp/pom.xml
index 6b913df979..a2d3b8f3ea 100644
--- a/ddd-modules/mainapp/pom.xml
+++ b/ddd-modules/mainapp/pom.xml
@@ -1,6 +1,5 @@
-
4.0.0
diff --git a/ddd-modules/ordercontext/pom.xml b/ddd-modules/ordercontext/pom.xml
index 8dee3a5148..eaf44badd3 100644
--- a/ddd-modules/ordercontext/pom.xml
+++ b/ddd-modules/ordercontext/pom.xml
@@ -1,6 +1,5 @@
-
4.0.0
@@ -13,7 +12,6 @@
com.baeldung.dddmodules
ddd-modules
1.0
- ../
diff --git a/ddd-modules/pom.xml b/ddd-modules/pom.xml
index 134a9d0566..d2932ee515 100644
--- a/ddd-modules/pom.xml
+++ b/ddd-modules/pom.xml
@@ -1,6 +1,5 @@
-
4.0.0
@@ -14,7 +13,6 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
- ../
@@ -70,10 +68,8 @@
9
9
-
3.8.1
-
1.0
-
+
\ No newline at end of file
diff --git a/ddd-modules/sharedkernel/pom.xml b/ddd-modules/sharedkernel/pom.xml
index 1afddf1e22..3966e1c26e 100644
--- a/ddd-modules/sharedkernel/pom.xml
+++ b/ddd-modules/sharedkernel/pom.xml
@@ -1,6 +1,5 @@
-
4.0.0
@@ -13,7 +12,6 @@
com.baeldung.dddmodules
ddd-modules
1.0
- ../
diff --git a/ddd-modules/shippingcontext/pom.xml b/ddd-modules/shippingcontext/pom.xml
index 25b5882ef1..a6e6167b69 100644
--- a/ddd-modules/shippingcontext/pom.xml
+++ b/ddd-modules/shippingcontext/pom.xml
@@ -1,6 +1,5 @@
-
4.0.0
@@ -13,7 +12,6 @@
com.baeldung.dddmodules
ddd-modules
1.0
- ../
diff --git a/geotools/pom.xml b/geotools/pom.xml
index b9a6a7c91f..05cae922a4 100644
--- a/geotools/pom.xml
+++ b/geotools/pom.xml
@@ -15,6 +15,14 @@
1.0.0-SNAPSHOT
+
+
+ osgeo-release
+ OSGeo Repository
+ https://repo.osgeo.org/repository/release/
+
+
+
org.geotools
@@ -33,14 +41,6 @@
-
-
- osgeo-release
- OSGeo Repository
- https://repo.osgeo.org/repository/release/
-
-
-
15.2
15.2
diff --git a/graphql/graphql-dgs/pom.xml b/graphql/graphql-dgs/pom.xml
index 1dc3630276..6165ae839f 100644
--- a/graphql/graphql-dgs/pom.xml
+++ b/graphql/graphql-dgs/pom.xml
@@ -33,26 +33,22 @@
spring-boot-starter
2.6.2
-
org.springframework.boot
spring-boot-starter-test
2.6.2
test
-
com.netflix.graphql.dgs.codegen
graphql-dgs-codegen-client-core
5.1.14
-
org.springframework.boot
spring-boot-starter-web
2.6.2
-
com.netflix.graphql.dgs
graphql-dgs-spring-boot-starter
@@ -88,4 +84,4 @@
-
+
\ No newline at end of file
diff --git a/httpclient-2/pom.xml b/httpclient-2/pom.xml
index 85fc1d87e7..287ff27e35 100644
--- a/httpclient-2/pom.xml
+++ b/httpclient-2/pom.xml
@@ -1,6 +1,7 @@
-
+
4.0.0
httpclient-2
0.1-SNAPSHOT
diff --git a/java-collections-maps-3/pom.xml b/java-collections-maps-3/pom.xml
index a54061404d..729b357b76 100644
--- a/java-collections-maps-3/pom.xml
+++ b/java-collections-maps-3/pom.xml
@@ -22,7 +22,6 @@
junit-jupiter-api
5.8.1
-
org.springframework
spring-core
diff --git a/javax-servlets-2/pom.xml b/javax-servlets-2/pom.xml
index 34c00c3d05..5d8310f2b2 100644
--- a/javax-servlets-2/pom.xml
+++ b/javax-servlets-2/pom.xml
@@ -57,4 +57,5 @@
4.5.13
4.0.1
-
+
+
\ No newline at end of file
diff --git a/javaxval/pom.xml b/javaxval/pom.xml
index 4131ddeb97..e6ecee6cfb 100644
--- a/javaxval/pom.xml
+++ b/javaxval/pom.xml
@@ -37,35 +37,13 @@
-
+
6.0.13.Final
@@ -77,4 +55,4 @@
5.0.2.RELEASE
-
+
\ No newline at end of file
diff --git a/jta/pom.xml b/jta/pom.xml
index e62c480c81..906d28a7ea 100644
--- a/jta/pom.xml
+++ b/jta/pom.xml
@@ -15,7 +15,7 @@
0.0.1-SNAPSHOT
../parent-boot-2
-
+
diff --git a/ksqldb/pom.xml b/ksqldb/pom.xml
index ee4906090f..e55398d635 100644
--- a/ksqldb/pom.xml
+++ b/ksqldb/pom.xml
@@ -11,7 +11,6 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
- ../pom.xml
diff --git a/libraries-concurrency/pom.xml b/libraries-concurrency/pom.xml
index d8f48a1959..eb581ce3a0 100644
--- a/libraries-concurrency/pom.xml
+++ b/libraries-concurrency/pom.xml
@@ -1,7 +1,7 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
libraries-concurrency
libraries-concurrency
@@ -78,5 +78,5 @@
0.8.0
-
+
\ No newline at end of file
diff --git a/lombok-2/pom.xml b/lombok-2/pom.xml
index 3c67e959a4..bde328444e 100644
--- a/lombok-2/pom.xml
+++ b/lombok-2/pom.xml
@@ -22,4 +22,4 @@
-
+
\ No newline at end of file
diff --git a/lombok/pom.xml b/lombok/pom.xml
index d4f89ab4f2..24a04783d1 100644
--- a/lombok/pom.xml
+++ b/lombok/pom.xml
@@ -62,18 +62,9 @@
false
-
+
diff --git a/maven-modules/maven-classifier/maven-classifier-example-consumer/pom.xml b/maven-modules/maven-classifier/maven-classifier-example-consumer/pom.xml
index cbf046ed5a..b280f21b4b 100644
--- a/maven-modules/maven-classifier/maven-classifier-example-consumer/pom.xml
+++ b/maven-modules/maven-classifier/maven-classifier-example-consumer/pom.xml
@@ -1,22 +1,16 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+ maven-classifier-example-consumer
+
maven-classifier
com.baeldung
0.0.1-SNAPSHOT
- 4.0.0
-
- maven-classifier-example-consumer
-
-
- 8
- 8
-
-
com.baeldung
@@ -29,13 +23,14 @@
0.0.1-SNAPSHOT
arbitrary
-
-
-
-
-
-
-
+
+
+
+
+
+
+
com.baeldung
maven-classifier-example-provider
@@ -50,4 +45,9 @@
-
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/maven-modules/maven-classifier/maven-classifier-example-provider/pom.xml b/maven-modules/maven-classifier/maven-classifier-example-provider/pom.xml
index 12cb4fa1a2..111996c995 100644
--- a/maven-modules/maven-classifier/maven-classifier-example-provider/pom.xml
+++ b/maven-modules/maven-classifier/maven-classifier-example-provider/pom.xml
@@ -1,9 +1,10 @@
-
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+ maven-classifier-example-provider
+ 0.0.1-SNAPSHOT
maven-classifier
@@ -11,15 +12,6 @@
0.0.1-SNAPSHOT
- maven-classifier-example-provider
- 0.0.1-SNAPSHOT
-
-
- 8
- 8
-
-
-
@@ -39,21 +31,22 @@
true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -76,18 +69,19 @@
test-jar
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -119,4 +113,11 @@
-
+
+
+ 8
+ 8
+
+
+
+
\ No newline at end of file
diff --git a/maven-modules/maven-classifier/pom.xml b/maven-modules/maven-classifier/pom.xml
index 6b75f60893..ba5f248ff6 100644
--- a/maven-modules/maven-classifier/pom.xml
+++ b/maven-modules/maven-classifier/pom.xml
@@ -1,9 +1,8 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
-
maven-classifier
pom
0.0.1-SNAPSHOT
@@ -24,4 +23,4 @@
8
-
+
\ No newline at end of file
diff --git a/maven-modules/maven-generate-war/pom.xml b/maven-modules/maven-generate-war/pom.xml
index b388cfdadd..51eb54846c 100644
--- a/maven-modules/maven-generate-war/pom.xml
+++ b/maven-modules/maven-generate-war/pom.xml
@@ -6,8 +6,8 @@
com.baeldung
maven-generate-war
0.0.1-SNAPSHOT
- war
maven-generate-war
+ war
Spring boot project to demonstrate war file generation
diff --git a/maven-modules/maven-simple/parent-project/core/pom.xml b/maven-modules/maven-simple/parent-project/core/pom.xml
index 8f7371639f..a403a59e84 100644
--- a/maven-modules/maven-simple/parent-project/core/pom.xml
+++ b/maven-modules/maven-simple/parent-project/core/pom.xml
@@ -13,4 +13,4 @@
1.0.0-SNAPSHOT
-
+
\ No newline at end of file
diff --git a/maven-modules/maven-simple/parent-project/pom.xml b/maven-modules/maven-simple/parent-project/pom.xml
index fce9aa3f72..7193b61ad7 100644
--- a/maven-modules/maven-simple/parent-project/pom.xml
+++ b/maven-modules/maven-simple/parent-project/pom.xml
@@ -18,4 +18,5 @@
service
webapp
-
+
+
\ No newline at end of file
diff --git a/maven-modules/maven-simple/parent-project/service/pom.xml b/maven-modules/maven-simple/parent-project/service/pom.xml
index 39945af248..ee51b51d1b 100644
--- a/maven-modules/maven-simple/parent-project/service/pom.xml
+++ b/maven-modules/maven-simple/parent-project/service/pom.xml
@@ -13,4 +13,4 @@
1.0.0-SNAPSHOT
-
+
\ No newline at end of file
diff --git a/maven-modules/maven-simple/parent-project/webapp/pom.xml b/maven-modules/maven-simple/parent-project/webapp/pom.xml
index 1ab1321b20..d034d4e7d1 100644
--- a/maven-modules/maven-simple/parent-project/webapp/pom.xml
+++ b/maven-modules/maven-simple/parent-project/webapp/pom.xml
@@ -13,4 +13,4 @@
1.0.0-SNAPSHOT
-
+
\ No newline at end of file
diff --git a/metrics/pom.xml b/metrics/pom.xml
index abdfb14dc6..37b10ef484 100644
--- a/metrics/pom.xml
+++ b/metrics/pom.xml
@@ -92,4 +92,4 @@
1.1.0
-
+
\ No newline at end of file
diff --git a/netty/pom.xml b/netty/pom.xml
index 817b1f2e70..c235ec9f4a 100644
--- a/netty/pom.xml
+++ b/netty/pom.xml
@@ -1,6 +1,7 @@
-
+
4.0.0
netty
0.0.1-SNAPSHOT
@@ -11,20 +12,18 @@
parent-modules
1.0.0-SNAPSHOT
-
+
io.netty
netty-all
${netty.version}
-
-
+
org.conscrypt
conscrypt-openjdk-uber
${conscrypt-openjdk-uber.version}
-
diff --git a/patterns/enterprise-patterns/pom.xml b/patterns/enterprise-patterns/pom.xml
index 999b359170..2228cc9505 100644
--- a/patterns/enterprise-patterns/pom.xml
+++ b/patterns/enterprise-patterns/pom.xml
@@ -16,6 +16,25 @@
wire-tap
+
+
+
+ org.apache.camel.springboot
+ camel-spring-boot-dependencies
+ ${camel.version}
+ pom
+ import
+
+
+ org.apache.logging.log4j
+ log4j-bom
+ ${log4j2.version}
+ import
+ pom
+
+
+
+
org.apache.camel.springboot
@@ -39,25 +58,6 @@
-
-
-
- org.apache.camel.springboot
- camel-spring-boot-dependencies
- ${camel.version}
- pom
- import
-
-
- org.apache.logging.log4j
- log4j-bom
- ${log4j2.version}
- import
- pom
-
-
-
-
@@ -70,7 +70,7 @@
3.7.4
2.2.2.RELEASE
- 2.17.1
+ 2.17.1
\ No newline at end of file
diff --git a/persistence-modules/hibernate-mapping-2/pom.xml b/persistence-modules/hibernate-mapping-2/pom.xml
index 06a1535442..8cec8d5d34 100644
--- a/persistence-modules/hibernate-mapping-2/pom.xml
+++ b/persistence-modules/hibernate-mapping-2/pom.xml
@@ -54,22 +54,22 @@
com.h2database
h2
${h2.version}
-
-
- com.sun.xml.bind
- jaxb-core
- ${com.sun.xml.version}
-
-
- javax.xml.bind
- jaxb-api
- ${javax.xml.bind.version}
-
-
- com.sun.xml.bind
- jaxb-impl
- ${com.sun.xml.version}
-
+
+
+ com.sun.xml.bind
+ jaxb-core
+ ${com.sun.xml.version}
+
+
+ javax.xml.bind
+ jaxb-api
+ ${javax.xml.bind.version}
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ ${com.sun.xml.version}
+
diff --git a/persistence-modules/java-cassandra/pom.xml b/persistence-modules/java-cassandra/pom.xml
index b0b98b040a..0dd148e528 100644
--- a/persistence-modules/java-cassandra/pom.xml
+++ b/persistence-modules/java-cassandra/pom.xml
@@ -77,4 +77,4 @@
4.1.71.Final
-
+
\ No newline at end of file
diff --git a/persistence-modules/java-mongodb-2/.gitignore b/persistence-modules/java-mongodb-2/.gitignore
new file mode 100644
index 0000000000..79ba317cb5
--- /dev/null
+++ b/persistence-modules/java-mongodb-2/.gitignore
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+target
+build
\ No newline at end of file
diff --git a/persistence-modules/java-mongodb-2/README.md b/persistence-modules/java-mongodb-2/README.md
new file mode 100644
index 0000000000..1b49e11499
--- /dev/null
+++ b/persistence-modules/java-mongodb-2/README.md
@@ -0,0 +1,5 @@
+## MongoDB
+
+This module contains articles about MongoDB in Java.
+
+
diff --git a/persistence-modules/java-mongodb-2/pom.xml b/persistence-modules/java-mongodb-2/pom.xml
new file mode 100644
index 0000000000..ffc8da0b64
--- /dev/null
+++ b/persistence-modules/java-mongodb-2/pom.xml
@@ -0,0 +1,53 @@
+
+
+ 4.0.0
+ java-mongodb-2
+ 1.0-SNAPSHOT
+ java-mongodb-2
+
+
+ com.baeldung
+ persistence-modules
+ 1.0.0-SNAPSHOT
+
+
+
+
+ de.flapdoodle.embedmongo
+ de.flapdoodle.embedmongo
+ ${flapdoodle.version}
+ test
+
+
+ org.mongodb
+ mongo-java-driver
+ ${mongo.version}
+
+
+ dev.morphia.morphia
+ core
+ ${morphia.version}
+
+
+ org.testcontainers
+ mongodb
+ 1.16.3
+ test
+
+
+ org.testcontainers
+ junit-jupiter
+ 1.16.3
+ test
+
+
+
+
+ 3.12.1
+ 1.11
+ 1.5.3
+
+
+
diff --git a/persistence-modules/java-mongodb-2/src/main/java/com/baeldung/mongo/update/PustSetOperation.java b/persistence-modules/java-mongodb-2/src/main/java/com/baeldung/mongo/update/PustSetOperation.java
new file mode 100644
index 0000000000..bb7eca4f23
--- /dev/null
+++ b/persistence-modules/java-mongodb-2/src/main/java/com/baeldung/mongo/update/PustSetOperation.java
@@ -0,0 +1,54 @@
+package com.baeldung.mongo.update;
+
+import org.bson.Document;
+
+import com.mongodb.MongoClient;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.client.model.Filters;
+import com.mongodb.client.model.Updates;
+import com.mongodb.client.result.UpdateResult;
+
+public class PustSetOperation {
+
+ private static MongoClient mongoClient;
+
+ private static String testCollectionName;
+ private static String databaseName;
+
+ public static void setUp() {
+ if (mongoClient == null) {
+ mongoClient = new MongoClient("localhost", 27017);
+ }
+ databaseName = "baeldung";
+ testCollectionName = "marks";
+ }
+
+ public static void pushSetSolution() {
+
+ MongoDatabase database = mongoClient.getDatabase(databaseName);
+ MongoCollection collection = database.getCollection(testCollectionName);
+
+ Document subjectData = new Document().append("subjectId", 126)
+ .append("subjectName", "Java Programming")
+ .append("marks", 70);
+ UpdateResult updateQueryResult = collection.updateOne(Filters.eq("studentId", 1023), Updates.combine(Updates.set("totalMarks", 170), Updates.push("subjectDetails", subjectData)));
+ System.out.println("updateQueryResult:- " + updateQueryResult);
+
+ }
+
+ public static void main(String args[]) {
+
+ //
+ // Connect to cluster (default is localhost:27017)
+ //
+ setUp();
+
+ //
+ // Push document into the array and set a field
+ //
+ pushSetSolution();
+
+ }
+}
+
diff --git a/persistence-modules/java-mongodb-2/src/main/resources/logback.xml b/persistence-modules/java-mongodb-2/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/persistence-modules/java-mongodb-2/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/persistence-modules/java-mongodb-2/src/test/java/com/baeldung/mongo/update/PustSetOperationLiveTest.java b/persistence-modules/java-mongodb-2/src/test/java/com/baeldung/mongo/update/PustSetOperationLiveTest.java
new file mode 100644
index 0000000000..6279747429
--- /dev/null
+++ b/persistence-modules/java-mongodb-2/src/test/java/com/baeldung/mongo/update/PustSetOperationLiveTest.java
@@ -0,0 +1,53 @@
+package com.baeldung.update;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import org.bson.Document;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.mongodb.MongoClient;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.client.model.Filters;
+import com.mongodb.client.model.Updates;
+import com.mongodb.client.result.UpdateResult;
+
+public class PustSetOperationLiveTest {
+
+ private static MongoClient mongoClient;
+ private static MongoDatabase db;
+ private static MongoCollection collection;
+
+ @BeforeClass
+ public static void setup() {
+ if (mongoClient == null) {
+ mongoClient = new MongoClient("localhost", 27017);
+ db = mongoClient.getDatabase("baeldung");
+ collection = db.getCollection("marks");
+
+ collection.insertOne(Document.parse("{\n" + " \"studentId\": 1023,\n" + " \"studentName\":\"James Broad\",\n" + " \"joiningYear\":\"2018\",\n" + " \"totalMarks\":100,\n" + " \"subjectDetails\":[\n"
+ + " {\n" + " \"subjectId\":123,\n" + " \"subjectName\":\"Operating Systems Concepts\",\n" + " \"marks\":4,\n" + " },\n" + " {\n"
+ + " \"subjectId\":124,\n" + " \"subjectName\":\"Numerical Analysis\",\n" + " \"marks\":60\n" + " }\n" + " ]\n" + " }"));
+
+ }
+ }
+
+ @Test
+ public void givenMarksCollection_whenPushSetOperation_thenCheckingForDocument() {
+
+ Document subjectData = new Document().append("subjectId", 126)
+ .append("subjectName", "Java Programming")
+ .append("marks", 70);
+ UpdateResult updateQueryResult = collection.updateOne(Filters.eq("studentId", 1023), Updates.combine(Updates.set("totalMarks", 170), Updates.push("subjectDetails", subjectData)));
+
+ Document studentDetail = collection.find(Filters.eq("studentId", 1023))
+ .first();
+ assertNotNull(studentDetail);
+ assertFalse(studentDetail.isEmpty());
+
+ }
+
+}
+
diff --git a/persistence-modules/java-mongodb/pom.xml b/persistence-modules/java-mongodb/pom.xml
index 03229e72bd..88f0d18a5b 100644
--- a/persistence-modules/java-mongodb/pom.xml
+++ b/persistence-modules/java-mongodb/pom.xml
@@ -30,6 +30,18 @@
core
${morphia.version}
+
+ org.testcontainers
+ mongodb
+ 1.16.3
+ test
+
+
+ org.testcontainers
+ junit-jupiter
+ 1.16.3
+ test
+
diff --git a/persistence-modules/java-mongodb/src/test/java/com/baeldung/ordering/caseinsensitive/CaseInsensitiveOrderingLiveTest.java b/persistence-modules/java-mongodb/src/test/java/com/baeldung/ordering/caseinsensitive/CaseInsensitiveOrderingLiveTest.java
new file mode 100644
index 0000000000..ec2c332018
--- /dev/null
+++ b/persistence-modules/java-mongodb/src/test/java/com/baeldung/ordering/caseinsensitive/CaseInsensitiveOrderingLiveTest.java
@@ -0,0 +1,108 @@
+package com.baeldung.ordering.caseinsensitive;
+
+import com.mongodb.MongoClient;
+import com.mongodb.client.*;
+import com.mongodb.client.model.Collation;
+import com.mongodb.client.model.Projections;
+import com.mongodb.client.model.Sorts;
+import org.bson.Document;
+import org.bson.conversions.Bson;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.testcontainers.containers.MongoDBContainer;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+import org.testcontainers.utility.DockerImageName;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static com.mongodb.client.model.Aggregates.project;
+import static com.mongodb.client.model.Aggregates.sort;
+import static com.mongodb.client.model.Sorts.ascending;
+import static org.junit.Assert.assertEquals;
+
+@Testcontainers
+class CaseInsensitiveOrderingLiveTest {
+
+ private static MongoCollection userCollections;
+
+ @Container
+ private static final MongoDBContainer mongoDBContainer = new MongoDBContainer(DockerImageName.parse("mongo:4.0.10"));
+
+ @BeforeAll
+ private static void setup() {
+
+ MongoClient mongoClient = new MongoClient(mongoDBContainer.getContainerIpAddress(), mongoDBContainer.getMappedPort(27017));
+ MongoDatabase database = mongoClient.getDatabase("test");
+ userCollections = database.getCollection("users");
+
+ List list = new ArrayList<>();
+ list.add(Document.parse("{'name': 'ben', surname: 'ThisField' }"));
+ list.add(Document.parse("{'name': 'aen', surname: 'Does' }"));
+ list.add(Document.parse("{'name': 'Ben', surname: 'Not' }"));
+ list.add(Document.parse("{'name': 'cen', surname: 'Matter' }"));
+ list.add(Document.parse("{'name': 'Aen', surname: 'Really' }"));
+ list.add(Document.parse("{'name': 'Cen', surname: 'TrustMe' }"));
+
+ userCollections.insertMany(list);
+ }
+
+ @Test
+ void givenMongoCollection_whenUsingFindWithSort_caseIsConsideredByDefault() {
+ FindIterable nameDoc = userCollections.find().sort(ascending("name"));
+ MongoCursor cursor = nameDoc.cursor();
+
+ List expectedNamesOrdering = Arrays.asList("Aen", "Ben", "Cen", "aen", "ben", "cen");
+ List actualNamesOrdering = new ArrayList<>();
+ while (cursor.hasNext()) {
+ Document document = cursor.next();
+ actualNamesOrdering.add(document.get("name").toString());
+ }
+
+ assertEquals(expectedNamesOrdering, actualNamesOrdering);
+ }
+
+ @Test
+ void givenMongoCollection_whenUsingFindWithSortAndCollation_caseIsNotConsidered() {
+ FindIterable nameDoc = userCollections.find().sort(ascending("name"))
+ .collation(Collation.builder().locale("en").build());
+ MongoCursor cursor = nameDoc.cursor();
+ List expectedNamesOrdering = Arrays.asList("aen", "Aen", "ben", "Ben", "cen", "Cen");
+ List actualNamesOrdering = new ArrayList<>();
+ while (cursor.hasNext()) {
+ Document document = cursor.next();
+ actualNamesOrdering.add(document.get("name").toString());
+ }
+
+ assertEquals(expectedNamesOrdering, actualNamesOrdering);
+
+ }
+
+ @Test
+ void givenMongoCollection_whenUsingFindWithSortAndAggregate_caseIsNotConsidered() {
+
+ Bson projectBson = project(
+ Projections.fields(
+ Projections.include("name", "surname"),
+ Projections.computed("lowerName", Projections.computed("$toLower", "$name"))));
+
+ AggregateIterable nameDoc = userCollections.aggregate(
+ Arrays.asList(projectBson,
+ sort(Sorts.ascending("lowerName"))));
+
+ MongoCursor cursor = nameDoc.cursor();
+
+ List expectedNamesOrdering = Arrays.asList("aen", "Aen", "ben", "Ben", "cen", "Cen");
+ List actualNamesOrdering = new ArrayList<>();
+ while (cursor.hasNext()) {
+ Document document = cursor.next();
+ actualNamesOrdering.add(document.get("name").toString());
+ }
+
+ assertEquals(expectedNamesOrdering, actualNamesOrdering);
+ }
+
+
+}
diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml
index 64a9519a8b..f8e3cb05e8 100644
--- a/persistence-modules/pom.xml
+++ b/persistence-modules/pom.xml
@@ -43,6 +43,7 @@
java-jpa-2
java-jpa-3
java-mongodb
+ java-mongodb-2
jnosql
jooq
jpa-hibernate-cascade-type
@@ -104,4 +105,4 @@
42.2.20
-
\ No newline at end of file
+
diff --git a/persistence-modules/spring-data-jdbc/pom.xml b/persistence-modules/spring-data-jdbc/pom.xml
index 168b171337..630fe141b3 100644
--- a/persistence-modules/spring-data-jdbc/pom.xml
+++ b/persistence-modules/spring-data-jdbc/pom.xml
@@ -36,4 +36,4 @@
-
+
\ No newline at end of file
diff --git a/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springmultipledatasources/todos/TodoDatasourceConfiguration.java b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springmultipledatasources/todos/TodoDatasourceConfiguration.java
index b6a16eb7e4..c599c26d01 100644
--- a/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springmultipledatasources/todos/TodoDatasourceConfiguration.java
+++ b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springmultipledatasources/todos/TodoDatasourceConfiguration.java
@@ -19,6 +19,7 @@ public class TodoDatasourceConfiguration {
@Bean
@Primary
+ @ConfigurationProperties("spring.datasource.todos.hikari")
public DataSource todosDataSource() {
return todosDataSourceProperties()
.initializeDataSourceBuilder()
diff --git a/persistence-modules/spring-data-jdbc/src/main/resources/application-multipledatasources.properties b/persistence-modules/spring-data-jdbc/src/main/resources/application-multipledatasources.properties
index 0f2b643498..d9f859ea40 100644
--- a/persistence-modules/spring-data-jdbc/src/main/resources/application-multipledatasources.properties
+++ b/persistence-modules/spring-data-jdbc/src/main/resources/application-multipledatasources.properties
@@ -3,6 +3,7 @@ spring.datasource.todos.url=jdbc:h2:mem:todos
spring.datasource.todos.username=sa
spring.datasource.todos.password=null
spring.datasource.todos.driverClassName=org.h2.Driver
+spring.datasource.todos.hikari.connectionTimeout=44444
spring.datasource.topics.url=jdbc:h2:mem:topics
spring.datasource.topics.username=sa
spring.datasource.topics.password=null
diff --git a/persistence-modules/spring-data-jpa-query-3/pom.xml b/persistence-modules/spring-data-jpa-query-3/pom.xml
index 66a4486bc8..135d31aaba 100644
--- a/persistence-modules/spring-data-jpa-query-3/pom.xml
+++ b/persistence-modules/spring-data-jpa-query-3/pom.xml
@@ -29,4 +29,4 @@
-
+
\ No newline at end of file
diff --git a/persistence-modules/spring-hibernate-5/pom.xml b/persistence-modules/spring-hibernate-5/pom.xml
index ba18c5a221..3f5d00733d 100644
--- a/persistence-modules/spring-hibernate-5/pom.xml
+++ b/persistence-modules/spring-hibernate-5/pom.xml
@@ -107,22 +107,22 @@
com.h2database
h2
${h2.version}
-
-
- com.sun.xml.bind
- jaxb-core
- ${com.sun.xml.version}
-
-
- javax.xml.bind
- jaxb-api
- ${javax.xml.bind.version}
-
-
- com.sun.xml.bind
- jaxb-impl
- ${com.sun.xml.version}
-
+
+
+ com.sun.xml.bind
+ jaxb-core
+ ${com.sun.xml.version}
+
+
+ javax.xml.bind
+ jaxb-api
+ ${javax.xml.bind.version}
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ ${com.sun.xml.version}
+
diff --git a/pom.xml b/pom.xml
index a6202230d4..daaf9db6d2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1206,6 +1206,7 @@
wicket
wildfly
xml
+ xml-2
xstream
diff --git a/quarkus-jandex/hello-sender-application-properties/pom.xml b/quarkus-jandex/hello-sender-application-properties/pom.xml
index f63bb9be81..6658123bee 100644
--- a/quarkus-jandex/hello-sender-application-properties/pom.xml
+++ b/quarkus-jandex/hello-sender-application-properties/pom.xml
@@ -23,4 +23,4 @@
-
+
\ No newline at end of file
diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml
index 023eda856b..24971c0289 100644
--- a/spring-5-data-reactive/pom.xml
+++ b/spring-5-data-reactive/pom.xml
@@ -13,7 +13,7 @@
0.0.1-SNAPSHOT
../parent-boot-2
-
+
diff --git a/spring-5-reactive-3/pom.xml b/spring-5-reactive-3/pom.xml
index 89af34732f..fea72cc736 100644
--- a/spring-5-reactive-3/pom.xml
+++ b/spring-5-reactive-3/pom.xml
@@ -41,4 +41,5 @@
1.0.1.RELEASE
+
\ No newline at end of file
diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml
index 2ede13a152..898f88285b 100644
--- a/spring-activiti/pom.xml
+++ b/spring-activiti/pom.xml
@@ -16,7 +16,7 @@
0.0.1-SNAPSHOT
../parent-boot-1
-
+
diff --git a/spring-boot-modules/spring-boot-camel/.gitignore b/spring-boot-modules/spring-boot-camel/.gitignore
new file mode 100644
index 0000000000..16be8f2193
--- /dev/null
+++ b/spring-boot-modules/spring-boot-camel/.gitignore
@@ -0,0 +1 @@
+/output/
diff --git a/spring-boot-modules/spring-boot-camel/pom.xml b/spring-boot-modules/spring-boot-camel/pom.xml
index 5bda1b2351..ecf7143808 100644
--- a/spring-boot-modules/spring-boot-camel/pom.xml
+++ b/spring-boot-modules/spring-boot-camel/pom.xml
@@ -44,6 +44,12 @@
spring-boot-starter-test
test
+
+ org.apache.camel
+ camel-test-spring-junit5
+ ${camel.version}
+ test
+
@@ -57,6 +63,9 @@
repackage
+
+ com.baeldung.camel.boot.testing.GreetingsFileSpringApplication
+
diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileRouter.java b/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileRouter.java
new file mode 100644
index 0000000000..670af5e08c
--- /dev/null
+++ b/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileRouter.java
@@ -0,0 +1,19 @@
+package com.baeldung.camel.boot.testing;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GreetingsFileRouter extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+
+ from("direct:start")
+ .routeId("greetings-route")
+ .setBody(constant("Hello Baeldung Readers!"))
+ .to("file:output");
+
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileSpringApplication.java b/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileSpringApplication.java
new file mode 100644
index 0000000000..a4e862e65d
--- /dev/null
+++ b/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/boot/testing/GreetingsFileSpringApplication.java
@@ -0,0 +1,13 @@
+package com.baeldung.camel.boot.testing;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class GreetingsFileSpringApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(GreetingsFileSpringApplication.class, args);
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/boot/testing/GreetingsFileRouterUnitTest.java b/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/boot/testing/GreetingsFileRouterUnitTest.java
new file mode 100644
index 0000000000..baeb1fd39c
--- /dev/null
+++ b/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/camel/boot/testing/GreetingsFileRouterUnitTest.java
@@ -0,0 +1,32 @@
+package com.baeldung.camel.boot.testing;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.test.spring.junit5.MockEndpoints;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+@CamelSpringBootTest
+@MockEndpoints("file:output")
+class GreetingsFileRouterUnitTest {
+
+ @Autowired
+ private ProducerTemplate template;
+
+ @EndpointInject("mock:file:output")
+ private MockEndpoint mock;
+
+ @Test
+ void whenSendBody_thenGreetingReceivedSuccessfully() throws InterruptedException {
+ mock.expectedBodiesReceived("Hello Baeldung Readers!");
+
+ template.sendBody("direct:start", null);
+
+ mock.assertIsSatisfied();
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-multiple-datasources/pom.xml b/spring-boot-modules/spring-boot-multiple-datasources/pom.xml
index d66095bc2c..9355de8a36 100644
--- a/spring-boot-modules/spring-boot-multiple-datasources/pom.xml
+++ b/spring-boot-modules/spring-boot-multiple-datasources/pom.xml
@@ -1,7 +1,7 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
spring-boot-multiple-datasources
0.1.0-SNAPSHOT
@@ -55,4 +55,4 @@
2.6.3
-
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/SwaggerResponseApiApplication.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/SwaggerResponseApiApplication.java
new file mode 100644
index 0000000000..913544b459
--- /dev/null
+++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/SwaggerResponseApiApplication.java
@@ -0,0 +1,13 @@
+package com.baeldung.swaggerresponseapi;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SwaggerResponseApiApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SwaggerResponseApiApplication.class, args);
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/controller/ProductController.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/controller/ProductController.java
new file mode 100644
index 0000000000..364a7e8a66
--- /dev/null
+++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/controller/ProductController.java
@@ -0,0 +1,38 @@
+package com.baeldung.swaggerresponseapi.controller;
+
+import com.baeldung.swaggerresponseapi.model.Product;
+import com.baeldung.swaggerresponseapi.service.ProductService;
+
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+public class ProductController {
+ private final ProductService productService;
+
+ public ProductController(ProductService productService) {
+ this.productService = productService;
+ }
+
+ @PostMapping("/create")
+ public Product addProduct(@RequestBody Product product) {
+ return productService.addProducts(product);
+ }
+
+ @ApiResponses(value = { @ApiResponse(content = { @Content(mediaType = "application/json",
+ array = @ArraySchema(schema = @Schema(implementation = Product.class))) }) })
+ @GetMapping("/products")
+ public List getProductsList() {
+ return productService.getProductsList();
+ }
+}
diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/model/Product.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/model/Product.java
new file mode 100644
index 0000000000..036ecbc853
--- /dev/null
+++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/model/Product.java
@@ -0,0 +1,28 @@
+package com.baeldung.swaggerresponseapi.model;
+
+public class Product {
+ String code;
+ String name;
+
+ public Product(String code, String name) {
+ this.code = code;
+ this.name = name;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
+
diff --git a/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/service/ProductService.java b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/service/ProductService.java
new file mode 100644
index 0000000000..5e7533d6f4
--- /dev/null
+++ b/spring-boot-modules/spring-boot-springdoc/src/main/java/com/baeldung/swaggerresponseapi/service/ProductService.java
@@ -0,0 +1,21 @@
+package com.baeldung.swaggerresponseapi.service;
+
+import com.baeldung.swaggerresponseapi.model.Product;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class ProductService {
+ List productsList = new ArrayList<>();
+
+ public Product addProducts(Product product) {
+ productsList.add(product);
+ return product;
+ }
+
+ public List getProductsList() {
+ return productsList;
+ }
+}
diff --git a/spring-boot-modules/spring-boot-swagger-keycloak/pom.xml b/spring-boot-modules/spring-boot-swagger-keycloak/pom.xml
index a7f3e01014..de2c8c68c4 100644
--- a/spring-boot-modules/spring-boot-swagger-keycloak/pom.xml
+++ b/spring-boot-modules/spring-boot-swagger-keycloak/pom.xml
@@ -72,4 +72,4 @@
2.17.1
-
+
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-swagger/pom.xml b/spring-boot-modules/spring-boot-swagger/pom.xml
index b6ed50534e..749442c225 100644
--- a/spring-boot-modules/spring-boot-swagger/pom.xml
+++ b/spring-boot-modules/spring-boot-swagger/pom.xml
@@ -84,4 +84,4 @@
3.1.1
-
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml b/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml
index bdd75d0635..7700a2219d 100644
--- a/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml
+++ b/spring-cloud/spring-cloud-archaius/zookeeper-config/pom.xml
@@ -45,7 +45,7 @@
2.0.0.RELEASE
3.4.13
- 2.17.1
+ 2.17.1
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-eureka-self-preservation/pom.xml b/spring-cloud/spring-cloud-eureka-self-preservation/pom.xml
index e22ad6b7c9..5000adc164 100644
--- a/spring-cloud/spring-cloud-eureka-self-preservation/pom.xml
+++ b/spring-cloud/spring-cloud-eureka-self-preservation/pom.xml
@@ -14,7 +14,12 @@
spring-cloud
1.0.0-SNAPSHOT
-
+
+
+ spring-cloud-eureka-server
+ spring-cloud-eureka-client
+
+
@@ -27,11 +32,6 @@
-
- spring-cloud-eureka-server
- spring-cloud-eureka-client
-
-
org.springframework.boot
diff --git a/spring-cloud/spring-cloud-eureka/pom.xml b/spring-cloud/spring-cloud-eureka/pom.xml
index 795eab7d6e..63190f7f20 100644
--- a/spring-cloud/spring-cloud-eureka/pom.xml
+++ b/spring-cloud/spring-cloud-eureka/pom.xml
@@ -14,7 +14,14 @@
spring-cloud
1.0.0-SNAPSHOT
-
+
+
+ spring-cloud-eureka-server
+ spring-cloud-eureka-client
+ spring-cloud-eureka-feign-client
+ spring-cloud-eureka-feign-client-integration-test
+
+
@@ -27,13 +34,6 @@
-
- spring-cloud-eureka-server
- spring-cloud-eureka-client
- spring-cloud-eureka-feign-client
- spring-cloud-eureka-feign-client-integration-test
-
-
org.springframework.boot
diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml
index 3dc68e2824..d9f90c7a56 100644
--- a/spring-cloud/spring-cloud-functions/pom.xml
+++ b/spring-cloud/spring-cloud-functions/pom.xml
@@ -10,7 +10,7 @@
jar
Demo project for Spring Cloud Function
-
+
com.baeldung.spring.cloud
spring-cloud
1.0.0-SNAPSHOT
diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml
index a352bbd4e4..e8949cc039 100644
--- a/spring-cloud/spring-cloud-gateway/pom.xml
+++ b/spring-cloud/spring-cloud-gateway/pom.xml
@@ -83,31 +83,28 @@
org.springframework.boot
spring-boot-devtools
-
org.springframework.boot
spring-boot-starter-oauth2-resource-server
-
org.springframework.boot
spring-boot-starter-oauth2-client
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
-
- ${java.version}
- ${java.version}
-
-
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ ${java.version}
+ ${java.version}
+
+
org.springframework.boot
spring-boot-maven-plugin
@@ -123,15 +120,6 @@
-
-
-
- 6.0.2.Final
- 0.7.2
- 9.19
-
-
-
quotes-application
@@ -177,7 +165,6 @@
-
gateway-url-rewrite
@@ -192,6 +179,16 @@
-
+
+
+
+
+
+ 6.0.2.Final
+ 0.7.2
+ 9.19
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/pom.xml b/spring-cloud/spring-cloud-kubernetes/pom.xml
index c41c500a1b..698bdce1e5 100644
--- a/spring-cloud/spring-cloud-kubernetes/pom.xml
+++ b/spring-cloud/spring-cloud-kubernetes/pom.xml
@@ -15,6 +15,15 @@
1.0.0-SNAPSHOT
+
+ kubernetes-minikube/demo-frontend
+ kubernetes-minikube/demo-backend
+ kubernetes-selfhealing/liveness-example
+ kubernetes-selfhealing/readiness-example
+ kubernetes-guide/client-service
+ kubernetes-guide/travel-agency-service
+
+
@@ -27,15 +36,6 @@
-
- kubernetes-minikube/demo-frontend
- kubernetes-minikube/demo-backend
- kubernetes-selfhealing/liveness-example
- kubernetes-selfhealing/readiness-example
- kubernetes-guide/client-service
- kubernetes-guide/travel-agency-service
-
-
2021.0.0
diff --git a/spring-cloud/spring-cloud-load-balancer/pom.xml b/spring-cloud/spring-cloud-load-balancer/pom.xml
index 65cf83de09..3b81def641 100644
--- a/spring-cloud/spring-cloud-load-balancer/pom.xml
+++ b/spring-cloud/spring-cloud-load-balancer/pom.xml
@@ -19,7 +19,7 @@
spring-cloud-loadbalancer-server
spring-cloud-loadbalancer-client
-
+
@@ -44,7 +44,7 @@
2.6.1
2021.0.0
- 2.17.1
+ 2.17.1
-
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-load-balancer/spring-cloud-loadbalancer-client/pom.xml b/spring-cloud/spring-cloud-load-balancer/spring-cloud-loadbalancer-client/pom.xml
index fc6e2854aa..c141452695 100644
--- a/spring-cloud/spring-cloud-load-balancer/spring-cloud-loadbalancer-client/pom.xml
+++ b/spring-cloud/spring-cloud-load-balancer/spring-cloud-loadbalancer-client/pom.xml
@@ -3,17 +3,30 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+ com.baeldung.springcloud.loadbalancer
+ spring-cloud-loadbalancer-client
+ 0.0.1-SNAPSHOT
+ spring-cloud-loadbalancer-client
+ Spring Cloud Load Balancer Demo - Client
+
com.baeldung.spring.cloud
spring-cloud-loadbalancer
1.0.0-SNAPSHOT
- com.baeldung.springcloud.loadbalancer
- spring-cloud-loadbalancer-client
- 0.0.1-SNAPSHOT
- spring-cloud-loadbalancer-client
- Spring Cloud Load Balancer Demo - Client
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
org.springframework.boot
@@ -30,17 +43,6 @@
test
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
@@ -51,4 +53,4 @@
-
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-load-balancer/spring-cloud-loadbalancer-server/pom.xml b/spring-cloud/spring-cloud-load-balancer/spring-cloud-loadbalancer-server/pom.xml
index 139996994d..3e61ecc90d 100644
--- a/spring-cloud/spring-cloud-load-balancer/spring-cloud-loadbalancer-server/pom.xml
+++ b/spring-cloud/spring-cloud-load-balancer/spring-cloud-loadbalancer-server/pom.xml
@@ -3,24 +3,23 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
-
- com.baeldung.spring.cloud
- spring-cloud-loadbalancer
- 1.0.0-SNAPSHOT
-
-
com.baeldung.spring.cloud.loadbalancer
spring-cloud-loadbalancer-server
0.0.1-SNAPSHOT
spring-cloud-loadbalancer-server
Spring Cloud Load Balancer Demo - Server
+
+ com.baeldung.spring.cloud
+ spring-cloud-loadbalancer
+ 1.0.0-SNAPSHOT
+
+
org.springframework.boot
spring-boot-starter-web
-
org.springframework.boot
spring-boot-starter-test
@@ -37,4 +36,4 @@
-
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml
index b2cb66744b..3960cfde5d 100644
--- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml
@@ -52,7 +52,7 @@
test
-
+
2.17.1
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml
index 466291650c..c9bc120e4d 100644
--- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml
@@ -52,7 +52,7 @@
test
-
+
2.17.1
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml
index 27afc3eb69..76d899447f 100644
--- a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml
@@ -60,8 +60,8 @@
test
-
-
+
+
2.17.1
diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml
index 4727859ea2..5df22c78c8 100644
--- a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml
+++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml
@@ -13,7 +13,7 @@
spring-cloud-zuul
0.0.1-SNAPSHOT
-
+
diff --git a/spring-ejb/ejb-beans/pom.xml b/spring-ejb/ejb-beans/pom.xml
index 6f20d949b0..37b67beec4 100644
--- a/spring-ejb/ejb-beans/pom.xml
+++ b/spring-ejb/ejb-beans/pom.xml
@@ -38,7 +38,6 @@
tomee-embedded
${tomee-embedded.version}
-
org.springframework
spring-context
diff --git a/spring-reactive/pom.xml b/spring-reactive/pom.xml
index d31ee04d82..d755c03ae0 100644
--- a/spring-reactive/pom.xml
+++ b/spring-reactive/pom.xml
@@ -1,8 +1,9 @@
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+ spring-reactive
com.baeldung
@@ -11,8 +12,6 @@
../parent-boot-2
- spring-reactive
-
org.springframework.boot
diff --git a/spring-security-modules/spring-5-security-oauth/pom.xml b/spring-security-modules/spring-5-security-oauth/pom.xml
index 706cdb3082..8449b01ec0 100644
--- a/spring-security-modules/spring-5-security-oauth/pom.xml
+++ b/spring-security-modules/spring-5-security-oauth/pom.xml
@@ -15,8 +15,8 @@
0.0.1-SNAPSHOT
../../parent-boot-2
-
-
+
+
org.apache.logging.log4j
@@ -27,7 +27,6 @@
-
@@ -85,7 +84,7 @@
is available -->
2.5.2
com.baeldung.oauth2.SpringOAuthApplication
- 2.17.1
+ 2.17.1
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-legacy-oidc/pom.xml b/spring-security-modules/spring-security-legacy-oidc/pom.xml
index 9dd898f9dd..e98486b0ff 100644
--- a/spring-security-modules/spring-security-legacy-oidc/pom.xml
+++ b/spring-security-modules/spring-security-legacy-oidc/pom.xml
@@ -14,8 +14,8 @@
0.0.1-SNAPSHOT
../../parent-boot-2
-
-
+
+
org.apache.logging.log4j
@@ -62,7 +62,7 @@
1.0.9.RELEASE
0.3.0
2.4.7
- 2.17.1
+ 2.17.1
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-web-boot-1/pom.xml b/spring-security-modules/spring-security-web-boot-1/pom.xml
index 3f6001686d..18cdd0ae5c 100644
--- a/spring-security-modules/spring-security-web-boot-1/pom.xml
+++ b/spring-security-modules/spring-security-web-boot-1/pom.xml
@@ -179,7 +179,6 @@
-
entryPoints
diff --git a/spring-web-modules/pom.xml b/spring-web-modules/pom.xml
index d66d9cb35a..a5c23c1649 100644
--- a/spring-web-modules/pom.xml
+++ b/spring-web-modules/pom.xml
@@ -50,4 +50,4 @@
spring-web-url
-
+
\ No newline at end of file
diff --git a/spring-web-modules/spring-mvc-basics-5/pom.xml b/spring-web-modules/spring-mvc-basics-5/pom.xml
index 3b64f15c4b..5e8cd1b44e 100644
--- a/spring-web-modules/spring-mvc-basics-5/pom.xml
+++ b/spring-web-modules/spring-mvc-basics-5/pom.xml
@@ -41,7 +41,7 @@
- spring-mvc-basics
+ spring-mvc-basics-5
org.springframework.boot
diff --git a/testing-modules/cucumber/pom.xml b/testing-modules/cucumber/pom.xml
index 531b16ddec..ffa5c0d250 100644
--- a/testing-modules/cucumber/pom.xml
+++ b/testing-modules/cucumber/pom.xml
@@ -12,7 +12,6 @@
parent-boot-2
0.0.1-SNAPSHOT
../../parent-boot-2
-
diff --git a/xml-2/.gitignore b/xml-2/.gitignore
new file mode 100644
index 0000000000..68b918851c
--- /dev/null
+++ b/xml-2/.gitignore
@@ -0,0 +1 @@
+xml/.idea
diff --git a/xml-2/README.md b/xml-2/README.md
new file mode 100644
index 0000000000..e3c6ed6443
--- /dev/null
+++ b/xml-2/README.md
@@ -0,0 +1,5 @@
+## XML
+
+This module contains articles about eXtensible Markup Language (XML)
+
+### Relevant Articles:
\ No newline at end of file
diff --git a/xml-2/pom.xml b/xml-2/pom.xml
new file mode 100644
index 0000000000..025ad682ad
--- /dev/null
+++ b/xml-2/pom.xml
@@ -0,0 +1,50 @@
+
+
+ 4.0.0
+ xml-2
+ 0.1-SNAPSHOT
+ xml-2
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
+
+
+
+
+ org.dom4j
+ dom4j
+ ${dom4j.version}
+
+
+
+
+ xml-2
+
+
+ src/main/resources
+ true
+
+
+
+
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+
+
+
+
+ 2.1.3
+
+
+
\ No newline at end of file
diff --git a/xml-2/src/main/java/com/baeldung/xml/prettyprint/XmlPrettyPrinter.java b/xml-2/src/main/java/com/baeldung/xml/prettyprint/XmlPrettyPrinter.java
new file mode 100644
index 0000000000..85fd751325
--- /dev/null
+++ b/xml-2/src/main/java/com/baeldung/xml/prettyprint/XmlPrettyPrinter.java
@@ -0,0 +1,91 @@
+package com.baeldung.xml.prettyprint;
+
+import org.dom4j.DocumentHelper;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.*;
+
+public class XmlPrettyPrinter {
+
+ public static String prettyPrintByTransformer(String xmlString, int indent, boolean ignoreDeclaration) {
+
+ try {
+ final InputSource src = new InputSource(new StringReader(xmlString));
+ final Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(src);
+
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ transformerFactory.setAttribute("indent-number", indent);
+ Transformer transformer = transformerFactory.newTransformer(new StreamSource(new StringReader(readPrettyPrintXslt())));
+ // Using the default transformer will create empty lines in Java9+
+// Transformer transformer = transformerFactory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, ignoreDeclaration ? "yes" : "no");
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ // Alternatively, we can set indent-size on the transformer object
+ // transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent));
+ Writer out = new StringWriter();
+ transformer.transform(new DOMSource(document), new StreamResult(out));
+ return out.toString();
+ } catch (Exception e) {
+ throw new RuntimeException("Error occurs when pretty-printing xml:\n" + xmlString, e);
+ }
+ }
+
+
+ public static String prettyPrintByDom4j(String xmlString, int indent, boolean skipDeclaration) {
+ try {
+ final OutputFormat format = OutputFormat.createPrettyPrint();
+ format.setEncoding("UTF-8");
+ format.setIndentSize(indent);
+ format.setSuppressDeclaration(skipDeclaration);
+
+ final org.dom4j.Document document = DocumentHelper.parseText(xmlString);
+ final StringWriter sw = new StringWriter();
+ final XMLWriter writer = new XMLWriter(sw, format);
+ writer.write(document);
+ return sw.toString();
+ } catch (Exception e) {
+ throw new RuntimeException("Error occurs when pretty-printing xml:\n" + xmlString, e);
+ }
+ }
+
+ public static void main(String[] args) throws IOException {
+ InputStream inputStream = XmlPrettyPrinter.class.getResourceAsStream("/xml/emails.xml");
+ String xmlString = readFromInputStream(inputStream);
+ System.out.println("Pretty printing by Transformer");
+ System.out.println("=============================================");
+ System.out.println(prettyPrintByTransformer(xmlString, 2, true));
+ System.out.println("=============================================");
+ System.out.println("Pretty printing by Dom4j");
+ System.out.println("=============================================");
+ System.out.println(prettyPrintByDom4j(xmlString, 8, false));
+ System.out.println("=============================================");
+ }
+
+
+ private static String readPrettyPrintXslt() throws IOException {
+ InputStream inputStream = XmlPrettyPrinter.class.getResourceAsStream("/xml/prettyprint.xsl");
+ return readFromInputStream(inputStream);
+ }
+
+ private static String readFromInputStream(InputStream inputStream) throws IOException {
+ StringBuilder resultStringBuilder = new StringBuilder();
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
+ String line;
+ while ((line = br.readLine()) != null) {
+ resultStringBuilder.append(line).append("\n");
+ }
+ }
+ return resultStringBuilder.toString();
+ }
+}
diff --git a/xml-2/src/main/resources/logback.xml b/xml-2/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/xml-2/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xml-2/src/main/resources/xml/emails.xml b/xml-2/src/main/resources/xml/emails.xml
new file mode 100644
index 0000000000..03338a28fc
--- /dev/null
+++ b/xml-2/src/main/resources/xml/emails.xml
@@ -0,0 +1,4 @@
+ Kai Amanda
+I am flying to you
+Jerry Tom Hey Tom, catch me if you can!
+
\ No newline at end of file
diff --git a/xml-2/src/main/resources/xml/prettyprint.xsl b/xml-2/src/main/resources/xml/prettyprint.xsl
new file mode 100644
index 0000000000..3941269f40
--- /dev/null
+++ b/xml-2/src/main/resources/xml/prettyprint.xsl
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file