diff --git a/.gitignore b/.gitignore
index 50cb889e5b..5be11c71ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,4 +77,5 @@ apache-avro/src/main/java/com/baeldung/avro/model/
jta/transaction-logs/
software-security/sql-injection-samples/derby.log
spring-soap/src/main/java/com/baeldung/springsoap/gen/
-/report-*.json
\ No newline at end of file
+/report-*.json
+transaction.log
\ No newline at end of file
diff --git a/algorithms-miscellaneous-1/pom.xml b/algorithms-miscellaneous-1/pom.xml
index 30130208f8..affa66f147 100644
--- a/algorithms-miscellaneous-1/pom.xml
+++ b/algorithms-miscellaneous-1/pom.xml
@@ -42,7 +42,7 @@
com.github.dpaukov
combinatoricslib3
- 3.3.0
+ ${combinatoricslib3.version}
@@ -83,6 +83,7 @@
3.9.0
1.11
27.0.1-jre
+ 3.3.0
\ No newline at end of file
diff --git a/algorithms-miscellaneous-3/README.md b/algorithms-miscellaneous-3/README.md
index 7a83a97c5b..71541cd2b3 100644
--- a/algorithms-miscellaneous-3/README.md
+++ b/algorithms-miscellaneous-3/README.md
@@ -5,3 +5,5 @@
- [Converting Between Roman and Arabic Numerals in Java](http://www.baeldung.com/java-convert-roman-arabic)
- [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity)
- [Checking If a List Is Sorted in Java](https://www.baeldung.com/java-check-if-list-sorted)
+- [Checking if a Java Graph has a Cycle](https://www.baeldung.com/java-graph-has-a-cycle)
+- [A Guide to the Folding Technique](https://www.baeldung.com/folding-hashing-technique)
diff --git a/apache-avro/pom.xml b/apache-avro/pom.xml
index 5d170f0a81..e6fb4d24ff 100644
--- a/apache-avro/pom.xml
+++ b/apache-avro/pom.xml
@@ -17,7 +17,7 @@
junit
junit
- 4.10
+ ${junit.version}
test
diff --git a/apache-olingo/olingo2/pom.xml b/apache-olingo/olingo2/pom.xml
index 1efd4ea602..320f56b717 100644
--- a/apache-olingo/olingo2/pom.xml
+++ b/apache-olingo/olingo2/pom.xml
@@ -3,37 +3,28 @@
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
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.1.3.RELEASE
-
-
org.baeldung.examples.olingo2
olingo2-sample
0.0.1-SNAPSHOT
olingo2-sample
Sample Olingo 2 Project
-
- 1.8
- 2.0.11
-
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.1.3.RELEASE
+
+
-
org.springframework.boot
spring-boot-starter-jersey
-
-
org.springframework.boot
spring-boot-starter-data-jpa
-
-
com.h2database
h2
@@ -90,4 +81,9 @@
+
+ 1.8
+ 2.0.11
+
+
diff --git a/apache-spark/pom.xml b/apache-spark/pom.xml
index f0f002a7e9..b8c1962dd4 100644
--- a/apache-spark/pom.xml
+++ b/apache-spark/pom.xml
@@ -49,6 +49,7 @@
${com.datastax.spark.spark-cassandra-connector-java.version}
+
@@ -78,6 +79,7 @@
+
2.3.0
2.3.0
diff --git a/autovalue/README.md b/autovalue/README.md
index c6a08359ef..f33ff6899f 100644
--- a/autovalue/README.md
+++ b/autovalue/README.md
@@ -1,3 +1,4 @@
### Relevant Articles:
- [Introduction to AutoValue](http://www.baeldung.com/introduction-to-autovalue)
- [Introduction to AutoFactory](http://www.baeldung.com/autofactory)
+- [Google AutoService](https://www.baeldung.com/google-autoservice)
diff --git a/bootique/pom.xml b/bootique/pom.xml
index 4ae8703074..4dd9ba4833 100644
--- a/bootique/pom.xml
+++ b/bootique/pom.xml
@@ -65,7 +65,6 @@
com.baeldung.bootique.App
0.23
-
2.4.3
diff --git a/core-groovy-2/README.md b/core-groovy-2/README.md
index d6fc6fc2f7..33df8b107b 100644
--- a/core-groovy-2/README.md
+++ b/core-groovy-2/README.md
@@ -6,4 +6,5 @@
- [Template Engines in Groovy](https://www.baeldung.com/groovy-template-engines)
- [Groovy def Keyword](https://www.baeldung.com/groovy-def-keyword)
- [Pattern Matching in Strings in Groovy](https://www.baeldung.com/groovy-pattern-matching)
-- [Working with XML in Groovy](https://www.baeldung.com/groovy-xml)
\ No newline at end of file
+- [Working with XML in Groovy](https://www.baeldung.com/groovy-xml)
+- [Integrating Groovy into Java Applications](https://www.baeldung.com/groovy-java-applications)
diff --git a/core-groovy-2/pom.xml b/core-groovy-2/pom.xml
index b945546c8a..53b3e6a7ec 100644
--- a/core-groovy-2/pom.xml
+++ b/core-groovy-2/pom.xml
@@ -157,20 +157,19 @@
-
- bintray
- Groovy Bintray
- https://dl.bintray.com/groovy/maven
-
-
- never
-
-
- false
-
-
-
-
+
+ bintray
+ Groovy Bintray
+ https://dl.bintray.com/groovy/maven
+
+
+ never
+
+
+ false
+
+
+
1.0.0
diff --git a/core-java-modules/README.md b/core-java-modules/README.md
index 7a7d0a7a1b..9ce6057f32 100644
--- a/core-java-modules/README.md
+++ b/core-java-modules/README.md
@@ -3,3 +3,4 @@
- [Multi-Module Maven Application with Java Modules](https://www.baeldung.com/maven-multi-module-project-java-jpms)
- [Guide to Java FileChannel](https://www.baeldung.com/java-filechannel)
- [Understanding the NumberFormatException in Java](https://www.baeldung.com/java-number-format-exception)
+- [Will an Error Be Caught by Catch Block in Java?](https://www.baeldung.com/java-error-catch)
diff --git a/core-java-modules/core-java-10/README.md b/core-java-modules/core-java-10/README.md
index f0a25712a7..8fb4f8a7dd 100644
--- a/core-java-modules/core-java-10/README.md
+++ b/core-java-modules/core-java-10/README.md
@@ -5,3 +5,4 @@
- [Guide to Java 10](http://www.baeldung.com/java-10-overview)
- [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another)
- [Deep Dive Into the New Java JIT Compiler – Graal](https://www.baeldung.com/graal-java-jit-compiler)
+- [Copying Sets in Java](https://www.baeldung.com/java-copy-sets)
diff --git a/core-java-modules/core-java-8-2/README.md b/core-java-modules/core-java-8-2/README.md
index d53b731878..245fa93ba7 100644
--- a/core-java-modules/core-java-8-2/README.md
+++ b/core-java-modules/core-java-8-2/README.md
@@ -6,3 +6,4 @@
- [Anonymous Classes in Java](http://www.baeldung.com/)
- [How to Delay Code Execution in Java](https://www.baeldung.com/java-delay-code-execution)
- [Run JAR Application With Command Line Arguments](https://www.baeldung.com/java-run-jar-with-arguments)
+- [Java 8 Stream skip() vs limit()](https://www.baeldung.com/java-stream-skip-vs-limit)
diff --git a/core-java-modules/core-java-8-2/pom.xml b/core-java-modules/core-java-8-2/pom.xml
index 17f0eea20f..07bb3b7543 100644
--- a/core-java-modules/core-java-8-2/pom.xml
+++ b/core-java-modules/core-java-8-2/pom.xml
@@ -9,7 +9,6 @@
core-java-8-2
jar
-
com.baeldung
parent-java
@@ -17,14 +16,6 @@
../../parent-java
-
- UTF-8
- 1.8
- 1.8
- 64.2
- 3.12.2
-
-
com.ibm.icu
@@ -51,6 +42,13 @@
-
+
+
+ UTF-8
+ 1.8
+ 1.8
+ 64.2
+ 3.12.2
+
diff --git a/core-java-modules/core-java-8/README.md b/core-java-modules/core-java-8/README.md
index d11d2debce..b2ae48ea11 100644
--- a/core-java-modules/core-java-8/README.md
+++ b/core-java-modules/core-java-8/README.md
@@ -40,3 +40,4 @@
- [Java 8 Predicate Chain](https://www.baeldung.com/java-predicate-chain)
- [Method References in Java](https://www.baeldung.com/java-method-references)
- [Creating a Custom Annotation in Java](https://www.baeldung.com/java-custom-annotation)
+- [The Difference Between Collection.stream().forEach() and Collection.forEach()](https://www.baeldung.com/java-collection-stream-foreach)
diff --git a/core-java-modules/core-java-collections-set/README.md b/core-java-modules/core-java-collections-set/README.md
index 2e09e920dc..618b4e932c 100644
--- a/core-java-modules/core-java-collections-set/README.md
+++ b/core-java-modules/core-java-collections-set/README.md
@@ -10,3 +10,4 @@
- [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset)
- [Guide to EnumSet](https://www.baeldung.com/java-enumset)
- [Set Operations in Java](https://www.baeldung.com/java-set-operations)
+- [Copying Sets in Java](https://www.baeldung.com/java-copy-sets)
diff --git a/core-java-modules/core-java-collections-set/pom.xml b/core-java-modules/core-java-collections-set/pom.xml
index 4435f8b151..101ed79de0 100644
--- a/core-java-modules/core-java-collections-set/pom.xml
+++ b/core-java-modules/core-java-collections-set/pom.xml
@@ -14,30 +14,31 @@
-
- com.google.guava
- guava
- ${guava.version}
-
-
- org.apache.commons
- commons-collections4
- ${commons-collections4.version}
-
-
- com.google.code.gson
- gson
- 2.8.5
-
-
- commons-lang
- commons-lang
- 2.6
-
+
+ com.google.guava
+ guava
+ ${guava.version}
+
+
+ org.apache.commons
+ commons-collections4
+ ${commons-collections4.version}
+
+
+ com.google.code.gson
+ gson
+ ${gson.version}
+
+
+ commons-lang
+ commons-lang
+ ${commons-lang.version}
+
4.3
27.1-jre
+ 2.8.5
\ No newline at end of file
diff --git a/core-java-modules/core-java-exceptions/pom.xml b/core-java-modules/core-java-exceptions/pom.xml
index 37f65882c3..2e5200944a 100644
--- a/core-java-modules/core-java-exceptions/pom.xml
+++ b/core-java-modules/core-java-exceptions/pom.xml
@@ -14,15 +14,11 @@
../../parent-java
-
- 3.9
-
-
junit
junit
- 4.12
+ ${junit.version}
test
@@ -32,4 +28,8 @@
+
+ 3.9
+
+
diff --git a/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml
index 6a41ec0d1a..059075318a 100644
--- a/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml
+++ b/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml
@@ -11,6 +11,14 @@
1.0
+
+
+ com.baeldung.servicemodule
+ servicemodule
+ 1.0
+
+
+
@@ -19,12 +27,4 @@
-
-
-
- com.baeldung.servicemodule
- servicemodule
- 1.0
-
-
diff --git a/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml
index 828fe7de6a..757d9229df 100644
--- a/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml
+++ b/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml
@@ -2,17 +2,18 @@
-
- com.baeldung.decoupling-pattern2
- decoupling-pattern2
- 1.0-SNAPSHOT
-
4.0.0
com.baeldung.consumermodule
consumermodule
1.0
+
+ com.baeldung.decoupling-pattern2
+ decoupling-pattern2
+ 1.0-SNAPSHOT
+
+
com.baeldung.servicemodule
diff --git a/core-java-modules/core-java-lang-oop-2/README.md b/core-java-modules/core-java-lang-oop-2/README.md
index 2e36d251ca..72c3c6742b 100644
--- a/core-java-modules/core-java-lang-oop-2/README.md
+++ b/core-java-modules/core-java-lang-oop-2/README.md
@@ -6,3 +6,4 @@
- [Generic Constructors in Java](https://www.baeldung.com/java-generic-constructors)
- [Cannot Reference “X” Before Supertype Constructor Has Been Called](https://www.baeldung.com/java-cannot-reference-x-before-supertype-constructor-error)
- [Anonymous Classes in Java](https://www.baeldung.com/java-anonymous-classes)
+- [Raw Types in Java](https://www.baeldung.com/raw-types-java)
diff --git a/core-java-modules/core-java-nio/README.md b/core-java-modules/core-java-nio/README.md
index e73a9850ad..9034c3b3b1 100644
--- a/core-java-modules/core-java-nio/README.md
+++ b/core-java-modules/core-java-nio/README.md
@@ -1,3 +1,3 @@
## Relevant articles:
-- [Determine File Creating Date in Java](https://www.baeldung.com/file-creation-date-java)
+- [Determine File Creating Date in Java](https://www.baeldung.com/java-file-creation-date)
diff --git a/core-java-modules/core-java-nio/pom.xml b/core-java-modules/core-java-nio/pom.xml
index 36d6848998..31433e632f 100644
--- a/core-java-modules/core-java-nio/pom.xml
+++ b/core-java-modules/core-java-nio/pom.xml
@@ -8,9 +8,9 @@
jar
- com.baeldung
- parent-java
- 0.0.1-SNAPSHOT
- ../../parent-java
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../../parent-java
\ No newline at end of file
diff --git a/core-java-modules/core-java-optional/README.md b/core-java-modules/core-java-optional/README.md
index 12a6fd1a56..b6848b5d33 100644
--- a/core-java-modules/core-java-optional/README.md
+++ b/core-java-modules/core-java-optional/README.md
@@ -2,4 +2,5 @@
## Core Java Optional
-### Relevant Articles:
\ No newline at end of file
+### Relevant Articles:
+- [Java Optional as Return Type](https://www.baeldung.com/java-optional-return)
diff --git a/core-java-modules/core-java-optional/pom.xml b/core-java-modules/core-java-optional/pom.xml
index f2478c2c87..f60e3ba03d 100644
--- a/core-java-modules/core-java-optional/pom.xml
+++ b/core-java-modules/core-java-optional/pom.xml
@@ -1,22 +1,14 @@
- 4.0.0
-
- com.baeldung.core-java-modules
- core-java-modules
- 1.0.0-SNAPSHOT
-
- core-java-optional
- 0.1.0-SNAPSHOT
- jar
-
-
- UTF-8
- 1.8
- 1.8
- 5.4.0.Final
- 1.4.197
- 2.9.8
-
+ 4.0.0
+ core-java-optional
+ 0.1.0-SNAPSHOT
+ jar
+
+
+ com.baeldung.core-java-modules
+ core-java-modules
+ 1.0.0-SNAPSHOT
+
@@ -50,4 +42,13 @@
+
+
+ UTF-8
+ 1.8
+ 1.8
+ 5.4.0.Final
+ 1.4.197
+ 2.9.8
+
\ 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 7942f3e7e2..2f33212c38 100644
--- a/core-java-modules/core-java/pom.xml
+++ b/core-java-modules/core-java/pom.xml
@@ -13,7 +13,6 @@
../../parent-java
-
commons-io
diff --git a/core-java-modules/multimodulemavenproject/entitymodule/pom.xml b/core-java-modules/multimodulemavenproject/entitymodule/pom.xml
index 1fd672d03e..b90a7ed068 100644
--- a/core-java-modules/multimodulemavenproject/entitymodule/pom.xml
+++ b/core-java-modules/multimodulemavenproject/entitymodule/pom.xml
@@ -1,15 +1,16 @@
4.0.0
+ com.baeldung.entitymodule
+ entitymodule
+ 1.0
+ jar
+
com.baeldung.multimodulemavenproject
multimodulemavenproject
1.0
- com.baeldung.entitymodule
- entitymodule
- 1.0
- jar
diff --git a/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml b/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml
index 26e6a15b1e..1f44a1690c 100644
--- a/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml
+++ b/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml
@@ -1,15 +1,16 @@
4.0.0
+ com.baeldung.mainappmodule
+ mainappmodule
+ 1.0
+ jar
+
com.baeldung.multimodulemavenproject
multimodulemavenproject
1.0
- com.baeldung.mainappmodule
- mainappmodule
- 1.0
- jar
diff --git a/core-java-modules/multimodulemavenproject/pom.xml b/core-java-modules/multimodulemavenproject/pom.xml
index 3d56f1356b..ad347a4179 100644
--- a/core-java-modules/multimodulemavenproject/pom.xml
+++ b/core-java-modules/multimodulemavenproject/pom.xml
@@ -14,18 +14,25 @@
../../
+
+ entitymodule
+ daomodule
+ userdaomodule
+ mainappmodule
+
+
junit
junit
- 4.12
+ ${junit.version}
test
org.assertj
assertj-core
- 3.12.2
+ ${assertj-core.version}
test
@@ -49,14 +56,8 @@
-
- entitymodule
- daomodule
- userdaomodule
- mainappmodule
-
-
UTF-8
+ 3.12.2
diff --git a/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml b/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml
index 63968452db..d3543d5864 100644
--- a/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml
+++ b/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml
@@ -1,24 +1,16 @@
4.0.0
+ com.baeldung.userdaomodule
+ userdaomodule
+ 1.0
+ jar
+
com.baeldung.multimodulemavenproject
multimodulemavenproject
1.0
- com.baeldung.userdaomodule
- userdaomodule
- 1.0
- jar
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
-
@@ -33,6 +25,15 @@
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+
+
9
9
diff --git a/core-java-modules/pre-jpms/pom.xml b/core-java-modules/pre-jpms/pom.xml
index 169cd21f3e..380d94fbf1 100644
--- a/core-java-modules/pre-jpms/pom.xml
+++ b/core-java-modules/pre-jpms/pom.xml
@@ -18,9 +18,10 @@
org.slf4j
slf4j-api
- 1.7.25
+ ${org.slf4j.version}
+
pre-jpms
@@ -65,9 +66,9 @@
-
+
UTF-8
diff --git a/jackson-2/README.md b/jackson-2/README.md
index ee9f8458a0..d8c233a00e 100644
--- a/jackson-2/README.md
+++ b/jackson-2/README.md
@@ -9,4 +9,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Mapping Multiple JSON Fields to a Single Java Field](https://www.baeldung.com/json-multiple-fields-single-java-field)
- [How to Process YAML with Jackson](https://www.baeldung.com/jackson-yaml)
- [Working with Tree Model Nodes in Jackson](https://www.baeldung.com/jackson-json-node-tree-model)
-
+- [Converting JSON to CSV in Java](https://www.baeldung.com/java-converting-json-to-csv)
diff --git a/jackson-2/pom.xml b/jackson-2/pom.xml
index 6a975f1de7..2fff1f8706 100644
--- a/jackson-2/pom.xml
+++ b/jackson-2/pom.xml
@@ -26,21 +26,21 @@
com.fasterxml.jackson.dataformat
jackson-dataformat-yaml
- 2.9.8
+ ${jackson.version}
com.fasterxml.jackson.dataformat
jackson-dataformat-csv
- 2.9.8
+ ${jackson.version}
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
- 2.9.8
+ ${jackson.version}
diff --git a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java
new file mode 100644
index 0000000000..03d7c63e36
--- /dev/null
+++ b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java
@@ -0,0 +1,126 @@
+package com.baeldung.jackson.json.compare;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Comparator;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.NumericNode;
+import com.fasterxml.jackson.databind.node.TextNode;
+
+public class JsonCompareUnitTest {
+
+ @Test
+ public void givenTwoSameJsonDataObjects_whenCompared_thenAreEqual() throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\", \"age\": 34 }}";
+ String s2 = "{\"employee\": {\"id\": \"1212\",\"age\": 34, \"fullName\": \"John Miles\" }}";
+
+ JsonNode actualObj1 = mapper.readTree(s1);
+ JsonNode actualObj2 = mapper.readTree(s2);
+
+ assertEquals(actualObj1, actualObj2);
+
+ }
+
+ @Test
+ public void givenTwoSameNestedJsonDataObjects_whenCompared_thenEqual() throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}";
+ String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}";
+
+ JsonNode actualObj1 = mapper.readTree(s1);
+ JsonNode actualObj2 = mapper.readTree(s2);
+
+ assertEquals(actualObj1, actualObj2);
+
+ }
+
+ @Test
+ public void givenTwoSameListJsonDataObjects_whenCompared_thenEqual() throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"skills\":[\"Java\", \"C++\", \"Python\"] }}";
+ String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"skills\":[\"Java\", \"C++\", \"Python\"] }}";
+
+ JsonNode actualObj1 = mapper.readTree(s1);
+ JsonNode actualObj2 = mapper.readTree(s2);
+
+ assertEquals(actualObj1, actualObj2);
+
+ }
+
+ @Test
+ public void givenTwoJsonDataObjects_whenComparedUsingCustomNumericNodeComparator_thenEqual() throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String s1 = "{\"name\": \"John\",\"score\":5.0}";
+ String s2 = "{\"name\": \"John\",\"score\":5}";
+ JsonNode actualObj1 = mapper.readTree(s1);
+ JsonNode actualObj2 = mapper.readTree(s2);
+
+ NumericNodeComparator cmp = new NumericNodeComparator();
+
+ assertNotEquals(actualObj1, actualObj2);
+ assertTrue(actualObj1.equals(cmp, actualObj2));
+
+ }
+
+ public class NumericNodeComparator implements Comparator {
+ @Override
+ public int compare(JsonNode o1, JsonNode o2) {
+ if (o1.equals(o2)) {
+ return 0;
+ }
+ if ((o1 instanceof NumericNode) && (o2 instanceof NumericNode)) {
+ Double d1 = ((NumericNode) o1).asDouble();
+ Double d2 = ((NumericNode) o2).asDouble();
+ if (d1.compareTo(d2) == 0) {
+ return 0;
+ }
+ }
+ return 1;
+ }
+ }
+
+ @Test
+ public void givenTwoJsonDataObjects_whenComparedUsingCustomTextNodeComparator_thenEqual() throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String s1 = "{\"name\": \"JOHN\",\"score\":5}";
+ String s2 = "{\"name\": \"John\",\"score\":5}";
+ JsonNode actualObj1 = mapper.readTree(s1);
+ JsonNode actualObj2 = mapper.readTree(s2);
+
+ TextNodeComparator cmp = new TextNodeComparator();
+
+ assertNotEquals(actualObj1, actualObj2);
+ assertTrue(actualObj1.equals(cmp, actualObj2));
+
+ }
+
+ public class TextNodeComparator implements Comparator {
+ @Override
+ public int compare(JsonNode o1, JsonNode o2) {
+ if (o1.equals(o2)) {
+ return 0;
+ }
+ if ((o1 instanceof TextNode) && (o2 instanceof TextNode)) {
+ String s1 = ((TextNode) o1).asText();
+ String s2 = ((TextNode) o2).asText();
+ if (s1.equalsIgnoreCase(s2)) {
+ return 0;
+ }
+ }
+ return 1;
+ }
+ }
+}
diff --git a/java-collections-conversions/README.md b/java-collections-conversions/README.md
index 31fead3c42..614f20f186 100644
--- a/java-collections-conversions/README.md
+++ b/java-collections-conversions/README.md
@@ -10,4 +10,7 @@
- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string)
- [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map)
- [Array to String Conversions](https://www.baeldung.com/java-array-to-string)
-- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist)
\ No newline at end of file
+- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist)
+- [Java 8 Collectors toMap](https://www.baeldung.com/java-collectors-tomap)
+- [Converting Iterable to Collection in Java](https://www.baeldung.com/java-iterable-to-collection)
+- [Converting Iterator to List](https://www.baeldung.com/java-convert-iterator-to-list)
diff --git a/java-dates-2/pom.xml b/java-dates-2/pom.xml
index 2f861ff5f4..c1419514ef 100644
--- a/java-dates-2/pom.xml
+++ b/java-dates-2/pom.xml
@@ -25,7 +25,7 @@
commons-validator
commons-validator
- 1.6
+ ${commons-validator.version}
@@ -63,6 +63,7 @@
3.6.1
2.10
+ 1.6
1.9
1.9
diff --git a/java-math/pom.xml b/java-math/pom.xml
index 159d053df3..f71577b707 100644
--- a/java-math/pom.xml
+++ b/java-math/pom.xml
@@ -42,7 +42,7 @@
com.github.dpaukov
combinatoricslib3
- 3.3.0
+ ${combinatoricslib3.version}
@@ -63,6 +63,7 @@
3.9.0
1.11
27.0.1-jre
+ 3.3.0
\ No newline at end of file
diff --git a/java-streams-2/README.md b/java-streams-2/README.md
index 83ef97686f..851d3d71e2 100644
--- a/java-streams-2/README.md
+++ b/java-streams-2/README.md
@@ -1,3 +1,4 @@
### Relevant Articles:
- [Guide to Stream.reduce()](https://www.baeldung.com/java-stream-reduce)
-
+- [How to Break from Java Stream forEach](https://www.baeldung.com/java-break-stream-foreach)
+- [Java IntStream Conversions](https://www.baeldung.com/java-intstream-convert)
diff --git a/jws/pom.xml b/jws/pom.xml
index 2c89b687f8..6bc790e7ee 100644
--- a/jws/pom.xml
+++ b/jws/pom.xml
@@ -34,6 +34,7 @@
+ ${project.artifactId}
org.apache.maven.plugins
@@ -78,7 +79,6 @@
- ${project.artifactId}
diff --git a/kotlin-quasar/README.md b/kotlin-quasar/README.md
new file mode 100644
index 0000000000..b3b84e0446
--- /dev/null
+++ b/kotlin-quasar/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles
+
+- [Introduction to Quasar in Kotlin](https://www.baeldung.com/kotlin-quasar)
diff --git a/kotlin-quasar/pom.xml b/kotlin-quasar/pom.xml
index 44feabd183..a3e5a1ec25 100644
--- a/kotlin-quasar/pom.xml
+++ b/kotlin-quasar/pom.xml
@@ -45,6 +45,27 @@
junit
4.12
+
+
+ org.slf4j
+ slf4j-api
+ ${org.slf4j.version}
+
+
+ ch.qos.logback
+ logback-classic
+ ${logback.version}
+
+
+ ch.qos.logback
+ logback-core
+ ${logback.version}
+
+
+ org.slf4j
+ jcl-over-slf4j
+ ${org.slf4j.version}
+
@@ -116,5 +137,7 @@
0.8.0
1.3.31
+ 1.7.21
+ 1.1.7
diff --git a/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsBehaviorTest.kt b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsBehaviorTest.kt
new file mode 100644
index 0000000000..b4d0288a64
--- /dev/null
+++ b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsBehaviorTest.kt
@@ -0,0 +1,157 @@
+package com.baeldung.quasar
+
+import co.paralleluniverse.actors.Actor
+import co.paralleluniverse.actors.ActorRef
+import co.paralleluniverse.actors.behaviors.*
+import co.paralleluniverse.fibers.Suspendable
+import co.paralleluniverse.strands.SuspendableCallable
+import org.junit.Test
+import org.slf4j.LoggerFactory
+import java.lang.Exception
+
+class ActorsBehaviorTest {
+ companion object {
+ private val LOG = LoggerFactory.getLogger(ActorsBehaviorTest::class.java)
+ }
+
+ @Test
+ fun requestReplyHelper() {
+ data class TestMessage(val input: Int) : RequestMessage()
+
+ val actor = object : Actor("requestReplyActor", null) {
+ @Suspendable
+ override fun doRun(): Void? {
+ while (true) {
+ val msg = receive()
+ LOG.info("Processing message: {}", msg)
+
+ RequestReplyHelper.reply(msg, msg.input * 100)
+ }
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ val result = RequestReplyHelper.call(actorRef, TestMessage(50))
+ LOG.info("Received reply: {}", result)
+ }
+
+ @Test
+ fun server() {
+ val actor = ServerActor(object : AbstractServerHandler() {
+ @Suspendable
+ override fun handleCall(from: ActorRef<*>?, id: Any?, m: Int?): String {
+ LOG.info("Called with message: {} from {} with ID {}", m, from, id)
+ return m.toString() ?: "None"
+ }
+
+ @Suspendable
+ override fun handleCast(from: ActorRef<*>?, id: Any?, m: Float?) {
+ LOG.info("Cast message: {} from {} with ID {}", m, from, id)
+ }
+ })
+
+ val server = actor.spawn()
+
+ LOG.info("Call result: {}", server.call(5))
+ server.cast(2.5f)
+
+ server.shutdown()
+ }
+
+ interface Summer {
+ fun sum(a: Int, b: Int) : Int
+ }
+
+ @Test
+ fun proxyServer() {
+ val actor = ProxyServerActor(false, object : Summer {
+ @Synchronized
+ override fun sum(a: Int, b: Int): Int {
+ Exception().printStackTrace()
+ LOG.info("Adding together {} and {}", a, b)
+ return a + b
+ }
+ })
+
+ val summerActor = actor.spawn()
+
+ val result = (summerActor as Summer).sum(1, 2)
+ LOG.info("Result: {}", result)
+
+ summerActor.shutdown()
+ }
+
+ @Test
+ fun eventSource() {
+ val actor = EventSourceActor()
+ val eventSource = actor.spawn()
+
+ eventSource.addHandler { msg ->
+ LOG.info("Sent message: {}", msg)
+ }
+
+ val name = "Outside Value"
+ eventSource.addHandler { msg ->
+ LOG.info("Also Sent message: {} {}", msg, name)
+ }
+
+ eventSource.send("Hello")
+
+ eventSource.shutdown()
+ }
+
+ @Test
+ fun finiteStateMachine() {
+ val actor = object : FiniteStateMachineActor() {
+ @Suspendable
+ override fun initialState(): SuspendableCallable> {
+ LOG.info("Starting")
+ return SuspendableCallable { lockedState() }
+ }
+
+ @Suspendable
+ fun lockedState() : SuspendableCallable> {
+ return receive {msg ->
+ when (msg) {
+ "PUSH" -> {
+ LOG.info("Still locked")
+ lockedState()
+ }
+ "COIN" -> {
+ LOG.info("Unlocking...")
+ unlockedState()
+ }
+ else -> TERMINATE
+ }
+ }
+ }
+
+ @Suspendable
+ fun unlockedState() : SuspendableCallable> {
+ return receive {msg ->
+ when (msg) {
+ "PUSH" -> {
+ LOG.info("Locking")
+ lockedState()
+ }
+ "COIN" -> {
+ LOG.info("Unlocked")
+ unlockedState()
+ }
+ else -> TERMINATE
+ }
+ }
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ listOf("PUSH", "COIN", "COIN", "PUSH", "PUSH").forEach {
+ LOG.info(it)
+ actorRef.sendSync(it)
+ }
+
+ actorRef.shutdown()
+ }
+}
diff --git a/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsTest.kt b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsTest.kt
new file mode 100644
index 0000000000..819a149af3
--- /dev/null
+++ b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsTest.kt
@@ -0,0 +1,298 @@
+package com.baeldung.quasar
+
+import co.paralleluniverse.actors.*
+import co.paralleluniverse.fibers.Suspendable
+import co.paralleluniverse.strands.channels.Channels
+import org.junit.Assert
+import org.junit.Test
+import org.slf4j.LoggerFactory
+import java.util.concurrent.TimeUnit
+
+class ActorsTest {
+ companion object {
+ private val LOG = LoggerFactory.getLogger(ActorsTest::class.java)
+ }
+
+ @Test
+ fun createNoopActor() {
+ val actor = object : Actor("noopActor", MailboxConfig(5, Channels.OverflowPolicy.THROW)) {
+ @Suspendable
+ override fun doRun(): String {
+ return "Hello"
+ }
+ }
+
+ actor.spawn()
+
+ println("Noop Actor: ${actor.get()}")
+ }
+
+ @Test
+ fun registerActor() {
+ val actor = object : Actor("registerActor", null) {
+ @Suspendable
+ override fun doRun(): String {
+ return "Hello"
+ }
+ }
+
+ val actorRef = actor.spawn()
+ actor.register()
+
+ val retrievedRef = ActorRegistry.getActor>("registerActor")
+
+ Assert.assertEquals(actorRef, retrievedRef)
+ actor.join()
+ }
+
+ @Test
+ fun registerActorNewName() {
+ val actor = object : Actor(null, null) {
+ @Suspendable
+ override fun doRun(): String {
+ return "Hello"
+ }
+ }
+
+ val actorRef = actor.spawn()
+ actor.register("renamedActor")
+
+ val retrievedRef = ActorRegistry.getActor>("renamedActor")
+
+ Assert.assertEquals(actorRef, retrievedRef)
+ actor.join()
+ }
+
+ @Test
+ fun retrieveUnknownActor() {
+ val retrievedRef = ActorRegistry.getActor>("unknownActor", 1, TimeUnit.SECONDS)
+
+ Assert.assertNull(retrievedRef)
+ }
+
+ @Test
+ fun createSimpleActor() {
+ val actor = object : Actor("simpleActor", null) {
+ @Suspendable
+ override fun doRun(): Void? {
+ val msg = receive()
+ LOG.info("SimpleActor Received Message: {}", msg)
+
+ return null
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ actorRef.send(1)
+
+ actor.join()
+ }
+
+ @Test
+ fun createLoopingActor() {
+ val actor = object : Actor("loopingActor", null) {
+ @Suspendable
+ override fun doRun(): Void? {
+ while (true) {
+ val msg = receive()
+
+ if (msg > 0) {
+ LOG.info("LoopingActor Received Message: {}", msg)
+ } else {
+ break
+ }
+ }
+
+ return null
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ actorRef.send(3)
+ actorRef.send(2)
+ actorRef.send(1)
+ actorRef.send(0)
+
+ actor.join()
+ }
+
+ @Test
+ fun actorBacklog() {
+ val actor = object : Actor("backlogActor", MailboxConfig(1, Channels.OverflowPolicy.THROW)) {
+ @Suspendable
+ override fun doRun(): String {
+ TimeUnit.MILLISECONDS.sleep(500);
+ LOG.info("Backlog Actor Received: {}", receive())
+
+ try {
+ receive()
+ } catch (e: Throwable) {
+ LOG.info("==== Exception throws by receive() ====")
+ e.printStackTrace()
+ }
+
+ return "No Exception"
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ actorRef.send(1)
+ actorRef.send(2)
+
+ try {
+ LOG.info("Backlog Actor: {}", actor.get())
+ } catch (e: Exception) {
+ // Expected
+ LOG.info("==== Exception throws by get() ====")
+ e.printStackTrace()
+ }
+ }
+
+ @Test
+ fun actorBacklogTrySend() {
+ val actor = object : Actor("backlogTrySendActor", MailboxConfig(1, Channels.OverflowPolicy.THROW)) {
+ @Suspendable
+ override fun doRun(): String {
+ TimeUnit.MILLISECONDS.sleep(500);
+ LOG.info("Backlog TrySend Actor Received: {}", receive())
+
+ return "No Exception"
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ LOG.info("Backlog TrySend 1: {}", actorRef.trySend(1))
+ LOG.info("Backlog TrySend 1: {}", actorRef.trySend(2))
+
+ actor.join()
+ }
+
+ @Test
+ fun actorTimeoutReceive() {
+ val actor = object : Actor("TimeoutReceiveActor", MailboxConfig(1, Channels.OverflowPolicy.THROW)) {
+ @Suspendable
+ override fun doRun(): String {
+ LOG.info("Timeout Actor Received: {}", receive(500, TimeUnit.MILLISECONDS))
+
+ return "Finished"
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ TimeUnit.MILLISECONDS.sleep(300)
+ actorRef.trySend(1)
+
+ actor.join()
+ }
+
+
+ @Test
+ fun actorNonBlockingReceive() {
+ val actor = object : Actor("NonBlockingReceiveActor", MailboxConfig(1, Channels.OverflowPolicy.THROW)) {
+ @Suspendable
+ override fun doRun(): String {
+ LOG.info("NonBlocking Actor Received #1: {}", tryReceive())
+ TimeUnit.MILLISECONDS.sleep(500)
+ LOG.info("NonBlocking Actor Received #2: {}", tryReceive())
+
+ return "Finished"
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ TimeUnit.MILLISECONDS.sleep(300)
+ actorRef.trySend(1)
+
+ actor.join()
+ }
+
+ @Test
+ fun evenActor() {
+ val actor = object : Actor("EvenActor", null) {
+ @Suspendable
+ override fun filterMessage(m: Any?): Int? {
+ return when (m) {
+ is Int -> {
+ if (m % 2 == 0) {
+ m * 10
+ } else {
+ null
+ }
+ }
+ else -> super.filterMessage(m)
+ }
+ }
+
+ @Suspendable
+ override fun doRun(): Void? {
+ while (true) {
+ val msg = receive()
+
+ if (msg > 0) {
+ LOG.info("EvenActor Received Message: {}", msg)
+ } else {
+ break
+ }
+ }
+
+ return null
+ }
+ }
+
+ val actorRef = actor.spawn()
+
+ actorRef.send(3)
+ actorRef.send(2)
+ actorRef.send(1)
+ actorRef.send(0)
+
+ actor.join()
+ }
+
+ @Test
+ fun watchingActors() {
+ val watched = object : Actor("WatchedActor", null) {
+ @Suspendable
+ override fun doRun(): Void? {
+ LOG.info("WatchedActor Starting")
+ receive(500, TimeUnit.MILLISECONDS)
+ LOG.info("WatchedActor Finishing")
+ return null
+ }
+ }
+
+ val watcher = object : Actor("WatcherActor", null) {
+ @Suspendable
+ override fun doRun(): Void? {
+ LOG.info("WatcherActor Listening")
+ try {
+ LOG.info("WatcherActor received Message: {}", receive(2, TimeUnit.SECONDS))
+ } catch (e: Exception) {
+ LOG.info("WatcherActor Received Exception", e)
+ }
+ return null
+ }
+
+ @Suspendable
+ override fun handleLifecycleMessage(m: LifecycleMessage?): Int? {
+ LOG.info("WatcherActor Received Lifecycle Message: {}", m)
+ return super.handleLifecycleMessage(m)
+ }
+ }
+
+ val watcherRef = watcher.spawn()
+ TimeUnit.MILLISECONDS.sleep(200)
+
+ val watchedRef = watched.spawn()
+ watcher.link(watchedRef)
+
+ watched.join()
+ watcher.join()
+ }
+}
diff --git a/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ReactiveStreamsTest.kt b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ReactiveStreamsTest.kt
new file mode 100644
index 0000000000..83e06bf7d6
--- /dev/null
+++ b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ReactiveStreamsTest.kt
@@ -0,0 +1,135 @@
+package com.baeldung.quasar
+
+import co.paralleluniverse.fibers.Suspendable
+import co.paralleluniverse.kotlin.fiber
+import co.paralleluniverse.strands.channels.Channels
+import co.paralleluniverse.strands.channels.Topic
+import co.paralleluniverse.strands.channels.reactivestreams.ReactiveStreams
+import org.junit.Test
+import org.reactivestreams.Subscriber
+import org.reactivestreams.Subscription
+import org.slf4j.LoggerFactory
+import java.util.concurrent.TimeUnit
+
+class ReactiveStreamsTest {
+ companion object {
+ private val LOG = LoggerFactory.getLogger(ReactiveStreamsTest::class.java)
+ }
+
+ @Test
+ fun publisher() {
+ val inputChannel = Channels.newChannel(1);
+
+ val publisher = ReactiveStreams.toPublisher(inputChannel)
+ publisher.subscribe(object : Subscriber {
+ @Suspendable
+ override fun onComplete() {
+ LOG.info("onComplete")
+ }
+
+ @Suspendable
+ override fun onSubscribe(s: Subscription) {
+ LOG.info("onSubscribe: {}", s)
+ s.request(2)
+ }
+
+ @Suspendable
+ override fun onNext(t: String?) {
+ LOG.info("onNext: {}", t)
+ }
+
+ @Suspendable
+ override fun onError(t: Throwable?) {
+ LOG.info("onError: {}", t)
+ }
+ })
+
+ inputChannel.send("Hello")
+ inputChannel.send("World")
+
+ TimeUnit.SECONDS.sleep(1)
+
+ inputChannel.close()
+ }
+
+ @Test
+ fun publisherTopic() {
+ val inputTopic = Topic()
+
+ val publisher = ReactiveStreams.toPublisher(inputTopic)
+ publisher.subscribe(object : Subscriber {
+ @Suspendable
+ override fun onComplete() {
+ LOG.info("onComplete 1")
+ }
+
+ @Suspendable
+ override fun onSubscribe(s: Subscription) {
+ LOG.info("onSubscribe 1: {}", s)
+ s.request(2)
+ }
+
+ @Suspendable
+ override fun onNext(t: String?) {
+ LOG.info("onNext 1: {}", t)
+ }
+
+ @Suspendable
+ override fun onError(t: Throwable?) {
+ LOG.info("onError 1: {}", t)
+ }
+ })
+ publisher.subscribe(object : Subscriber {
+ @Suspendable
+ override fun onComplete() {
+ LOG.info("onComplete 2")
+ }
+
+ @Suspendable
+ override fun onSubscribe(s: Subscription) {
+ LOG.info("onSubscribe 2: {}", s)
+ s.request(2)
+ }
+
+ @Suspendable
+ override fun onNext(t: String?) {
+ LOG.info("onNext 2: {}", t)
+ }
+
+ @Suspendable
+ override fun onError(t: Throwable?) {
+ LOG.info("onError 2: {}", t)
+ }
+ })
+
+ inputTopic.send("Hello")
+ inputTopic.send("World")
+
+ TimeUnit.SECONDS.sleep(1)
+
+ inputTopic.close()
+ }
+
+ @Test
+ fun subscribe() {
+ val inputChannel = Channels.newChannel(10);
+ val publisher = ReactiveStreams.toPublisher(inputChannel)
+
+ val channel = ReactiveStreams.subscribe(10, Channels.OverflowPolicy.THROW, publisher)
+
+ fiber @Suspendable {
+ while (!channel.isClosed) {
+ val message = channel.receive()
+ LOG.info("Received: {}", message)
+ }
+ LOG.info("Stopped receiving messages")
+ }
+
+ inputChannel.send("Hello")
+ inputChannel.send("World")
+
+ TimeUnit.SECONDS.sleep(1)
+
+ inputChannel.close()
+ }
+}
diff --git a/libraries-2/README.md b/libraries-2/README.md
index cdeed10b3f..1b042ac3c5 100644
--- a/libraries-2/README.md
+++ b/libraries-2/README.md
@@ -5,3 +5,6 @@
- [Guide to Classgraph Library](https://www.baeldung.com/classgraph)
- [Create a Java Command Line Program with Picocli](https://www.baeldung.com/java-picocli-create-command-line-program)
- [Guide to Java Parallel Collectors Library](https://www.baeldung.com/java-parallel-collectors)
+- [Templating with Handlebars](https://www.baeldung.com/handlebars)
+- [A Guide to Crawler4j](https://www.baeldung.com/crawler4j)
+- [Decode an OkHttp JSON Response](https://www.baeldung.com/okhttp-json-response)
diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml
index 7bd3f5b355..ff73888b69 100644
--- a/libraries-2/pom.xml
+++ b/libraries-2/pom.xml
@@ -5,11 +5,13 @@
4.0.0
libraries2
libraries2
+
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+
jboss-public-repository-group
@@ -25,6 +27,7 @@
+
org.mapdb
@@ -34,7 +37,7 @@
com.pivovarit
parallel-collectors
- 1.1.0
+ ${parallel-collectors.version}
org.assertj
@@ -96,22 +99,22 @@
com.squareup.okhttp3
okhttp
- 3.14.2
+ ${okhttp.version}
com.fasterxml.jackson.core
jackson-databind
- 2.9.9
+ ${jackson.version}
com.google.code.gson
gson
- 2.8.5
+ ${gson.version}
com.squareup.okhttp3
mockwebserver
- 3.14.2
+ ${mockwebserver.version}
test
@@ -122,7 +125,7 @@
com.github.jknack
handlebars
- 4.1.2
+ ${handlebars.version}
@@ -141,6 +144,7 @@
${mesos.library.version}
+
3.0.7
3.6.2
@@ -156,5 +160,10 @@
0.6.0
1.19
0.28.3
+ 1.1.0
+ 3.14.2
+ 2.8.5
+ 3.14.2
+ 4.1.2
diff --git a/libraries-http/README.md b/libraries-http/README.md
new file mode 100644
index 0000000000..dd8c6a5f67
--- /dev/null
+++ b/libraries-http/README.md
@@ -0,0 +1,7 @@
+
+### Relevant Articles:
+
+- [A Guide to OkHttp](http://www.baeldung.com/guide-to-okhttp)
+- [A Guide to Google-Http-Client](http://www.baeldung.com/google-http-client)
+- [Asynchronous HTTP with async-http-client in Java](http://www.baeldung.com/async-http-client)
+- [WebSockets with AsyncHttpClient](http://www.baeldung.com/async-http-client-websockets)
diff --git a/libraries-http/pom.xml b/libraries-http/pom.xml
new file mode 100644
index 0000000000..6006a93aef
--- /dev/null
+++ b/libraries-http/pom.xml
@@ -0,0 +1,81 @@
+
+
+
+ 4.0.0
+ libraries-http
+ libraries-http
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
+
+
+
+ org.assertj
+ assertj-core
+ ${assertj.version}
+
+
+
+
+ com.squareup.okhttp3
+ okhttp
+ ${com.squareup.okhttp3.version}
+
+
+
+
+ com.google.http-client
+ google-http-client
+ ${googleclient.version}
+
+
+ com.google.http-client
+ google-http-client-jackson2
+ ${googleclient.version}
+
+
+ com.google.http-client
+ google-http-client-gson
+ ${googleclient.version}
+
+
+
+
+ org.asynchttpclient
+ async-http-client
+ ${async.http.client.version}
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson.version}
+
+
+
+ com.google.code.gson
+ gson
+ 2.8.5
+
+
+
+ com.squareup.okhttp3
+ mockwebserver
+ ${com.squareup.okhttp3.version}
+ test
+
+
+
+
+
+ 3.6.2
+ 3.14.2
+ 1.23.0
+ 2.2.0
+
+
diff --git a/libraries/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java b/libraries-http/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java
similarity index 100%
rename from libraries/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java
rename to libraries-http/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java
diff --git a/libraries/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java b/libraries-http/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java
similarity index 100%
rename from libraries/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java
rename to libraries-http/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java
diff --git a/libraries/src/main/java/com/baeldung/googlehttpclientguide/User.java b/libraries-http/src/main/java/com/baeldung/googlehttpclientguide/User.java
similarity index 100%
rename from libraries/src/main/java/com/baeldung/googlehttpclientguide/User.java
rename to libraries-http/src/main/java/com/baeldung/googlehttpclientguide/User.java
diff --git a/libraries/src/main/java/com/baeldung/googlehttpclientguide/logging.properties b/libraries-http/src/main/java/com/baeldung/googlehttpclientguide/logging.properties
similarity index 100%
rename from libraries/src/main/java/com/baeldung/googlehttpclientguide/logging.properties
rename to libraries-http/src/main/java/com/baeldung/googlehttpclientguide/logging.properties
diff --git a/libraries-http/src/main/resources/logback.xml b/libraries-http/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/libraries-http/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/libraries/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java b/libraries-http/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java
similarity index 100%
rename from libraries/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java
rename to libraries-http/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java
diff --git a/spring-rest/src/test/java/com/baeldung/client/Consts.java b/libraries-http/src/test/java/com/baeldung/client/Consts.java
similarity index 100%
rename from spring-rest/src/test/java/com/baeldung/client/Consts.java
rename to libraries-http/src/test/java/com/baeldung/client/Consts.java
diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java b/libraries-http/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java
similarity index 100%
rename from spring-rest/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java
rename to libraries-http/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java
diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java
similarity index 93%
rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java
rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java
index 75980a5360..7b28c17607 100644
--- a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java
+++ b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java
@@ -19,6 +19,9 @@ import okhttp3.Response;
import org.junit.Before;
import org.junit.Test;
+/**
+ * Execute spring-rest module before running this live test
+ */
public class OkHttpFileUploadingLiveTest {
private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest";
diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java
similarity index 93%
rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java
rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java
index 3edd2eab06..5efc4aa998 100644
--- a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java
+++ b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java
@@ -17,6 +17,9 @@ import okhttp3.Response;
import org.junit.Before;
import org.junit.Test;
+/**
+ * Execute spring-rest module before running this live test
+ */
public class OkHttpGetLiveTest {
private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest";
diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java
similarity index 100%
rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java
rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java
diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java
similarity index 95%
rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java
rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java
index 207ad14e71..24617794d1 100644
--- a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java
+++ b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java
@@ -20,6 +20,9 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Execute spring-rest module before running this live test
+ */
public class OkHttpMiscLiveTest {
private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest";
diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java
similarity index 94%
rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java
rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java
index 66fee0b626..19e689c093 100644
--- a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java
+++ b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java
@@ -20,6 +20,9 @@ import okhttp3.Response;
import org.junit.Before;
import org.junit.Test;
+/**
+ * Execute spring-rest module before running this live test
+ */
public class OkHttpPostingLiveTest {
private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest";
diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java
similarity index 100%
rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java
rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java
diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java b/libraries-http/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java
similarity index 100%
rename from spring-rest/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java
rename to libraries-http/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java
diff --git a/libraries/README.md b/libraries/README.md
index f6a39daef1..f6f2cf4e07 100644
--- a/libraries/README.md
+++ b/libraries/README.md
@@ -36,14 +36,11 @@
- [Introduction To Docx4J](http://www.baeldung.com/docx4j)
- [Introduction to StreamEx](http://www.baeldung.com/streamex)
- [Introduction to BouncyCastle with Java](http://www.baeldung.com/java-bouncy-castle)
-- [A Guide to Google-Http-Client](http://www.baeldung.com/google-http-client)
- [Interact with Google Sheets from Java](http://www.baeldung.com/google-sheets-java-client)
- [A Docker Guide for Java](http://www.baeldung.com/docker-java-api)
- [Introduction To OpenCSV](http://www.baeldung.com/opencsv)
- [Introduction to Akka Actors in Java](http://www.baeldung.com/akka-actors-java)
-- [Asynchronous HTTP with async-http-client in Java](http://www.baeldung.com/async-http-client)
- [Introduction to Smooks](http://www.baeldung.com/smooks)
-- [WebSockets with AsyncHttpClient](http://www.baeldung.com/async-http-client-websockets)
- [A Guide to Infinispan in Java](http://www.baeldung.com/infinispan)
- [Introduction to OpenCSV](http://www.baeldung.com/opencsv)
- [A Guide to Unirest](http://www.baeldung.com/unirest)
diff --git a/libraries/pom.xml b/libraries/pom.xml
index 886dd3c4a2..8e787bdc22 100644
--- a/libraries/pom.xml
+++ b/libraries/pom.xml
@@ -18,23 +18,12 @@
akka-actor_2.12
${typesafe-akka.version}
-
-
-
-
com.typesafe.akka
akka-testkit_2.12
${typesafe-akka.version}
test
-
-
-
- org.asynchttpclient
- async-http-client
- ${async.http.client.version}
-
org.beykery
@@ -875,7 +864,6 @@
2.0.0
1.7.0
3.0.14
- 2.2.0
9.1.5.Final
4.1
1.4.9
diff --git a/maven-java-11/multimodule-maven-project/daomodule/pom.xml b/maven-java-11/multimodule-maven-project/daomodule/pom.xml
index de9be656d4..5520c5a90a 100644
--- a/maven-java-11/multimodule-maven-project/daomodule/pom.xml
+++ b/maven-java-11/multimodule-maven-project/daomodule/pom.xml
@@ -1,14 +1,15 @@
4.0.0
-
- com.baeldung.multimodule-maven-project
- multimodule-maven-project
- 1.0
-
com.baeldung.daomodule
daomodule
jar
1.0
daomodule
+
+
+ com.baeldung.multimodule-maven-project
+ multimodule-maven-project
+ 1.0
+
diff --git a/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml b/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml
index 8e700e62b5..747722e912 100644
--- a/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml
+++ b/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml
@@ -1,16 +1,18 @@
4.0.0
-
- com.baeldung.multimodule-maven-project
- multimodule-maven-project
- 1.0
-
com.baeldung.entitymodule
entitymodule
jar
1.0
entitymodule
+
+
+ com.baeldung.multimodule-maven-project
+ multimodule-maven-project
+ 1.0
+
+
11
11
diff --git a/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml b/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml
index d2c94527f1..3e5ec122ff 100644
--- a/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml
+++ b/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml
@@ -1,16 +1,17 @@
4.0.0
-
- com.baeldung.multimodule-maven-project
- multimodule-maven-project
- 1.0
-
com.baeldung.mainappmodule
mainappmodule
1.0
jar
mainappmodule
+
+
+ com.baeldung.multimodule-maven-project
+ multimodule-maven-project
+ 1.0
+
diff --git a/maven-java-11/multimodule-maven-project/pom.xml b/maven-java-11/multimodule-maven-project/pom.xml
index f22541738c..7e2eb0dd7b 100644
--- a/maven-java-11/multimodule-maven-project/pom.xml
+++ b/maven-java-11/multimodule-maven-project/pom.xml
@@ -6,12 +6,20 @@
1.0
pom
multimodule-maven-project
+
com.baeldung.maven-java-11
maven-java-11
1.0
+
+ entitymodule
+ daomodule
+ userdaomodule
+ mainappmodule
+
+
@@ -45,13 +53,6 @@
-
- entitymodule
- daomodule
- userdaomodule
- mainappmodule
-
-
UTF-8
diff --git a/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml b/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml
index b4fe7f0398..68e7ae9b82 100644
--- a/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml
+++ b/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml
@@ -1,16 +1,18 @@
4.0.0
-
- com.baeldung.multimodule-maven-project
- multimodule-maven-project
- 1.0
-
com.baeldung.userdaomodule
userdaomodule
1.0
jar
userdaomodule
+
+
+ com.baeldung.multimodule-maven-project
+ multimodule-maven-project
+ 1.0
+
+
com.baeldung.entitymodule
diff --git a/maven-java-11/pom.xml b/maven-java-11/pom.xml
index ff95840523..5ae4c00892 100644
--- a/maven-java-11/pom.xml
+++ b/maven-java-11/pom.xml
@@ -6,14 +6,17 @@
1.0
pom
maven-java-11
+
- parent-modules
- com.baeldung
- 1.0.0-SNAPSHOT
+ parent-modules
+ com.baeldung
+ 1.0.0-SNAPSHOT
+
multimodule-maven-project
+
UTF-8
11
diff --git a/maven/pom.xml b/maven/pom.xml
index 942bf683e2..ecb031fc11 100644
--- a/maven/pom.xml
+++ b/maven/pom.xml
@@ -4,12 +4,13 @@
com.baeldung
maven
0.0.1-SNAPSHOT
+ maven
+ pom
+
custom-rule
maven-enforcer
- maven
- pom
diff --git a/maven/versions-maven-plugin/original/pom.xml b/maven/versions-maven-plugin/original/pom.xml
index 7608e4d168..df8ee9a20e 100644
--- a/maven/versions-maven-plugin/original/pom.xml
+++ b/maven/versions-maven-plugin/original/pom.xml
@@ -11,19 +11,19 @@
commons-io
commons-io
- 2.3
+ ${commons-io.version}
org.apache.commons
commons-collections4
- 4.0
+ ${commons-collections4.version}
org.apache.commons
commons-lang3
- 3.0
+ ${commons-lang3.version}
@@ -35,7 +35,7 @@
commons-beanutils
commons-beanutils
- 1.9.1-SNAPSHOT
+ ${commons-beanutils.version}
@@ -71,6 +71,10 @@
1.15
+ 2.3
+ 4.0
+ 3.0
+ 1.9.1
\ No newline at end of file
diff --git a/maven/versions-maven-plugin/pom.xml b/maven/versions-maven-plugin/pom.xml
index dc0cba75f9..e0714bf0e0 100644
--- a/maven/versions-maven-plugin/pom.xml
+++ b/maven/versions-maven-plugin/pom.xml
@@ -6,10 +6,6 @@
versions-maven-plugin
0.0.1-SNAPSHOT
versions-maven-plugin
-
-
- 1.15
-
@@ -73,5 +69,9 @@
+
+
+ 1.15
+
\ No newline at end of file
diff --git a/morphia/README.md b/morphia/README.md
new file mode 100644
index 0000000000..008cf76c49
--- /dev/null
+++ b/morphia/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+
+- [Intro to Morphia](http://www.baeldung.com/intro-to-morphia)
diff --git a/morphia/pom.xml b/morphia/pom.xml
new file mode 100644
index 0000000000..e4010a26a1
--- /dev/null
+++ b/morphia/pom.xml
@@ -0,0 +1,43 @@
+
+
+ 4.0.0
+ com.baeldung.morphia
+ morphia
+ morphia
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+ ..
+
+
+
+
+ dev.morphia.morphia
+ core
+ ${morphia.version}
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot-maven-plugin.version}
+
+
+
+
+
+
+ 1.4.2.RELEASE
+ 1.5.3
+
+
+
diff --git a/morphia/src/main/java/com/baeldung/morphia/domain/Author.java b/morphia/src/main/java/com/baeldung/morphia/domain/Author.java
new file mode 100644
index 0000000000..b45aee6068
--- /dev/null
+++ b/morphia/src/main/java/com/baeldung/morphia/domain/Author.java
@@ -0,0 +1,31 @@
+package com.baeldung.morphia.domain;
+
+import java.util.List;
+
+import dev.morphia.annotations.Entity;
+import dev.morphia.annotations.Id;
+
+@Entity
+public class Author {
+
+ @Id
+ private String name;
+ private List books;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List getBooks() {
+ return books;
+ }
+
+ public void setBooks(List books) {
+ this.books = books;
+ }
+
+}
diff --git a/morphia/src/main/java/com/baeldung/morphia/domain/Book.java b/morphia/src/main/java/com/baeldung/morphia/domain/Book.java
new file mode 100644
index 0000000000..172c916ad9
--- /dev/null
+++ b/morphia/src/main/java/com/baeldung/morphia/domain/Book.java
@@ -0,0 +1,116 @@
+package com.baeldung.morphia.domain;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import dev.morphia.annotations.Embedded;
+import dev.morphia.annotations.Entity;
+import dev.morphia.annotations.Field;
+import dev.morphia.annotations.Id;
+import dev.morphia.annotations.Index;
+import dev.morphia.annotations.IndexOptions;
+import dev.morphia.annotations.Indexes;
+import dev.morphia.annotations.Property;
+import dev.morphia.annotations.Reference;
+import dev.morphia.annotations.Validation;
+
+@Entity("Books")
+@Indexes({ @Index(fields = @Field("title"), options = @IndexOptions(name = "book_title")) })
+@Validation("{ price : { $gt : 0 } }")
+public class Book {
+ @Id
+ private String isbn;
+ @Property
+ private String title;
+ private String author;
+ @Embedded
+ private Publisher publisher;
+ @Property("price")
+ private double cost;
+ @Reference
+ private Set companionBooks;
+
+ public Book() {
+
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getAuthor() {
+ return author;
+ }
+
+ public double getCost() {
+ return cost;
+ }
+
+ public void addCompanionBooks(Book book) {
+ if (companionBooks != null)
+ this.companionBooks.add(book);
+ }
+
+ public Book(String isbn, String title, String author, double cost, Publisher publisher) {
+ this.isbn = isbn;
+ this.title = title;
+ this.author = author;
+ this.cost = cost;
+ this.publisher = publisher;
+ this.companionBooks = new HashSet<>();
+ }
+
+ @Override
+ public String toString() {
+ return "Book [isbn=" + isbn + ", title=" + title + ", author=" + author + ", publisher=" + publisher + ", cost=" + cost + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((author == null) ? 0 : author.hashCode());
+ long temp;
+ temp = Double.doubleToLongBits(cost);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ result = prime * result + ((isbn == null) ? 0 : isbn.hashCode());
+ result = prime * result + ((publisher == null) ? 0 : publisher.hashCode());
+ result = prime * result + ((title == null) ? 0 : title.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Book other = (Book) obj;
+ if (author == null) {
+ if (other.author != null)
+ return false;
+ } else if (!author.equals(other.author))
+ return false;
+ if (Double.doubleToLongBits(cost) != Double.doubleToLongBits(other.cost))
+ return false;
+ if (isbn == null) {
+ if (other.isbn != null)
+ return false;
+ } else if (!isbn.equals(other.isbn))
+ return false;
+ if (publisher == null) {
+ if (other.publisher != null)
+ return false;
+ } else if (!publisher.equals(other.publisher))
+ return false;
+ if (title == null) {
+ if (other.title != null)
+ return false;
+ } else if (!title.equals(other.title))
+ return false;
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/morphia/src/main/java/com/baeldung/morphia/domain/Publisher.java b/morphia/src/main/java/com/baeldung/morphia/domain/Publisher.java
new file mode 100644
index 0000000000..b9e054e9ab
--- /dev/null
+++ b/morphia/src/main/java/com/baeldung/morphia/domain/Publisher.java
@@ -0,0 +1,70 @@
+package com.baeldung.morphia.domain;
+
+import org.bson.types.ObjectId;
+
+import dev.morphia.annotations.Entity;
+import dev.morphia.annotations.Id;
+
+@Entity
+public class Publisher {
+
+ @Id
+ private ObjectId id;
+ private String name;
+
+ public Publisher() {
+
+ }
+
+ public Publisher(ObjectId id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public ObjectId getId() {
+ return id;
+ }
+
+ public void setId(ObjectId id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return "Catalog [id=" + id + ", name=" + name + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Publisher other = (Publisher) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+}
diff --git a/morphia/src/main/resources/logback.xml b/morphia/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/morphia/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/morphia/src/test/java/com/baeldung/morphia/MorphiaIntegrationTest.java b/morphia/src/test/java/com/baeldung/morphia/MorphiaIntegrationTest.java
new file mode 100644
index 0000000000..a2542a56ab
--- /dev/null
+++ b/morphia/src/test/java/com/baeldung/morphia/MorphiaIntegrationTest.java
@@ -0,0 +1,130 @@
+package com.baeldung.morphia;
+
+import static dev.morphia.aggregation.Group.grouping;
+import static dev.morphia.aggregation.Group.push;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.bson.types.ObjectId;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.baeldung.morphia.domain.Author;
+import com.baeldung.morphia.domain.Book;
+import com.baeldung.morphia.domain.Publisher;
+import com.mongodb.MongoClient;
+
+import dev.morphia.Datastore;
+import dev.morphia.Morphia;
+import dev.morphia.query.Query;
+import dev.morphia.query.UpdateOperations;
+
+@Ignore
+public class MorphiaIntegrationTest {
+
+ private static Datastore datastore;
+ private static ObjectId id = new ObjectId();
+
+ @BeforeClass
+ public static void setUp() {
+ Morphia morphia = new Morphia();
+ morphia.mapPackage("com.baeldung.morphia");
+ datastore = morphia.createDatastore(new MongoClient(), "library");
+ datastore.ensureIndexes();
+ }
+
+ @Test
+ public void givenDataSource_whenCreateEntity_thenEntityCreated() {
+ Publisher publisher = new Publisher(id, "Awsome Publisher");
+ Book book = new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher);
+ Book companionBook = new Book("9789332575103", "Java Performance Companion", "Tom Kirkman", 1.95, publisher);
+ book.addCompanionBooks(companionBook);
+ datastore.save(companionBook);
+ datastore.save(book);
+
+ List books = datastore.createQuery(Book.class)
+ .field("title")
+ .contains("Learning Java")
+ .find()
+ .toList();
+ assertEquals(books.size(), 1);
+ assertEquals(books.get(0), book);
+ }
+
+ @Test
+ public void givenDocument_whenUpdated_thenUpdateReflected() {
+ Publisher publisher = new Publisher(id, "Awsome Publisher");
+ Book book = new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher);
+ datastore.save(book);
+ Query query = datastore.createQuery(Book.class)
+ .field("title")
+ .contains("Learning Java");
+ UpdateOperations updates = datastore.createUpdateOperations(Book.class)
+ .inc("price", 1);
+ datastore.update(query, updates);
+ List books = datastore.createQuery(Book.class)
+ .field("title")
+ .contains("Learning Java")
+ .find()
+ .toList();
+ assertEquals(books.get(0)
+ .getCost(), 4.95);
+ }
+
+ @Test
+ public void givenDocument_whenDeleted_thenDeleteReflected() {
+ Publisher publisher = new Publisher(id, "Awsome Publisher");
+ Book book = new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher);
+ datastore.save(book);
+ Query query = datastore.createQuery(Book.class)
+ .field("title")
+ .contains("Learning Java");
+ datastore.delete(query);
+ List books = datastore.createQuery(Book.class)
+ .field("title")
+ .contains("Learning Java")
+ .find()
+ .toList();
+ assertEquals(books.size(), 0);
+ }
+
+ @Test
+ public void givenDocument_whenAggregated_thenResultsCollected() {
+ Publisher publisher = new Publisher(id, "Awsome Publisher");
+ datastore.save(new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher));
+ datastore.save(new Book("9781449313142", "Learning Perl", "Mark Pence", 2.95, publisher));
+ datastore.save(new Book("9787564100476", "Learning Python", "Mark Pence", 5.95, publisher));
+ datastore.save(new Book("9781449368814", "Learning Scala", "Mark Pence", 6.95, publisher));
+ datastore.save(new Book("9781784392338", "Learning Go", "Jonathan Sawyer", 8.95, publisher));
+
+ Iterator authors = datastore.createAggregation(Book.class)
+ .group("author", grouping("books", push("title")))
+ .out(Author.class);
+
+ assertTrue(authors.hasNext());
+
+ }
+
+ @Test
+ public void givenDocument_whenProjected_thenOnlyProjectionReceived() {
+ Publisher publisher = new Publisher(id, "Awsome Publisher");
+ Book book = new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher);
+ datastore.save(book);
+ List books = datastore.createQuery(Book.class)
+ .field("title")
+ .contains("Learning Java")
+ .project("title", true)
+ .find()
+ .toList();
+ assertEquals(books.size(), 1);
+ assertEquals("Learning Java", books.get(0)
+ .getTitle());
+ assertEquals(null, books.get(0)
+ .getAuthor());
+ }
+
+}
diff --git a/msf4j/pom.xml b/msf4j/pom.xml
index 4a6f63159d..2a862ac289 100644
--- a/msf4j/pom.xml
+++ b/msf4j/pom.xml
@@ -23,6 +23,7 @@
+
org.wso2.msf4j
diff --git a/optaplanner/pom.xml b/optaplanner/pom.xml
index fbce0ea072..93b1e68264 100644
--- a/optaplanner/pom.xml
+++ b/optaplanner/pom.xml
@@ -18,11 +18,6 @@
optaplanner-core
7.9.0.Final
-
-
-
-
-
\ No newline at end of file
diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml
index 4b81e27333..f0e921bf37 100644
--- a/parent-boot-2/pom.xml
+++ b/parent-boot-2/pom.xml
@@ -1,9 +1,9 @@
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
parent-boot-2
0.0.1-SNAPSHOT
- parent-boot-2
+ parent-boot-2
pom
Parent for all Spring Boot 2 modules
@@ -13,7 +13,7 @@
1.0.0-SNAPSHOT
-
+
org.springframework.boot
@@ -28,7 +28,7 @@
io.rest-assured
rest-assured
-
+
org.springframework.boot
spring-boot-starter-test
@@ -36,22 +36,22 @@
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- ${spring-boot.version}
-
- ${start-class}
-
-
-
-
-
-
-
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+ ${start-class}
+
+
+
+
+
+
+
thin-jar
@@ -75,9 +75,9 @@
- 3.1.0
+ 3.3.0
- 1.0.21.RELEASE
- 2.1.3.RELEASE
+ 1.0.22.RELEASE
+ 2.1.6.RELEASE
diff --git a/parent-boot-performance/pom.xml b/parent-boot-performance/pom.xml
index b1c6854eae..b7d12e2ba4 100644
--- a/parent-boot-performance/pom.xml
+++ b/parent-boot-performance/pom.xml
@@ -13,13 +13,6 @@
1.0.0-SNAPSHOT
-
- 3.1.0
-
- 1.0.21.RELEASE
- 2.2.0.M3
-
-
@@ -31,6 +24,7 @@
+
io.rest-assured
@@ -88,4 +82,11 @@
+
+
+ 3.1.0
+
+ 1.0.21.RELEASE
+ 2.2.0.M3
+
diff --git a/patterns/design-patterns/pom.xml b/patterns/design-patterns/pom.xml
index ac201ad653..e6bff64f9e 100644
--- a/patterns/design-patterns/pom.xml
+++ b/patterns/design-patterns/pom.xml
@@ -48,6 +48,7 @@
${grep4j.version}
+
UTF-8
1.8
diff --git a/patterns/dip/pom.xml b/patterns/dip/pom.xml
index dac3f824f2..bc793c0090 100644
--- a/patterns/dip/pom.xml
+++ b/patterns/dip/pom.xml
@@ -19,13 +19,13 @@
junit
junit
- 4.12
+ ${junit.version}
test
org.assertj
assertj-core
- 3.12.1
+ ${assertj-core.version}
test
@@ -34,6 +34,7 @@
UTF-8
11
11
+ 3.12.1
diff --git a/persistence-modules/elasticsearch/README.md b/persistence-modules/elasticsearch/README.md
new file mode 100644
index 0000000000..691e855314
--- /dev/null
+++ b/persistence-modules/elasticsearch/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles
+
+- [Jest – Elasticsearch Java Client](https://www.baeldung.com/elasticsearch-jest)
diff --git a/persistence-modules/elasticsearch/pom.xml b/persistence-modules/elasticsearch/pom.xml
index ceed88aa24..f7bfdb44de 100644
--- a/persistence-modules/elasticsearch/pom.xml
+++ b/persistence-modules/elasticsearch/pom.xml
@@ -20,12 +20,16 @@
io.searchbox
jest
- 6.3.1
+ ${jest.version}
com.fasterxml.jackson.core
jackson-databind
- 2.9.6
+ ${jackson.version}
+
+
+ 6.3.1
+
diff --git a/persistence-modules/hibernate-mapping/README.md b/persistence-modules/hibernate-mapping/README.md
index 203cb2f8e4..0df13653b9 100644
--- a/persistence-modules/hibernate-mapping/README.md
+++ b/persistence-modules/hibernate-mapping/README.md
@@ -3,3 +3,4 @@
- [Persisting Maps with Hibernate](https://www.baeldung.com/hibernate-persisting-maps)
- [Difference Between @Size, @Length, and @Column(length=value)](https://www.baeldung.com/jpa-size-length-column-differences)
+- [Hibernate Validator Specific Constraints](https://www.baeldung.com/hibernate-validator-constraints)
diff --git a/persistence-modules/hibernate-mapping/pom.xml b/persistence-modules/hibernate-mapping/pom.xml
index bb8ebdab65..509c54ca75 100644
--- a/persistence-modules/hibernate-mapping/pom.xml
+++ b/persistence-modules/hibernate-mapping/pom.xml
@@ -2,6 +2,9 @@
+ hibernate-mapping
+ 1.0.0-SNAPSHOT
+ 4.0.0
com.baeldung
@@ -10,10 +13,6 @@
..
- hibernate-mapping
- 1.0.0-SNAPSHOT
- 4.0.0
-
org.hibernate
@@ -45,12 +44,12 @@
javax.money
money-api
- 1.0.3
+ ${money-api.version}
org.javamoney
moneta
- 1.3
+ ${moneta.version}
pom
@@ -70,6 +69,8 @@
3.8.0
6.0.16.Final
3.0.1-b11
+ 1.0.3
+ 1.3
diff --git a/persistence-modules/hibernate-ogm/pom.xml b/persistence-modules/hibernate-ogm/pom.xml
index 2ccac03bd3..7ac29b1720 100644
--- a/persistence-modules/hibernate-ogm/pom.xml
+++ b/persistence-modules/hibernate-ogm/pom.xml
@@ -19,31 +19,31 @@
org.hibernate.ogm
hibernate-ogm-mongodb
- 5.4.0.Final
+ ${hibernate.version}
org.hibernate.ogm
hibernate-ogm-neo4j
- 5.4.0.Final
+ ${hibernate.version}
org.jboss.narayana.jta
narayana-jta
- 5.5.23.Final
+ ${narayana-jta.version}
junit
junit
- 4.12
+ ${junit.version}
test
org.easytesting
fest-assert
- 1.4
+ ${fest-assert.version}
test
@@ -57,4 +57,10 @@
+
+
+ 5.4.0.Final
+ 1.4
+ 5.5.23.Final
+
\ No newline at end of file
diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md
index 68008bc8fe..65322f0cea 100644
--- a/persistence-modules/hibernate5/README.md
+++ b/persistence-modules/hibernate5/README.md
@@ -33,3 +33,4 @@
- [Hibernate Aggregate Functions](https://www.baeldung.com/hibernate-aggregate-functions)
- [Hibernate Query Plan Cache](https://www.baeldung.com/hibernate-query-plan-cache)
- [TransactionRequiredException Error](https://www.baeldung.com/jpa-transaction-required-exception)
+- [Enabling Transaction Locks in Spring Data JPA](https://www.baeldung.com/java-jpa-transaction-locks)
diff --git a/persistence-modules/hibernate5/pom.xml b/persistence-modules/hibernate5/pom.xml
index 7a9fdc0d34..bf4b2d27ec 100644
--- a/persistence-modules/hibernate5/pom.xml
+++ b/persistence-modules/hibernate5/pom.xml
@@ -60,7 +60,7 @@
org.hibernate
hibernate-testing
- 5.2.2.Final
+ ${hibernate.version}
com.fasterxml.jackson.core
@@ -70,7 +70,7 @@
net.bytebuddy
byte-buddy
- 1.9.5
+ ${byte-buddy.version}
@@ -91,7 +91,7 @@
javax.xml.bind
jaxb-api
- 2.3.0
+ ${jaxb-api.version}
@@ -120,6 +120,8 @@
3.8.0
1.21
0.9
+ 1.9.5
+ 2.3.0
diff --git a/persistence-modules/java-jpa/pom.xml b/persistence-modules/java-jpa/pom.xml
index 51cc401332..ced049d281 100644
--- a/persistence-modules/java-jpa/pom.xml
+++ b/persistence-modules/java-jpa/pom.xml
@@ -34,7 +34,7 @@
javax.persistence
javax.persistence-api
- 2.2
+ ${javax.persistence-api.version}
@@ -104,10 +104,12 @@
+
5.4.0.Final
2.7.4-RC1
42.2.5
+ 2.2
\ No newline at end of file
diff --git a/persistence-modules/java-mongodb/pom.xml b/persistence-modules/java-mongodb/pom.xml
index 0f5efedb96..dc4503c95e 100644
--- a/persistence-modules/java-mongodb/pom.xml
+++ b/persistence-modules/java-mongodb/pom.xml
@@ -22,8 +22,6 @@
${flapdoodle.version}
test
-
-
org.mongodb
mongo-java-driver
diff --git a/persistence-modules/jpa-hibernate-cascade-type/pom.xml b/persistence-modules/jpa-hibernate-cascade-type/pom.xml
index 8cfc2a5fa2..a45f297a6b 100644
--- a/persistence-modules/jpa-hibernate-cascade-type/pom.xml
+++ b/persistence-modules/jpa-hibernate-cascade-type/pom.xml
@@ -2,6 +2,10 @@
+ jpa-hibernate-cascade-type
+ 4.0.0
+ 1.0.0-SNAPSHOT
+
com.baeldung
parent-modules
@@ -9,10 +13,6 @@
../../
- jpa-hibernate-cascade-type
- 4.0.0
- 1.0.0-SNAPSHOT
-
org.hibernate
diff --git a/persistence-modules/spring-data-jpa-2/pom.xml b/persistence-modules/spring-data-jpa-2/pom.xml
index fbc19810ef..08be64670b 100644
--- a/persistence-modules/spring-data-jpa-2/pom.xml
+++ b/persistence-modules/spring-data-jpa-2/pom.xml
@@ -29,7 +29,7 @@
net.ttddyy
datasource-proxy
- 1.4.1
+ ${datasource-proxy.version}
@@ -42,4 +42,8 @@
spring-oxm
+
+
+ 1.4.1
+
\ No newline at end of file
diff --git a/persistence-modules/spring-data-jpa/pom.xml b/persistence-modules/spring-data-jpa/pom.xml
index a7788065c9..af92f331d1 100644
--- a/persistence-modules/spring-data-jpa/pom.xml
+++ b/persistence-modules/spring-data-jpa/pom.xml
@@ -37,14 +37,14 @@
org.testcontainers
postgresql
- 1.10.6
+ ${testcontainers.postgresql.version}
test
org.postgresql
postgresql
- 42.2.5
+ ${postgresql.version}
@@ -66,7 +66,7 @@
com.google.guava
guava
- 21.0
+ ${guava.version}
@@ -92,6 +92,9 @@
com.baeldung.boot.Application
+ 1.10.6
+ 42.2.5
+ 21.0
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml
index 7156cdf071..33ad3a5267 100644
--- a/persistence-modules/spring-data-mongodb/pom.xml
+++ b/persistence-modules/spring-data-mongodb/pom.xml
@@ -21,7 +21,7 @@
org.springframework.data
spring-data-releasetrain
- Lovelace-SR3
+ Lovelace-SR9
pom
@@ -95,7 +95,7 @@
- 2.1.2.RELEASE
+ 2.1.9.RELEASE
4.1.4
1.1.3
1.9.2
diff --git a/pom.xml b/pom.xml
index d67622feb7..f24a307d9e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -506,6 +506,7 @@
libraries-primitive
libraries-security
libraries-server
+ libraries-http
linkrest
logging-modules
lombok
@@ -557,6 +558,7 @@
tensorflow-java
spring-boot-flowable
spring-security-kerberos
+ morphia
@@ -790,6 +792,7 @@
tensorflow-java
spring-boot-flowable
spring-security-kerberos
+ morphia
@@ -1185,6 +1188,7 @@
libraries-apache-commons
libraries-security
libraries-server
+ libraries-http
linkrest
logging-modules
lombok
@@ -1552,6 +1556,7 @@
1.6.0
2.21.0
2.5
+ 2.6
1.4
3.0.0
3.1.0
diff --git a/ratpack/README.md b/ratpack/README.md
index 14bc3f6c74..78e2f8ccfc 100644
--- a/ratpack/README.md
+++ b/ratpack/README.md
@@ -6,3 +6,4 @@
- [Ratpack with Hystrix](http://www.baeldung.com/ratpack-hystrix)
- [Ratpack HTTP Client](https://www.baeldung.com/ratpack-http-client)
- [Ratpack with RxJava](https://www.baeldung.com/ratpack-rxjava)
+- [Ratpack with Groovy](https://www.baeldung.com/ratpack-groovy)
diff --git a/software-security/sql-injection-samples/pom.xml b/software-security/sql-injection-samples/pom.xml
index b12b479614..5c3256319e 100644
--- a/software-security/sql-injection-samples/pom.xml
+++ b/software-security/sql-injection-samples/pom.xml
@@ -16,13 +16,10 @@
-
-
org.springframework.boot
spring-boot-starter-jdbc
-
org.apache.derby
derby
@@ -43,18 +40,14 @@
lombok
provided
-
org.springframework.boot
spring-boot-starter-data-jpa
-
org.hibernate
hibernate-jpamodelgen
-
-
org.springframework.boot
spring-boot-devtools
diff --git a/spf4j/spf4j-aspects-app/pom.xml b/spf4j/spf4j-aspects-app/pom.xml
index 9fccec673a..1c707f4d87 100644
--- a/spf4j/spf4j-aspects-app/pom.xml
+++ b/spf4j/spf4j-aspects-app/pom.xml
@@ -6,12 +6,14 @@
0.0.1-SNAPSHOT
jar
spf4j-aspects-app
+
parent-modules
com.baeldung
1.0.0-SNAPSHOT
../../
+
org.spf4j
@@ -29,6 +31,7 @@
${org.slf4j.version}
+
spf4j-aspects-app
@@ -75,6 +78,7 @@
+
UTF-8
8.6.10
diff --git a/spf4j/spf4j-core-app/pom.xml b/spf4j/spf4j-core-app/pom.xml
index ae346065ef..9f490d9f06 100644
--- a/spf4j/spf4j-core-app/pom.xml
+++ b/spf4j/spf4j-core-app/pom.xml
@@ -6,12 +6,14 @@
0.0.1-SNAPSHOT
jar
spf4j-core-app
+
parent-modules
com.baeldung
1.0.0-SNAPSHOT
../../
+
org.spf4j
@@ -29,6 +31,7 @@
${org.slf4j.version}
+
spf4j-core-app
@@ -75,6 +78,7 @@
+
UTF-8
8.6.10
diff --git a/spring-5-security-cognito/pom.xml b/spring-5-security-cognito/pom.xml
index c7314d6f9f..431c9b8d9c 100644
--- a/spring-5-security-cognito/pom.xml
+++ b/spring-5-security-cognito/pom.xml
@@ -48,7 +48,6 @@
org.springframework.security
spring-security-oauth2-jose
-
org.springframework
spring-test
diff --git a/spring-5-webflux/pom.xml b/spring-5-webflux/pom.xml
index c1f537d2fe..6317723467 100644
--- a/spring-5-webflux/pom.xml
+++ b/spring-5-webflux/pom.xml
@@ -28,11 +28,6 @@
-
- 1.8
- 2.2.0.M3
-
-
org.springframework.boot
@@ -86,6 +81,7 @@
https://repo.spring.io/milestone
+
spring-snapshots
@@ -101,4 +97,9 @@
https://repo.spring.io/milestone
+
+
+ 1.8
+ 2.2.0.M3
+
diff --git a/spring-apache-camel/.gitignore b/spring-apache-camel/.gitignore
new file mode 100644
index 0000000000..eac473ac50
--- /dev/null
+++ b/spring-apache-camel/.gitignore
@@ -0,0 +1 @@
+/src/test/destination-folder/*
\ No newline at end of file
diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt b/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt b/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/spring-batch/.gitignore b/spring-batch/.gitignore
new file mode 100644
index 0000000000..0ef6d10b38
--- /dev/null
+++ b/spring-batch/.gitignore
@@ -0,0 +1 @@
+output.csv
\ No newline at end of file
diff --git a/spring-boot-angular/pom.xml b/spring-boot-angular/pom.xml
index 6ea98eb3d0..62a2701dd0 100644
--- a/spring-boot-angular/pom.xml
+++ b/spring-boot-angular/pom.xml
@@ -6,15 +6,13 @@
spring-boot-angular
1.0
jar
+
parent-boot-2
com.baeldung
0.0.1-SNAPSHOT
../../parent-boot-2
-
- 1.8
-
@@ -47,4 +45,7 @@
+
+ 1.8
+
diff --git a/spring-boot-autoconfiguration/README.MD b/spring-boot-autoconfiguration/README.MD
index a71af54dff..dc9cad539a 100644
--- a/spring-boot-autoconfiguration/README.MD
+++ b/spring-boot-autoconfiguration/README.MD
@@ -3,4 +3,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
-- [Create a Custom Auto-Configuration with Spring Boot](http://www.baeldung.com/spring-boot-custom-auto-configuration)
\ No newline at end of file
+- [Create a Custom Auto-Configuration with Spring Boot](http://www.baeldung.com/spring-boot-custom-auto-configuration)
+- [Guide to ApplicationContextRunner in Spring Boot](https://www.baeldung.com/spring-boot-context-runner)
diff --git a/spring-boot-data/pom.xml b/spring-boot-data/pom.xml
index 8735a54e7b..9c11e09f4a 100644
--- a/spring-boot-data/pom.xml
+++ b/spring-boot-data/pom.xml
@@ -15,6 +15,30 @@
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+ 2.1.6.RELEASE
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-mongodb
+ 2.1.6.RELEASE
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+ 2.1.6.RELEASE
+
+
+
+ com.h2database
+ h2
+ 1.4.197
+
+
org.springframework.boot
spring-boot-starter-web
diff --git a/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataJPA.java b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataJPA.java
new file mode 100644
index 0000000000..8e4ee76a25
--- /dev/null
+++ b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataJPA.java
@@ -0,0 +1,16 @@
+package com.baeldung.disableautoconfig;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
+
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
+ DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
+public class SpringDataJPA {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringDataJPA.class, args);
+ }
+}
diff --git a/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java
new file mode 100644
index 0000000000..865c137a8d
--- /dev/null
+++ b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java
@@ -0,0 +1,14 @@
+package com.baeldung.disableautoconfig;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
+import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
+
+@SpringBootApplication(exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})
+public class SpringDataMongoDB {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringDataMongoDB.class, args);
+ }
+}
diff --git a/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataRedis.java b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataRedis.java
new file mode 100644
index 0000000000..9ec831c446
--- /dev/null
+++ b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataRedis.java
@@ -0,0 +1,14 @@
+package com.baeldung.disableautoconfig;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
+
+@SpringBootApplication(exclude = {RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class})
+public class SpringDataRedis {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringDataRedis.class, args);
+ }
+}
diff --git a/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataJPAIntegrationTest.java b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataJPAIntegrationTest.java
new file mode 100644
index 0000000000..a465979b3c
--- /dev/null
+++ b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataJPAIntegrationTest.java
@@ -0,0 +1,26 @@
+package com.baeldung.disableautoconfig;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.sql.DataSource;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringDataJPA.class)
+public class SpringDataJPAIntegrationTest {
+
+ @Autowired
+ private ApplicationContext context;
+
+ @Test(expected = NoSuchBeanDefinitionException.class)
+ public void givenAutoconfigurationIsDisable_whenApplicationStarts_thenContextWillNotHaveTheAutoconfiguredClasses() {
+ context.getBean(DataSource.class);
+ }
+
+}
diff --git a/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataMongoDBIntegrationTest.java b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataMongoDBIntegrationTest.java
new file mode 100644
index 0000000000..bdfadf76ce
--- /dev/null
+++ b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataMongoDBIntegrationTest.java
@@ -0,0 +1,25 @@
+package com.baeldung.disableautoconfig;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringDataMongoDB.class)
+public class SpringDataMongoDBIntegrationTest {
+
+ @Autowired
+ private ApplicationContext context;
+
+ @Test(expected = NoSuchBeanDefinitionException.class)
+ public void givenAutoconfigurationIsDisable_whenApplicationStarts_thenContextWillNotHaveTheAutoconfiguredClasses() {
+ context.getBean(MongoTemplate.class);
+ }
+
+}
diff --git a/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataRedisIntegrationTest.java b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataRedisIntegrationTest.java
new file mode 100644
index 0000000000..10133cace3
--- /dev/null
+++ b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataRedisIntegrationTest.java
@@ -0,0 +1,25 @@
+package com.baeldung.disableautoconfig;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringDataRedis.class)
+public class SpringDataRedisIntegrationTest {
+
+ @Autowired
+ private ApplicationContext context;
+
+ @Test(expected = NoSuchBeanDefinitionException.class)
+ public void givenAutoconfigurationIsDisable_whenApplicationStarts_thenContextWillNotHaveTheAutoconfiguredClasses() {
+ context.getBean(RedisTemplate.class);
+ }
+
+}
diff --git a/spring-boot-flowable/pom.xml b/spring-boot-flowable/pom.xml
index f9531a1e6a..f7fc943389 100644
--- a/spring-boot-flowable/pom.xml
+++ b/spring-boot-flowable/pom.xml
@@ -7,12 +7,14 @@
war
spring-boot-flowable
Spring Boot Flowable Module
+
parent-boot-2
com.baeldung
0.0.1-SNAPSHOT
../parent-boot-2
+
org.springframework.boot
@@ -44,6 +46,7 @@
test
+
@@ -52,6 +55,7 @@
+
6.4.1
diff --git a/spring-boot-mvc-birt/pom.xml b/spring-boot-mvc-birt/pom.xml
index 8f41e8410a..6feb2a7611 100644
--- a/spring-boot-mvc-birt/pom.xml
+++ b/spring-boot-mvc-birt/pom.xml
@@ -9,6 +9,7 @@
0.0.1-SNAPSHOT
jar
Module For Spring Boot Integration with BIRT
+
org.springframework.boot
spring-boot-starter-parent
diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml
index e17c1d39b9..fee725847f 100644
--- a/spring-boot-mvc/pom.xml
+++ b/spring-boot-mvc/pom.xml
@@ -40,7 +40,7 @@
org.glassfish
javax.faces
- 2.3.7
+ ${javax.faces.version}
@@ -108,6 +108,7 @@
2.9.2
1.10.0
+ 2.3.7
com.baeldung.springbootmvc.SpringBootMvcApplication
diff --git a/spring-boot-ops-2/pom.xml b/spring-boot-ops-2/pom.xml
index dc5280df48..74fcd79169 100644
--- a/spring-boot-ops-2/pom.xml
+++ b/spring-boot-ops-2/pom.xml
@@ -3,6 +3,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
+ com.baeldung
+ spring-boot-ops-2
+ 0.0.1-SNAPSHOT
+ spring-boot-ops-2
parent-boot-2
@@ -11,11 +15,6 @@
../parent-boot-2
- com.baeldung
- spring-boot-ops-2
- 0.0.1-SNAPSHOT
- spring-boot-ops-2
-
org.springframework.boot
diff --git a/spring-boot-parent/README.md b/spring-boot-parent/README.md
new file mode 100644
index 0000000000..c3bb4c700d
--- /dev/null
+++ b/spring-boot-parent/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles
+
+- [The Spring Boot Starter Parent](https://www.baeldung.com/spring-boot-starter-parent)
diff --git a/spring-boot-performance/README.md b/spring-boot-performance/README.md
new file mode 100644
index 0000000000..015dd759a8
--- /dev/null
+++ b/spring-boot-performance/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles
+
+- [Lazy Initialization in Spring Boot 2](https://www.baeldung.com/spring-boot-lazy-initialization)
diff --git a/spring-boot-performance/pom.xml b/spring-boot-performance/pom.xml
index bbee7493cc..f51df8bc0c 100644
--- a/spring-boot-performance/pom.xml
+++ b/spring-boot-performance/pom.xml
@@ -14,11 +14,6 @@
../parent-boot-performance
-
-
- com.baeldung.lazyinitialization.Application
-
-
org.springframework.boot
@@ -42,4 +37,9 @@
+
+
+
+ com.baeldung.lazyinitialization.Application
+
\ No newline at end of file
diff --git a/spring-boot/README.MD b/spring-boot/README.MD
index d7af3f4614..435398904f 100644
--- a/spring-boot/README.MD
+++ b/spring-boot/README.MD
@@ -37,3 +37,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Validation in Spring Boot](https://www.baeldung.com/spring-boot-bean-validation)
- [Guide to Creating and Running a Jar File in Java](https://www.baeldung.com/java-create-jar)
- [Entity To DTO Conversion for a Spring REST API](https://www.baeldung.com/entity-to-and-from-dto-for-a-java-spring-application)
+- [Guide to @EnableConfigurationProperties](https://www.baeldung.com/spring-enable-config-properties)
diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..818e313c98
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package com.baeldung.spring.cloud.archaius.basic;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-aws/.attach_pid23938 b/spring-cloud/spring-cloud-aws/.attach_pid23938
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
index 4f9c60a26a..6cbaa5ac2d 100644
--- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
@@ -97,6 +97,7 @@
+
Dalston.RELEASE
diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..dc635cd003
--- /dev/null
+++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package com.baeldung.spring.cloud.bootstrap.gateway;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml
index c55f9bc471..14b0d2f9b1 100644
--- a/spring-cloud/spring-cloud-config/client/pom.xml
+++ b/spring-cloud/spring-cloud-config/client/pom.xml
@@ -20,8 +20,7 @@
org.springframework.boot
spring-boot-starter-web
-
-
+
org.springframework.boot
spring-boot-starter-test
diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml
index b4be7663e2..674749a48d 100644
--- a/spring-cloud/spring-cloud-config/server/pom.xml
+++ b/spring-cloud/spring-cloud-config/server/pom.xml
@@ -24,8 +24,7 @@
org.springframework.boot
spring-boot-starter-web
-
-
+
org.springframework.boot
spring-boot-starter-test
diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml
index dffbd29206..7a0fa7db10 100644
--- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml
+++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml
@@ -31,6 +31,7 @@
spring-boot-starter-data-rest
+
diff --git a/spring-cloud/spring-cloud-eureka/pom.xml b/spring-cloud/spring-cloud-eureka/pom.xml
index e8e3d67805..5afb006d41 100644
--- a/spring-cloud/spring-cloud-eureka/pom.xml
+++ b/spring-cloud/spring-cloud-eureka/pom.xml
@@ -9,18 +9,18 @@
Spring Cloud Eureka Server and Sample Clients
pom
-
- spring-cloud-eureka-server
- spring-cloud-eureka-client
- spring-cloud-eureka-feign-client
-
-
com.baeldung.spring.cloud
spring-cloud
1.0.0-SNAPSHOT
..
+
+
+ spring-cloud-eureka-server
+ spring-cloud-eureka-client
+ spring-cloud-eureka-feign-client
+
diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml
index 7a44e4ae0f..82147cea28 100644
--- a/spring-cloud/spring-cloud-functions/pom.xml
+++ b/spring-cloud/spring-cloud-functions/pom.xml
@@ -29,7 +29,7 @@
org.springframework.cloud
spring-cloud-starter-function-web
- 1.0.1.RELEASE
+ ${spring-cloud-function.version}
com.amazonaws
@@ -40,7 +40,7 @@
com.amazonaws
aws-lambda-java-core
- 1.1.0
+ ${aws-lambda-java-core.version}
provided
@@ -87,6 +87,7 @@
UTF-8
1.0.1.RELEASE
2.0.2
+ 1.1.0
2.0.4.RELEASE
diff --git a/spring-cloud/spring-cloud-openfeign/pom.xml b/spring-cloud/spring-cloud-openfeign/pom.xml
index 002a333749..92de33572b 100644
--- a/spring-cloud/spring-cloud-openfeign/pom.xml
+++ b/spring-cloud/spring-cloud-openfeign/pom.xml
@@ -9,7 +9,6 @@
openfeign
OpenFeign project for Spring Boot
-
parent-boot-2
com.baeldung
@@ -17,12 +16,6 @@
../../parent-boot-2
-
- 2.0.1.RELEASE
- Finchley.SR2
-
-
-
org.springframework.cloud
@@ -58,4 +51,9 @@
+
+ 2.0.1.RELEASE
+ Finchley.SR2
+
+
diff --git a/spring-cloud/spring-cloud-security/auth-client/pom.xml b/spring-cloud/spring-cloud-security/auth-client/pom.xml
index 4152552640..c414e584e5 100644
--- a/spring-cloud/spring-cloud-security/auth-client/pom.xml
+++ b/spring-cloud/spring-cloud-security/auth-client/pom.xml
@@ -13,6 +13,18 @@
1.0.0-SNAPSHOT
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
org.springframework.boot
@@ -78,18 +90,6 @@
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
2.2.0
Greenwich.SR1
diff --git a/spring-core-2/pom.xml b/spring-core-2/pom.xml
index 8e4c539e3b..bb4ca9701b 100644
--- a/spring-core-2/pom.xml
+++ b/spring-core-2/pom.xml
@@ -2,15 +2,15 @@
+ 4.0.0
+ spring-core-2
+
com.baeldung
parent-spring-5
0.0.1-SNAPSHOT
../parent-spring-5
- 4.0.0
-
- spring-core-2
diff --git a/spring-kafka/pom.xml b/spring-kafka/pom.xml
index 2fb4c776fe..3d08aaa928 100644
--- a/spring-kafka/pom.xml
+++ b/spring-kafka/pom.xml
@@ -33,7 +33,7 @@
- 2.2.2.RELEASE
+ 2.2.7.RELEASE
\ No newline at end of file
diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml
index 853d8db64c..e5dd5ad9e1 100644
--- a/spring-mvc-java/pom.xml
+++ b/spring-mvc-java/pom.xml
@@ -15,8 +15,8 @@
-
- org.springframework
+
+ org.springframework
spring-webmvc
${spring.version}
@@ -34,7 +34,6 @@
javax.servlet
jstl
${jstl.version}
-
@@ -134,17 +133,17 @@
gson
2.8.5
-
- org.springframework
- spring-websocket
- ${spring.version}
-
+
+ org.springframework
+ spring-websocket
+ ${spring.version}
+
-
- org.springframework
- spring-messaging
- ${spring.version}
-
+
+ org.springframework
+ spring-messaging
+ ${spring.version}
+
diff --git a/spring-mvc-kotlin/.gitignore b/spring-mvc-kotlin/.gitignore
new file mode 100644
index 0000000000..416395ffea
--- /dev/null
+++ b/spring-mvc-kotlin/.gitignore
@@ -0,0 +1 @@
+transaction.log
\ No newline at end of file
diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml
index 46af321d1b..c978bdd983 100644
--- a/spring-mvc-xml/pom.xml
+++ b/spring-mvc-xml/pom.xml
@@ -82,7 +82,7 @@
org.glassfish
javax.el
- 3.0.1-b08
+ ${javax.el.version}
@@ -131,12 +131,11 @@
6.0.10.Final
1.2
3.1.0
- 2.9.6
+ 3.0.1-b08
19.0
3.5
- 2.5
2.8.0
diff --git a/spring-rest-simple/README.md b/spring-rest-simple/README.md
index 882d0ac301..c01f27bd98 100644
--- a/spring-rest-simple/README.md
+++ b/spring-rest-simple/README.md
@@ -5,3 +5,4 @@
- [Spring RequestMapping](http://www.baeldung.com/spring-requestmapping)
- [Spring and Apache FileUpload](http://www.baeldung.com/spring-apache-file-upload)
- [Test a REST API with curl](http://www.baeldung.com/curl-rest)
+- [CORS with Spring](https://www.baeldung.com/spring-cors)
diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/Account.java b/spring-rest-simple/src/main/java/com/baeldung/cors/Account.java
new file mode 100644
index 0000000000..dc6a541a46
--- /dev/null
+++ b/spring-rest-simple/src/main/java/com/baeldung/cors/Account.java
@@ -0,0 +1,9 @@
+package com.baeldung.cors;
+
+public class Account {
+ private Long id;
+
+ public Account(Long id) {
+ this.id = id;
+ }
+}
diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java b/spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java
new file mode 100644
index 0000000000..c387eb2121
--- /dev/null
+++ b/spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java
@@ -0,0 +1,24 @@
+package com.baeldung.cors;
+
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+@CrossOrigin(maxAge = 3600)
+@RestController
+@RequestMapping("/account")
+public class AccountController {
+
+ @CrossOrigin("http://example.com")
+ @RequestMapping("/{id}")
+ public Account retrieve(@PathVariable Long id) {
+ return new Account(id);
+ }
+
+ @RequestMapping(method = RequestMethod.DELETE, path = "/{id}")
+ public void remove(@PathVariable Long id) {
+ // ...
+ }
+}
\ No newline at end of file
diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/WebConfig.java b/spring-rest-simple/src/main/java/com/baeldung/cors/WebConfig.java
new file mode 100644
index 0000000000..dc579ce4ba
--- /dev/null
+++ b/spring-rest-simple/src/main/java/com/baeldung/cors/WebConfig.java
@@ -0,0 +1,16 @@
+package com.baeldung.cors;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+@EnableWebMvc
+public class WebConfig implements WebMvcConfigurer {
+
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**");
+ }
+}
\ No newline at end of file
diff --git a/spring-rest-simple/src/main/webapp/WEB-INF/spring-web-config.xml b/spring-rest-simple/src/main/webapp/WEB-INF/spring-web-config.xml
new file mode 100644
index 0000000000..07d50ae1d6
--- /dev/null
+++ b/spring-rest-simple/src/main/webapp/WEB-INF/spring-web-config.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-rest/README.md b/spring-rest/README.md
index 5d7894cdf8..54b47604d4 100644
--- a/spring-rest/README.md
+++ b/spring-rest/README.md
@@ -6,7 +6,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
- [Spring @RequestMapping](http://www.baeldung.com/spring-requestmapping)
- [Returning Custom Status Codes from Spring Controllers](http://www.baeldung.com/spring-mvc-controller-custom-http-status-code)
-- [A Guide to OkHttp](http://www.baeldung.com/guide-to-okhttp)
- [Binary Data Formats in a Spring REST API](http://www.baeldung.com/spring-rest-api-with-binary-data-formats)
- [Guide to UriComponentsBuilder in Spring](http://www.baeldung.com/spring-uricomponentsbuilder)
- [Introduction to FindBugs](http://www.baeldung.com/intro-to-findbugs)
diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml
index 36934af101..99bdd7646d 100644
--- a/spring-rest/pom.xml
+++ b/spring-rest/pom.xml
@@ -93,13 +93,6 @@
commons-lang3
-
-
- com.squareup.okhttp3
- okhttp
- ${com.squareup.okhttp3.version}
-
-
org.hamcrest
@@ -280,8 +273,6 @@
3.0.4
3.0.0
false
-
- 3.4.1
2.2.0
3.5.11
diff --git a/spring-resttemplate/README.md b/spring-resttemplate/README.md
index c2c4965231..97a89ff7aa 100644
--- a/spring-resttemplate/README.md
+++ b/spring-resttemplate/README.md
@@ -10,3 +10,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Configure a RestTemplate with RestTemplateBuilder](http://www.baeldung.com/spring-rest-template-builder)
- [Mocking a RestTemplate in Spring](https://www.baeldung.com/spring-mock-rest-template)
- [RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json)
+- [Download a Large File Through a Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-download-large-file)
diff --git a/spring-security-kerberos/pom.xml b/spring-security-kerberos/pom.xml
index 35c4ba4926..d98d0ff508 100644
--- a/spring-security-kerberos/pom.xml
+++ b/spring-security-kerberos/pom.xml
@@ -7,12 +7,14 @@
0.1-SNAPSHOT
spring-security-kerberos
war
+
parent-boot-1
com.baeldung
0.0.1-SNAPSHOT
../parent-boot-1
+
org.springframework.boot
@@ -50,6 +52,7 @@
test
+
diff --git a/spring-security-mvc-session/pom.xml b/spring-security-mvc-session/pom.xml
index c0e1527a24..276f651436 100644
--- a/spring-security-mvc-session/pom.xml
+++ b/spring-security-mvc-session/pom.xml
@@ -8,10 +8,10 @@
war
- com.baeldung
- parent-spring-4
- 0.0.1-SNAPSHOT
- ../parent-spring-4
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
@@ -19,74 +19,26 @@
- org.springframework.security
- spring-security-web
- ${org.springframework.security.version}
-
-
- org.springframework.security
- spring-security-config
- ${org.springframework.security.version}
+ org.springframework.boot
+ spring-boot-starter-security
org.springframework.security
spring-security-taglibs
- ${org.springframework.security.version}
-
- org.springframework
- spring-core
- ${spring.version}
-
-
- commons-logging
- commons-logging
-
-
+ org.springframework.boot
+ spring-boot-starter-web
- org.springframework
- spring-context
- ${spring.version}
+ org.apache.tomcat.embed
+ tomcat-embed-jasper
- org.springframework
- spring-jdbc
- ${spring.version}
-
-
- org.springframework
- spring-beans
- ${spring.version}
-
-
- org.springframework
- spring-aop
- ${spring.version}
-
-
- org.springframework
- spring-tx
- ${spring.version}
-
-
- org.springframework
- spring-expression
- ${spring.version}
-
-
-
- org.springframework
- spring-web
- ${spring.version}
-
-
- org.springframework
- spring-webmvc
- ${spring.version}
+ org.springframework.boot
+ spring-boot-starter-tomcat
@@ -94,14 +46,12 @@
javax.servlet
javax.servlet-api
- ${javax.servlet-api.version}
provided
javax.servlet
jstl
- ${jstl.version}
runtime
@@ -117,7 +67,6 @@
org.springframework.boot
spring-boot-starter-test
- 1.5.10.RELEASE
test
@@ -166,9 +115,6 @@
-
- 4.2.6.RELEASE
-
3.0.2
diff --git a/spring-security-mvc-session/src/main/java/org/baeldung/SpringSessionApplication.java b/spring-security-mvc-session/src/main/java/org/baeldung/SpringSessionApplication.java
new file mode 100644
index 0000000000..9e52f0430a
--- /dev/null
+++ b/spring-security-mvc-session/src/main/java/org/baeldung/SpringSessionApplication.java
@@ -0,0 +1,12 @@
+package org.baeldung;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SpringSessionApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringSessionApplication.class, args);
+ }
+}
diff --git a/spring-security-mvc-session/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-mvc-session/src/main/java/org/baeldung/spring/MvcConfig.java
index 9e9c240181..b9f50ded73 100644
--- a/spring-security-mvc-session/src/main/java/org/baeldung/spring/MvcConfig.java
+++ b/spring-security-mvc-session/src/main/java/org/baeldung/spring/MvcConfig.java
@@ -5,13 +5,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
@EnableWebMvc
@Configuration
-public class MvcConfig extends WebMvcConfigurerAdapter {
+public class MvcConfig implements WebMvcConfigurer {
public MvcConfig() {
super();
@@ -21,7 +21,6 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
- super.addViewControllers(registry);
registry.addViewController("/anonymous.html");
diff --git a/spring-security-mvc-session/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-mvc-session/src/main/java/org/baeldung/spring/SecSecurityConfig.java
index deeea78e4e..b7996ebf18 100644
--- a/spring-security-mvc-session/src/main/java/org/baeldung/spring/SecSecurityConfig.java
+++ b/spring-security-mvc-session/src/main/java/org/baeldung/spring/SecSecurityConfig.java
@@ -8,6 +8,8 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.session.HttpSessionEventPublisher;
@@ -24,9 +26,9 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth.inMemoryAuthentication()
- .withUser("user1").password("user1Pass").roles("USER")
+ .withUser("user1").password(passwordEncoder().encode("user1Pass")).roles("USER")
.and()
- .withUser("admin1").password("admin1Pass").roles("ADMIN");
+ .withUser("admin1").password(passwordEncoder().encode("admin1Pass")).roles("ADMIN");
// @formatter:on
}
@@ -68,5 +70,10 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
public HttpSessionEventPublisher httpSessionEventPublisher() {
return new HttpSessionEventPublisher();
}
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+ return new BCryptPasswordEncoder();
+ }
}
diff --git a/spring-security-mvc-session/src/main/resources/webSecurityConfig.xml b/spring-security-mvc-session/src/main/resources/webSecurityConfig.xml
index e8aa2f76bc..42ff4c2186 100644
--- a/spring-security-mvc-session/src/main/resources/webSecurityConfig.xml
+++ b/spring-security-mvc-session/src/main/resources/webSecurityConfig.xml
@@ -2,9 +2,9 @@
diff --git a/spring-session/README.md b/spring-session/README.md
index 505d043e75..c9875beadf 100644
--- a/spring-session/README.md
+++ b/spring-session/README.md
@@ -5,3 +5,4 @@
### Relevant Articles:
- [Guide to Spring Session](https://www.baeldung.com/spring-session)
- [Spring Session with JDBC](https://www.baeldung.com/spring-session-jdbc)
+- [Spring Session with MongoDB](https://www.baeldung.com/spring-session-mongodb)
diff --git a/spring-session/spring-session-mongodb/pom.xml b/spring-session/spring-session-mongodb/pom.xml
index 16fbaccc84..dc055ff32d 100644
--- a/spring-session/spring-session-mongodb/pom.xml
+++ b/spring-session/spring-session-mongodb/pom.xml
@@ -42,11 +42,6 @@
-
- 2.1.3.RELEASE
- 2.1.5.RELEASE
-
-
@@ -56,4 +51,9 @@
+
+ 2.1.3.RELEASE
+ 2.1.5.RELEASE
+
+
\ No newline at end of file
diff --git a/spring-soap/pom.xml b/spring-soap/pom.xml
index ba05eddf5d..16f19b681f 100644
--- a/spring-soap/pom.xml
+++ b/spring-soap/pom.xml
@@ -13,11 +13,6 @@
../parent-boot-2
-
- 1.8
- 2.1.2.RELEASE
-
-
@@ -66,4 +61,9 @@
+
+ 1.8
+ 2.1.2.RELEASE
+
+
diff --git a/spring-static-resources/README.md b/spring-static-resources/README.md
index c12e0272d4..64f017b5dd 100644
--- a/spring-static-resources/README.md
+++ b/spring-static-resources/README.md
@@ -2,3 +2,4 @@
- [Cachable Static Assets with Spring MVC](http://www.baeldung.com/cachable-static-assets-with-spring-mvc)
- [Minification of JS and CSS Assets with Maven](http://www.baeldung.com/maven-minification-of-js-and-css-assets)
- [Serve Static Resources with Spring](http://www.baeldung.com/spring-mvc-static-resources)
+- [Load a Resource as a String in Spring](https://www.baeldung.com/spring-load-resource-as-string)
diff --git a/spring-thymeleaf-2/pom.xml b/spring-thymeleaf-2/pom.xml
index bc1147cb14..1b95cac43c 100644
--- a/spring-thymeleaf-2/pom.xml
+++ b/spring-thymeleaf-2/pom.xml
@@ -23,11 +23,6 @@
-
- 1.8
- 1.8
-
-
@@ -37,4 +32,9 @@
spring-thymeleaf-2
+
+
+ 1.8
+ 1.8
+
diff --git a/spring-userservice/.gitignore b/spring-userservice/.gitignore
new file mode 100644
index 0000000000..afe61e7c0c
--- /dev/null
+++ b/spring-userservice/.gitignore
@@ -0,0 +1 @@
+derby.log
\ No newline at end of file
diff --git a/testing-modules/easymock/pom.xml b/testing-modules/easymock/pom.xml
new file mode 100644
index 0000000000..2b16dd3a1f
--- /dev/null
+++ b/testing-modules/easymock/pom.xml
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ testing-modules
+ 1.0.0-SNAPSHOT
+
+ easymock
+ easymock
+ http://maven.apache.org
+
+ UTF-8
+
+
+
+ org.easymock
+ easymock
+ 4.0.2
+ test
+
+
+
diff --git a/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ForecastProcessor.java b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ForecastProcessor.java
new file mode 100644
index 0000000000..482e985e5b
--- /dev/null
+++ b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ForecastProcessor.java
@@ -0,0 +1,28 @@
+package com.baeldung.testing.easymock;
+
+import java.math.BigDecimal;
+
+public class ForecastProcessor {
+ private WeatherService weatherService;
+
+ public BigDecimal getMaximumTemperature(String locationName) {
+
+ Location location = new Location(locationName);
+
+ try {
+ weatherService.populateTemperature(location);
+ } catch (ServiceUnavailableException e) {
+ return null;
+ }
+
+ return location.getMaximumTemparature();
+ }
+
+ public WeatherService getWeatherService() {
+ return weatherService;
+ }
+
+ public void setWeatherService(WeatherService weatherService) {
+ this.weatherService = weatherService;
+ }
+}
diff --git a/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/Location.java b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/Location.java
new file mode 100644
index 0000000000..5f318acd5c
--- /dev/null
+++ b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/Location.java
@@ -0,0 +1,33 @@
+package com.baeldung.testing.easymock;
+
+import java.math.BigDecimal;
+
+public class Location {
+ private String name;
+ private BigDecimal minimumTemperature;
+ private BigDecimal maximumTemparature;
+
+ public Location(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public BigDecimal getMinimumTemperature() {
+ return minimumTemperature;
+ }
+
+ public void setMinimumTemperature(BigDecimal minimumTemperature) {
+ this.minimumTemperature = minimumTemperature;
+ }
+
+ public BigDecimal getMaximumTemparature() {
+ return maximumTemparature;
+ }
+
+ public void setMaximumTemparature(BigDecimal maximumTemparature) {
+ this.maximumTemparature = maximumTemparature;
+ }
+}
diff --git a/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ServiceUnavailableException.java b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ServiceUnavailableException.java
new file mode 100644
index 0000000000..abab4bdee8
--- /dev/null
+++ b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ServiceUnavailableException.java
@@ -0,0 +1,7 @@
+package com.baeldung.testing.easymock;
+
+public class ServiceUnavailableException extends Exception {
+
+ private static final long serialVersionUID = 6961151537340723535L;
+
+}
diff --git a/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/WeatherService.java b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/WeatherService.java
new file mode 100644
index 0000000000..1c6b11b17b
--- /dev/null
+++ b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/WeatherService.java
@@ -0,0 +1,5 @@
+package com.baeldung.testing.easymock;
+
+public interface WeatherService {
+ void populateTemperature(Location location) throws ServiceUnavailableException;
+}
diff --git a/testing-modules/easymock/src/test/java/com/baeldung/testing/easymock/ForecastProcessorUnitTest.java b/testing-modules/easymock/src/test/java/com/baeldung/testing/easymock/ForecastProcessorUnitTest.java
new file mode 100644
index 0000000000..fa8fa847ae
--- /dev/null
+++ b/testing-modules/easymock/src/test/java/com/baeldung/testing/easymock/ForecastProcessorUnitTest.java
@@ -0,0 +1,49 @@
+package com.baeldung.testing.easymock;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+import java.math.BigDecimal;
+
+import org.easymock.EasyMock;
+import org.easymock.EasyMockRule;
+import org.easymock.Mock;
+import org.easymock.TestSubject;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class ForecastProcessorUnitTest {
+ private static int MAX_TEMP = 90;
+
+ @Rule
+ public EasyMockRule rule = new EasyMockRule(this);
+
+ @TestSubject
+ private ForecastProcessor forecastProcessor = new ForecastProcessor();
+
+ @Mock
+ private WeatherService mockWeatherService;
+
+ @Before
+ public void setUp() {
+ forecastProcessor.setWeatherService(mockWeatherService);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void givenLocationName_whenWeatherServicePopulatesTemperatures_thenMaxTempReturned() throws ServiceUnavailableException {
+ mockWeatherService.populateTemperature(EasyMock.anyObject(Location.class));
+ EasyMock.expectLastCall()
+ .andAnswer(() -> {
+ Location passedLocation = (Location) EasyMock.getCurrentArguments()[0];
+ passedLocation.setMaximumTemparature(new BigDecimal(MAX_TEMP));
+ passedLocation.setMinimumTemperature(new BigDecimal(MAX_TEMP - 10));
+ return null;
+ });
+ EasyMock.replay(mockWeatherService);
+ BigDecimal maxTemperature = forecastProcessor.getMaximumTemperature("New York");
+ EasyMock.verify(mockWeatherService);
+ assertThat(maxTemperature, equalTo(new BigDecimal(MAX_TEMP)));
+ }
+}
diff --git a/testing-modules/gatling/pom.xml b/testing-modules/gatling/pom.xml
index 158da176c6..e708d939e4 100644
--- a/testing-modules/gatling/pom.xml
+++ b/testing-modules/gatling/pom.xml
@@ -14,6 +14,31 @@
1.0.0-SNAPSHOT
../../
+
+
+
+
+ io.gatling
+ gatling-app
+ ${gatling.version}
+
+
+ io.gatling
+ gatling-recorder
+ ${gatling.version}
+
+
+ io.gatling.highcharts
+ gatling-charts-highcharts
+ ${gatling.version}
+
+
+ org.scala-lang
+ scala-library
+ ${scala.version}
+
+
+
@@ -77,52 +102,27 @@
simulation
-
- io.gatling
- gatling-maven-plugin
- ${gatling-maven-plugin.version}
-
-
- test
-
- execute
-
-
- true
-
-
-
-
-
-
+
+ io.gatling
+ gatling-maven-plugin
+ ${gatling-maven-plugin.version}
+
+
+ test
+
+ execute
+
+
+ true
+
+
+
+
+
+
-
-
-
- io.gatling
- gatling-app
- ${gatling.version}
-
-
- io.gatling
- gatling-recorder
- ${gatling.version}
-
-
- io.gatling.highcharts
- gatling-charts-highcharts
- ${gatling.version}
-
-
- org.scala-lang
- scala-library
- ${scala.version}
-
-
-
-
1.8
1.8
diff --git a/testing-modules/junit-5-basics/README.md b/testing-modules/junit-5-basics/README.md
index 6e44a9c071..c09c030780 100644
--- a/testing-modules/junit-5-basics/README.md
+++ b/testing-modules/junit-5-basics/README.md
@@ -2,3 +2,4 @@
- [Get the Path of the /src/test/resources Directory in JUnit](https://www.baeldung.com/junit-src-test-resources-directory-path)
- [Tagging and Filtering JUnit Tests](https://www.baeldung.com/junit-filtering-tests)
+- [JUnit 5 Temporary Directory Support](https://www.baeldung.com/junit-5-temporary-directory)
diff --git a/testing-modules/mockito/pom.xml b/testing-modules/mockito/pom.xml
index acdd7eb2ac..19dbaa0dc1 100644
--- a/testing-modules/mockito/pom.xml
+++ b/testing-modules/mockito/pom.xml
@@ -33,7 +33,7 @@
org.eclipse.persistence
javax.persistence
- 2.1.1
+ ${javax.persistence.version}
@@ -99,6 +99,7 @@
1.7.0
2.0.0.0
+ 2.1.1
\ No newline at end of file
diff --git a/testing-modules/mocks/mock-comparisons/pom.xml b/testing-modules/mocks/mock-comparisons/pom.xml
index ae36280300..e454f124ce 100644
--- a/testing-modules/mocks/mock-comparisons/pom.xml
+++ b/testing-modules/mocks/mock-comparisons/pom.xml
@@ -49,7 +49,6 @@
2.21.0
3.5.1
1.41
-
diff --git a/testing-modules/pom.xml b/testing-modules/pom.xml
index 95a19c2557..bc6e23a6b7 100644
--- a/testing-modules/pom.xml
+++ b/testing-modules/pom.xml
@@ -33,6 +33,7 @@
testing
testng
junit-5-basics
+ easymock
junit-5-advanced
diff --git a/testing-modules/spring-testing/README.md b/testing-modules/spring-testing/README.md
index 07888d7cdf..0970eabeff 100644
--- a/testing-modules/spring-testing/README.md
+++ b/testing-modules/spring-testing/README.md
@@ -4,4 +4,5 @@
- [A Quick Guide to @TestPropertySource](https://www.baeldung.com/spring-test-property-source)
- [Guide to ReflectionTestUtils for Unit Testing](https://www.baeldung.com/spring-reflection-test-utils)
- [How to Test the @Scheduled Annotation](https://www.baeldung.com/spring-testing-scheduled-annotation)
-- [Override properties in Spring]()
\ No newline at end of file
+- [Using SpringJUnit4ClassRunner with Parameterized](https://www.baeldung.com/springjunit4classrunner-parameterized)
+- [Override properties in Spring]()
diff --git a/testing-modules/spring-testing/pom.xml b/testing-modules/spring-testing/pom.xml
index 0eca9b6a7e..f4d7b5dc66 100644
--- a/testing-modules/spring-testing/pom.xml
+++ b/testing-modules/spring-testing/pom.xml
@@ -51,7 +51,7 @@
org.eclipse.persistence
javax.persistence
- 2.1.1
+ ${javax.persistence.version}
org.springframework.data
@@ -95,6 +95,7 @@
5.4.0
5.1.4.RELEASE
4.0.1
+ 2.1.1
\ No newline at end of file
diff --git a/vaadin/pom.xml b/vaadin/pom.xml
index 648343fcd8..089ebe67c1 100644
--- a/vaadin/pom.xml
+++ b/vaadin/pom.xml
@@ -33,7 +33,26 @@
javax.servlet-api
provided
-
+
+ com.vaadin
+ vaadin-server
+ ${vaadin-server.version}
+
+
+ com.vaadin
+ vaadin-push
+ ${vaadin-push.version}
+
+
+ com.vaadin
+ vaadin-client-compiled
+ ${vaadin-client-compiled.version}
+
+
+ com.vaadin
+ vaadin-themes
+ ${vaadin-themes.version}
+
org.springframework.boot
spring-boot-starter-data-jpa
@@ -155,9 +174,13 @@
- 10.0.11
- 10.0.11
- 10.0.11
+ 13.0.9
+ 13.0.9
+ 13.0.9
+ 8.8.5
+ 8.8.5
+ 8.8.5
+ 8.8.5
9.3.9.v20160517
UTF-8
1.8
diff --git a/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java b/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java
new file mode 100644
index 0000000000..68be53b1b3
--- /dev/null
+++ b/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java
@@ -0,0 +1,278 @@
+package com.baeldung.introduction;
+
+import java.time.Instant;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import javax.servlet.annotation.WebServlet;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.annotations.Theme;
+import com.vaadin.annotations.VaadinServletConfiguration;
+import com.vaadin.data.Binder;
+import com.vaadin.data.validator.StringLengthValidator;
+import com.vaadin.icons.VaadinIcons;
+import com.vaadin.server.ExternalResource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.ListSelect;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.PasswordField;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.TwinColSelect;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+@SuppressWarnings("serial")
+@Push
+@Theme("mytheme")
+public class VaadinUI extends UI {
+
+ private Label currentTime;
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected void init(VaadinRequest vaadinRequest) {
+ final VerticalLayout verticalLayout = new VerticalLayout();
+ verticalLayout.setSpacing(true);
+ verticalLayout.setMargin(true);
+ final GridLayout gridLayout = new GridLayout(3, 2);
+ gridLayout.setSpacing(true);
+ gridLayout.setMargin(true);
+ final HorizontalLayout horizontalLayout = new HorizontalLayout();
+ horizontalLayout.setSpacing(true);
+ horizontalLayout.setMargin(true);
+ final FormLayout formLayout = new FormLayout();
+ formLayout.setSpacing(true);
+ formLayout.setMargin(true);
+ final GridLayout buttonLayout = new GridLayout(3, 5);
+ buttonLayout.setMargin(true);
+ buttonLayout.setSpacing(true);
+
+ final Label label = new Label();
+ label.setId("Label");
+ label.setValue("Label Value");
+ label.setCaption("Label");
+ gridLayout.addComponent(label);
+
+ final Link link = new Link("Baeldung", new ExternalResource("http://www.baeldung.com/"));
+ link.setId("Link");
+ link.setTargetName("_blank");
+ gridLayout.addComponent(link);
+
+ final TextField textField = new TextField();
+ textField.setId("TextField");
+ textField.setCaption("TextField:");
+ textField.setValue("TextField Value");
+ textField.setIcon(VaadinIcons.USER);
+ gridLayout.addComponent(textField);
+
+ final TextArea textArea = new TextArea();
+ textArea.setCaption("TextArea");
+ textArea.setId("TextArea");
+ textArea.setValue("TextArea Value");
+ gridLayout.addComponent(textArea);
+
+ final DateField dateField = new DateField("DateField", LocalDate.ofEpochDay(0));
+ dateField.setId("DateField");
+ gridLayout.addComponent(dateField);
+
+ final PasswordField passwordField = new PasswordField();
+ passwordField.setId("PasswordField");
+ passwordField.setCaption("PasswordField:");
+ passwordField.setValue("password");
+ gridLayout.addComponent(passwordField);
+
+ final RichTextArea richTextArea = new RichTextArea();
+ richTextArea.setCaption("Rich Text Area");
+ richTextArea.setValue("RichTextArea
");
+ richTextArea.setSizeFull();
+
+ Panel richTextPanel = new Panel();
+ richTextPanel.setContent(richTextArea);
+
+ final InlineDateField inlineDateField = new InlineDateField();
+ inlineDateField.setValue(LocalDate.ofEpochDay(0));
+ inlineDateField.setCaption("Inline Date Field");
+ horizontalLayout.addComponent(inlineDateField);
+
+ Button normalButton = new Button("Normal Button");
+ normalButton.setId("NormalButton");
+ normalButton.addClickListener(e -> {
+ label.setValue("CLICK");
+ });
+ buttonLayout.addComponent(normalButton);
+
+ Button tinyButton = new Button("Tiny Button");
+ tinyButton.addStyleName("tiny");
+ buttonLayout.addComponent(tinyButton);
+
+ Button smallButton = new Button("Small Button");
+ smallButton.addStyleName("small");
+ buttonLayout.addComponent(smallButton);
+
+ Button largeButton = new Button("Large Button");
+ largeButton.addStyleName("large");
+ buttonLayout.addComponent(largeButton);
+
+ Button hugeButton = new Button("Huge Button");
+ hugeButton.addStyleName("huge");
+ buttonLayout.addComponent(hugeButton);
+
+ Button disabledButton = new Button("Disabled Button");
+ disabledButton.setDescription("This button cannot be clicked");
+ disabledButton.setEnabled(false);
+ buttonLayout.addComponent(disabledButton);
+
+ Button dangerButton = new Button("Danger Button");
+ dangerButton.addStyleName("danger");
+ buttonLayout.addComponent(dangerButton);
+
+ Button friendlyButton = new Button("Friendly Button");
+ friendlyButton.addStyleName("friendly");
+ buttonLayout.addComponent(friendlyButton);
+
+ Button primaryButton = new Button("Primary Button");
+ primaryButton.addStyleName("primary");
+ buttonLayout.addComponent(primaryButton);
+
+ NativeButton nativeButton = new NativeButton("Native Button");
+ buttonLayout.addComponent(nativeButton);
+
+ Button iconButton = new Button("Icon Button");
+ iconButton.setIcon(VaadinIcons.ALIGN_LEFT);
+ buttonLayout.addComponent(iconButton);
+
+ Button borderlessButton = new Button("BorderLess Button");
+ borderlessButton.addStyleName("borderless");
+ buttonLayout.addComponent(borderlessButton);
+
+ Button linkButton = new Button("Link Button");
+ linkButton.addStyleName("link");
+ buttonLayout.addComponent(linkButton);
+
+ Button quietButton = new Button("Quiet Button");
+ quietButton.addStyleName("quiet");
+ buttonLayout.addComponent(quietButton);
+
+ horizontalLayout.addComponent(buttonLayout);
+
+ final CheckBox checkbox = new CheckBox("CheckBox");
+ checkbox.setValue(true);
+ checkbox.addValueChangeListener(e -> checkbox.setValue(!checkbox.getValue()));
+ formLayout.addComponent(checkbox);
+
+ List numbers = new ArrayList();
+ numbers.add("One");
+ numbers.add("Ten");
+ numbers.add("Eleven");
+ ComboBox comboBox = new ComboBox("ComboBox");
+ comboBox.setItems(numbers);
+ formLayout.addComponent(comboBox);
+
+ ListSelect listSelect = new ListSelect("ListSelect");
+ listSelect.setItems(numbers);
+ listSelect.setRows(2);
+ formLayout.addComponent(listSelect);
+
+ NativeSelect nativeSelect = new NativeSelect("NativeSelect");
+ nativeSelect.setItems(numbers);
+ formLayout.addComponent(nativeSelect);
+
+ TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect");
+ twinColSelect.setItems(numbers);
+
+ Grid grid = new Grid("Grid");
+ grid.setColumns("Column1", "Column2", "Column3");
+ grid.setItems("Item1", "Item2", "Item3");
+ grid.setItems("Item4", "Item5", "Item6");
+
+ Panel panel = new Panel("Panel");
+ panel.setContent(grid);
+ panel.setSizeUndefined();
+
+ Panel serverPushPanel = new Panel("Server Push");
+ FormLayout timeLayout = new FormLayout();
+ timeLayout.setSpacing(true);
+ timeLayout.setMargin(true);
+ currentTime = new Label("No TIME...");
+ timeLayout.addComponent(currentTime);
+ serverPushPanel.setContent(timeLayout);
+ serverPushPanel.setSizeUndefined();
+ ScheduledExecutorService scheduleExecutor = Executors.newScheduledThreadPool(1);
+ Runnable task = () -> {
+ currentTime.setValue("Current Time : " + Instant.now());
+ };
+ scheduleExecutor.scheduleWithFixedDelay(task, 0, 1, TimeUnit.SECONDS);
+
+ FormLayout dataBindingLayout = new FormLayout();
+ dataBindingLayout.setSpacing(true);
+ dataBindingLayout.setMargin(true);
+
+ Binder binder = new Binder<>();
+ BindData bindData = new BindData("BindData");
+ binder.readBean(bindData);
+ TextField bindedTextField = new TextField();
+ bindedTextField.setWidth("250px");
+ binder.forField(bindedTextField).bind(BindData::getBindName, BindData::setBindName);
+ dataBindingLayout.addComponent(bindedTextField);
+
+ FormLayout validatorLayout = new FormLayout();
+ validatorLayout.setSpacing(true);
+ validatorLayout.setMargin(true);
+
+ HorizontalLayout textValidatorLayout = new HorizontalLayout();
+ textValidatorLayout.setSpacing(true);
+ textValidatorLayout.setMargin(true);
+
+
+ BindData stringValidatorBindData = new BindData("");
+ TextField stringValidator = new TextField();
+ Binder stringValidatorBinder = new Binder<>();
+ stringValidatorBinder.setBean(stringValidatorBindData);
+ stringValidatorBinder.forField(stringValidator)
+ .withValidator(new StringLengthValidator("String must have 2-5 characters lenght", 2, 5))
+ .bind(BindData::getBindName, BindData::setBindName);
+
+ textValidatorLayout.addComponent(stringValidator);
+ Button buttonStringValidator = new Button("Validate String");
+ buttonStringValidator.addClickListener(e -> stringValidatorBinder.validate());
+ textValidatorLayout.addComponent(buttonStringValidator);
+
+ validatorLayout.addComponent(textValidatorLayout);
+ verticalLayout.addComponent(gridLayout);
+ verticalLayout.addComponent(richTextPanel);
+ verticalLayout.addComponent(horizontalLayout);
+ verticalLayout.addComponent(formLayout);
+ verticalLayout.addComponent(twinColSelect);
+ verticalLayout.addComponent(panel);
+ verticalLayout.addComponent(serverPushPanel);
+ verticalLayout.addComponent(dataBindingLayout);
+ verticalLayout.addComponent(validatorLayout);
+ setContent(verticalLayout);
+ }
+
+ @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
+ @VaadinServletConfiguration(ui = VaadinUI.class, productionMode = false)
+ public static class MyUIServlet extends VaadinServlet {
+ }
+}
\ No newline at end of file
diff --git a/vertx-and-rxjava/.gitignore b/vertx-and-rxjava/.gitignore
new file mode 100644
index 0000000000..3aba11e2fd
--- /dev/null
+++ b/vertx-and-rxjava/.gitignore
@@ -0,0 +1 @@
+/.vertx
\ No newline at end of file
diff --git a/xml/pom.xml b/xml/pom.xml
index ba6a734dc9..e9b89c71fc 100644
--- a/xml/pom.xml
+++ b/xml/pom.xml
@@ -33,17 +33,17 @@
javax.xml
jaxb-api
- 2.1
+ ${jaxb-api.version}
javax.xml
jaxp-api
- 1.4.2
+ ${jaxp-api.version}
javax.xml.stream
stax-api
- 1.0-2
+ ${stax-api.version}
@@ -252,6 +252,9 @@
2.5
4.1
1.2.4.5
+ 2.1
+ 1.4.2
+ 1.0-2
3.5
diff --git a/xmlunit-2/pom.xml b/xmlunit-2/pom.xml
index faefeca7a1..9e146ccf33 100644
--- a/xmlunit-2/pom.xml
+++ b/xmlunit-2/pom.xml
@@ -23,7 +23,6 @@
xmlunit-core
${xmlunit.version}
-