diff --git a/README.md b/README.md
index 8e0a5eb9ee..f3fe5e3bf0 100644
--- a/README.md
+++ b/README.md
@@ -26,3 +26,13 @@ To do the full build, do: `mvn install -Pdefault -Dgib.enabled=false`
Building a single module
====================
To build a specific module run the command: `mvn clean install -Dgib.enabled=false` in the module directory
+
+
+Running a Spring Boot module
+====================
+To run a Spring Boot module run the command: `mvn spring-boot:run -Dgib.enabled=false` in the module directory
+
+
+
+
+
diff --git a/algorithms/README.md b/algorithms/README.md
index 9d347869bd..b9a37a7bf2 100644
--- a/algorithms/README.md
+++ b/algorithms/README.md
@@ -31,3 +31,6 @@
- [Round Up to the Nearest Hundred](https://www.baeldung.com/java-round-up-nearest-hundred)
- [Merge Sort in Java](https://www.baeldung.com/java-merge-sort)
- [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage)
+- [Quicksort Algorithm Implementation in Java](https://www.baeldung.com/java-quicksort)
+- [Insertion Sort in Java](https://www.baeldung.com/java-insertion-sort)
+- [Converting Between Byte Arrays and Hexadecimal Strings in Java](https://www.baeldung.com/java-byte-arrays-hex-strings)
diff --git a/algorithms/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java b/algorithms/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java
index a561072b2e..275cb7f3a2 100644
--- a/algorithms/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java
+++ b/algorithms/src/main/java/com/baeldung/algorithms/bubblesort/BubbleSort.java
@@ -7,7 +7,7 @@ public class BubbleSort {
void bubbleSort(Integer[] arr) {
int n = arr.length;
IntStream.range(0, n - 1)
- .flatMap(i -> IntStream.range(i + 1, n - i))
+ .flatMap(i -> IntStream.range(1, n - i))
.forEach(j -> {
if (arr[j - 1] > arr[j]) {
int temp = arr[j];
diff --git a/algorithms/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java
index c7f3f7dc38..c3260a18dd 100644
--- a/algorithms/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java
+++ b/algorithms/src/test/java/com/baeldung/algorithms/bubblesort/BubbleSortUnitTest.java
@@ -1,8 +1,8 @@
package com.baeldung.algorithms.bubblesort;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class BubbleSortUnitTest {
diff --git a/apache-geode/README.md b/apache-geode/README.md
new file mode 100644
index 0000000000..2f04418825
--- /dev/null
+++ b/apache-geode/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+
+- [A Quick Guide to Apache Geode](https://www.baeldung.com/apache-geode)
diff --git a/apache-pulsar/.gitignore b/apache-pulsar/.gitignore
new file mode 100755
index 0000000000..1c53e03007
--- /dev/null
+++ b/apache-pulsar/.gitignore
@@ -0,0 +1,8 @@
+.classpath
+.project
+.settings
+target
+.idea
+*.iml
+.gradle/
+build/
diff --git a/apache-pulsar/pom.xml b/apache-pulsar/pom.xml
new file mode 100644
index 0000000000..da004a7638
--- /dev/null
+++ b/apache-pulsar/pom.xml
@@ -0,0 +1,21 @@
+
+
+ 4.0.0
+ com.baeldung.pulsar
+ pulsar-java
+ 0.0.1
+
+
+
+ org.apache.pulsar
+ pulsar-client
+ 2.1.1-incubating
+ compile
+
+
+
+ 1.8
+ 1.8
+
+
diff --git a/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java b/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java
new file mode 100755
index 0000000000..72dc10b542
--- /dev/null
+++ b/apache-pulsar/src/main/java/com/baeldung/ConsumerTest.java
@@ -0,0 +1,48 @@
+package com.baeldung;
+
+import java.io.IOException;
+
+import org.apache.pulsar.client.api.Consumer;
+import org.apache.pulsar.client.api.Message;
+import org.apache.pulsar.client.api.PulsarClient;
+import org.apache.pulsar.client.api.SubscriptionType;
+
+public class ConsumerTest {
+
+ private static final String SERVICE_URL = "pulsar://localhost:6650";
+ private static final String TOPIC_NAME = "test-topic";
+ private static final String SUBSCRIPTION_NAME = "test-subscription";
+
+ public static void main(String[] args) throws IOException {
+ // Create a Pulsar client instance. A single instance can be shared across many
+ // producers and consumer within the same application
+ PulsarClient client = PulsarClient.builder()
+ .serviceUrl(SERVICE_URL)
+ .build();
+
+ //Configure consumer specific settings.
+ Consumer consumer = client.newConsumer()
+ .topic(TOPIC_NAME)
+ // Allow multiple consumers to attach to the same subscription
+ // and get messages dispatched as a queue
+ .subscriptionType(SubscriptionType.Shared)
+ .subscriptionName(SUBSCRIPTION_NAME)
+ .subscribe();
+
+
+ // Once the consumer is created, it can be used for the entire application lifecycle
+ System.out.println("Created consumer for the topic "+ TOPIC_NAME);
+
+ do {
+ // Wait until a message is available
+ Message msg = consumer.receive();
+
+ // Extract the message as a printable string and then log
+ String content = new String(msg.getData());
+ System.out.println("Received message '"+content+"' with ID "+msg.getMessageId());
+
+ // Acknowledge processing of the message so that it can be deleted
+ consumer.acknowledge(msg);
+ } while (true);
+ }
+}
diff --git a/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java b/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java
new file mode 100755
index 0000000000..08ee0e89b9
--- /dev/null
+++ b/apache-pulsar/src/main/java/com/baeldung/ProducerTest.java
@@ -0,0 +1,58 @@
+package com.baeldung;
+
+import org.apache.pulsar.client.api.CompressionType;
+import org.apache.pulsar.client.api.Message;
+import org.apache.pulsar.client.api.MessageBuilder;
+import org.apache.pulsar.client.api.MessageId;
+import org.apache.pulsar.client.api.Producer;
+import org.apache.pulsar.client.api.PulsarClient;
+import org.apache.pulsar.client.api.PulsarClientException;
+
+import java.io.IOException;
+import java.util.stream.IntStream;
+
+public class ProducerTest {
+
+ private static final String SERVICE_URL = "pulsar://localhost:6650";
+ private static final String TOPIC_NAME = "test-topic";
+
+ public static void main(String[] args) throws IOException {
+ // Create a Pulsar client instance. A single instance can be shared across many
+ // producers and consumer within the same application
+ PulsarClient client = PulsarClient.builder()
+ .serviceUrl(SERVICE_URL)
+ .build();
+
+ // Configure producer specific settings
+ Producer producer = client.newProducer()
+ // Set the topic
+ .topic(TOPIC_NAME)
+ // Enable compression
+ .compressionType(CompressionType.LZ4)
+ .create();
+
+ // Once the producer is created, it can be used for the entire application life-cycle
+ System.out.println("Created producer for the topic "+TOPIC_NAME);
+
+ // Send 5 test messages
+ IntStream.range(1, 5).forEach(i -> {
+ String content = String.format("hi-pulsar-%d", i);
+
+ // Build a message object
+ Message msg = MessageBuilder.create()
+ .setContent(content.getBytes())
+ .build();
+
+ // Send each message and log message content and ID when successfully received
+ try {
+ MessageId msgId = producer.send(msg);
+
+ System.out.println("Published message '"+content+"' with the ID "+msgId);
+ } catch (PulsarClientException e) {
+ System.out.println(e.getMessage());
+ }
+ });
+
+ client.close();
+ }
+}
diff --git a/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java b/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java
new file mode 100644
index 0000000000..efb898eaf4
--- /dev/null
+++ b/apache-pulsar/src/main/java/com/baeldung/subscriptions/ExclusiveSubscriptionTest.java
@@ -0,0 +1,59 @@
+package com.baeldung.subscriptions;
+
+import org.apache.pulsar.client.api.ConsumerBuilder;
+import org.apache.pulsar.client.api.Message;
+import org.apache.pulsar.client.api.MessageBuilder;
+import org.apache.pulsar.client.api.Producer;
+import org.apache.pulsar.client.api.PulsarClient;
+import org.apache.pulsar.client.api.PulsarClientException;
+import org.apache.pulsar.client.api.SubscriptionType;
+
+import java.util.stream.IntStream;
+
+public class ExclusiveSubscriptionTest {
+ private static final String SERVICE_URL = "pulsar://localhost:6650";
+ private static final String TOPIC_NAME = "test-topic";
+ private static final String SUBSCRIPTION_NAME = "test-subscription";
+ private static final SubscriptionType SUBSCRIPTION_TYPE = SubscriptionType.Exclusive;
+
+ public static void main(String[] args) throws PulsarClientException {
+ PulsarClient client = PulsarClient.builder()
+ .serviceUrl(SERVICE_URL)
+ .build();
+
+ Producer producer = client.newProducer()
+ .topic(TOPIC_NAME)
+ .create();
+
+ ConsumerBuilder consumer1 = client.newConsumer()
+ .topic(TOPIC_NAME)
+ .subscriptionName(SUBSCRIPTION_NAME)
+ .subscriptionType(SUBSCRIPTION_TYPE);
+
+ ConsumerBuilder consumer2 = client.newConsumer()
+ .topic(TOPIC_NAME)
+ .subscriptionName(SUBSCRIPTION_NAME)
+ .subscriptionType(SUBSCRIPTION_TYPE);
+
+ IntStream.range(0, 999).forEach(i -> {
+ Message msg = MessageBuilder.create()
+ .setContent(String.format("message-%d", i).getBytes())
+ .build();
+ try {
+ producer.send(msg);
+ } catch (PulsarClientException e) {
+ System.out.println(e.getMessage());
+ }
+ });
+
+ // Consumer 1 can subscribe to the topic
+ consumer1.subscribe();
+
+ // Consumer 2 cannot due to the exclusive subscription held by consumer 1
+ consumer2.subscribeAsync()
+ .handle((consumer, exception) -> {
+ System.out.println(exception.getMessage());
+ return null;
+ });
+ }
+}
diff --git a/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java b/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java
new file mode 100644
index 0000000000..545661e0c3
--- /dev/null
+++ b/apache-pulsar/src/main/java/com/baeldung/subscriptions/FailoverSubscriptionTest.java
@@ -0,0 +1,76 @@
+package com.baeldung.subscriptions;
+
+import org.apache.pulsar.client.api.Consumer;
+import org.apache.pulsar.client.api.ConsumerBuilder;
+import org.apache.pulsar.client.api.Message;
+import org.apache.pulsar.client.api.MessageBuilder;
+import org.apache.pulsar.client.api.Producer;
+import org.apache.pulsar.client.api.PulsarClient;
+import org.apache.pulsar.client.api.PulsarClientException;
+import org.apache.pulsar.client.api.SubscriptionType;
+
+import java.util.stream.IntStream;
+
+public class FailoverSubscriptionTest {
+ private static final String SERVICE_URL = "pulsar://localhost:6650";
+ private static final String TOPIC_NAME = "failover-subscription-test-topic";
+ private static final String SUBSCRIPTION_NAME = "test-subscription";
+ private static final SubscriptionType SUBSCRIPTION_TYPE = SubscriptionType.Failover;
+ private static final int NUM_MSGS = 10;
+
+ public static void main(String[] args) throws PulsarClientException {
+ PulsarClient client = PulsarClient.builder()
+ .serviceUrl(SERVICE_URL)
+ .build();
+
+ Producer producer = client.newProducer()
+ .topic(TOPIC_NAME)
+ .create();
+
+ ConsumerBuilder consumerBuilder = client.newConsumer()
+ .topic(TOPIC_NAME)
+ .subscriptionName(SUBSCRIPTION_NAME)
+ .subscriptionType(SUBSCRIPTION_TYPE);
+
+ Consumer mainConsumer = consumerBuilder
+ .consumerName("consumer-a")
+ .messageListener((consumer, msg) -> {
+ System.out.println("Message received by main consumer");
+
+ try {
+ consumer.acknowledge(msg);
+ } catch (PulsarClientException e) {
+ System.out.println(e.getMessage());
+ }
+ })
+ .subscribe();
+
+ Consumer failoverConsumer = consumerBuilder
+ .consumerName("consumer-b")
+ .messageListener((consumer, msg) -> {
+ System.out.println("Message received by failover consumer");
+
+ try {
+ consumer.acknowledge(msg);
+ } catch (PulsarClientException e) {
+ System.out.println(e.getMessage());
+ }
+ })
+ .subscribe();
+
+ IntStream.range(0, NUM_MSGS).forEach(i -> {
+ Message msg = MessageBuilder.create()
+ .setContent(String.format("message-%d", i).getBytes())
+ .build();
+ try {
+ producer.send(msg);
+
+ Thread.sleep(100);
+
+ if (i > 5) mainConsumer.close();
+ } catch (InterruptedException | PulsarClientException e) {
+ System.out.println(e.getMessage());
+ }
+ });
+ }
+}
diff --git a/core-java-collections/README.md b/core-java-collections/README.md
index e366232f74..d0aaaa7182 100644
--- a/core-java-collections/README.md
+++ b/core-java-collections/README.md
@@ -4,37 +4,23 @@
### Relevant Articles:
- [Immutable ArrayList in Java](http://www.baeldung.com/java-immutable-list)
-- [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array)
-- [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array)
-- [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list)
-- [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set)
- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist)
- [Random List Element](http://www.baeldung.com/java-random-list-element)
- [Java - Combine Multiple Collections](http://www.baeldung.com/java-combine-multiple-collections)
-- [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap)
-- [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap)
-- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap)
-- [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap)
-- [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap)
- [Removing all nulls from a List in Java](http://www.baeldung.com/java-remove-nulls-from-list)
- [Removing all duplicates from a List in Java](http://www.baeldung.com/java-remove-duplicates-from-list)
- [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections)
- [HashSet and TreeSet Comparison](http://www.baeldung.com/java-hashset-vs-treeset)
-- [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map)
- [Collect a Java Stream to an Immutable Collection](http://www.baeldung.com/java-stream-immutable-collection)
-- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string)
- [Introduction to the Java ArrayDeque](http://www.baeldung.com/java-array-deque)
- [A Guide to HashSet in Java](http://www.baeldung.com/java-hashset)
- [A Guide to TreeSet in Java](http://www.baeldung.com/java-tree-set)
-- [Java TreeMap vs HashMap](http://www.baeldung.com/java-treemap-vs-hashmap)
- [How to TDD a List Implementation in Java](http://www.baeldung.com/java-test-driven-list)
-- [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys)
- [Getting the Size of an Iterable in Java](http://www.baeldung.com/java-iterable-size)
- [Iterating Backward Through a List](http://www.baeldung.com/java-list-iterate-backwards)
- [How to Filter a Collection in Java](http://www.baeldung.com/java-collection-filtering)
- [Add Multiple Items to an Java ArrayList](http://www.baeldung.com/java-add-items-array-list)
- [Remove the First Element from a List](http://www.baeldung.com/java-remove-first-element-from-list)
-- [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map)
- [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset)
- [Removing the First Element of an Array](https://www.baeldung.com/java-array-remove-first-element)
- [Fail-Safe Iterator vs Fail-Fast Iterator](http://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator)
@@ -47,12 +33,9 @@
- [Remove All Occurrences of a Specific Value from a List](https://www.baeldung.com/java-remove-value-from-list)
- [Thread Safe LIFO Data Structure Implementations](https://www.baeldung.com/java-lifo-thread-safe)
- [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list)
-- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
- [Differences Between Collection.clear() and Collection.removeAll()](https://www.baeldung.com/java-collection-clear-vs-removeall)
- [Performance of contains() in a HashSet vs ArrayList](https://www.baeldung.com/java-hashset-arraylist-contains-performance)
-- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value)
- [Time Complexity of Java Collections](https://www.baeldung.com/java-collections-complexity)
-- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort)
-- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max)
- [Operating on and Removing an Item from Stream](https://www.baeldung.com/java-use-remove-item-stream)
- [An Introduction to Synchronized Java Collections](https://www.baeldung.com/java-synchronized-collections)
+- [Guide to EnumSet](https://www.baeldung.com/java-enumset)
diff --git a/core-java-collections/pom.xml b/core-java-collections/pom.xml
index b4a6e26d13..39ddc17684 100644
--- a/core-java-collections/pom.xml
+++ b/core-java-collections/pom.xml
@@ -14,22 +14,11 @@
-
- net.sourceforge.collections
- collections-generic
- ${collections-generic.version}
-
org.apache.commons
commons-collections4
${commons-collections4.version}
-
- com.jayway.awaitility
- awaitility
- ${avaitility.version}
- test
-
org.apache.commons
commons-lang3
@@ -67,12 +56,6 @@
commons-exec
1.3
-
-
- one.util
- streamex
- 0.6.5
-
diff --git a/core-java-io/README.md b/core-java-io/README.md
index 58e331b6fc..ae4c267b8a 100644
--- a/core-java-io/README.md
+++ b/core-java-io/README.md
@@ -31,4 +31,5 @@
- [Create a Symbolic Link with Java](http://www.baeldung.com/java-symlink)
- [Quick Use of FilenameFilter](http://www.baeldung.com/java-filename-filter)
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
-- [ Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist)
+- [Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist)
+- [Guide to Java OutputStream](https://www.baeldung.com/java-outputstream)
diff --git a/core-java-io/pom.xml b/core-java-io/pom.xml
index cf3e950cb8..efa32b8e3e 100644
--- a/core-java-io/pom.xml
+++ b/core-java-io/pom.xml
@@ -154,6 +154,12 @@
async-http-client
${async-http-client.version}
+
+ com.opencsv
+ opencsv
+ ${opencsv.version}
+ test
+
@@ -247,7 +253,7 @@
1.13
0.6.5
0.9.0
-
+ 4.1
3.6.1
1.7.0
diff --git a/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java b/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java
new file mode 100644
index 0000000000..2593eee82b
--- /dev/null
+++ b/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java
@@ -0,0 +1,106 @@
+package com.baeldung.csv;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Scanner;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.opencsv.CSVReader;
+
+public class ReadCSVInArrayUnitTest {
+ public static final String COMMA_DELIMITER = ",";
+ public static final String CSV_FILE = "src/test/resources/book.csv";
+ public static final List> EXPECTED_ARRAY = Collections.unmodifiableList(new ArrayList>() {
+ {
+ add(new ArrayList() {
+ {
+ add("Mary Kom");
+ add("Unbreakable");
+ }
+ });
+ add(new ArrayList() {
+ {
+ add("Kapil Isapuari");
+ add("Farishta");
+ }
+ });
+ }
+ });
+
+ @Test
+ public void givenCSVFile_whenBufferedReader_thenContentsAsExpected() throws IOException {
+ List> records = new ArrayList>();
+ try (BufferedReader br = new BufferedReader(new FileReader(CSV_FILE))) {
+ String line = "";
+ while ((line = br.readLine()) != null) {
+ String[] values = line.split(COMMA_DELIMITER);
+ records.add(Arrays.asList(values));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < EXPECTED_ARRAY.size(); i++) {
+ Assert.assertArrayEquals(EXPECTED_ARRAY.get(i)
+ .toArray(),
+ records.get(i)
+ .toArray());
+ }
+ }
+
+ @Test
+ public void givenCSVFile_whenScanner_thenContentsAsExpected() throws IOException {
+ List> records = new ArrayList>();
+ try (Scanner scanner = new Scanner(new File(CSV_FILE));) {
+ while (scanner.hasNextLine()) {
+ records.add(getRecordFromLine(scanner.nextLine()));
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < EXPECTED_ARRAY.size(); i++) {
+ Assert.assertArrayEquals(EXPECTED_ARRAY.get(i)
+ .toArray(),
+ records.get(i)
+ .toArray());
+ }
+ }
+
+ private List getRecordFromLine(String line) {
+ List values = new ArrayList();
+ try (Scanner rowScanner = new Scanner(line)) {
+ rowScanner.useDelimiter(COMMA_DELIMITER);
+ while (rowScanner.hasNext()) {
+ values.add(rowScanner.next());
+ }
+ }
+ return values;
+ }
+
+ @Test
+ public void givenCSVFile_whenOpencsv_thenContentsAsExpected() throws IOException {
+ List> records = new ArrayList>();
+ try (CSVReader csvReader = new CSVReader(new FileReader(CSV_FILE));) {
+ String[] values = null;
+ while ((values = csvReader.readNext()) != null) {
+ records.add(Arrays.asList(values));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ for (int i = 0; i < EXPECTED_ARRAY.size(); i++) {
+ Assert.assertArrayEquals(EXPECTED_ARRAY.get(i)
+ .toArray(),
+ records.get(i)
+ .toArray());
+ }
+ }
+}
diff --git a/core-java-io/src/test/resources/book.csv b/core-java-io/src/test/resources/book.csv
new file mode 100644
index 0000000000..b7c4b80499
--- /dev/null
+++ b/core-java-io/src/test/resources/book.csv
@@ -0,0 +1,2 @@
+Mary Kom,Unbreakable
+Kapil Isapuari,Farishta
\ No newline at end of file
diff --git a/core-java/README.md b/core-java/README.md
index 1cbbfe2b39..59aab91aa9 100644
--- a/core-java/README.md
+++ b/core-java/README.md
@@ -157,3 +157,4 @@
- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing)
- [Java Switch Statement](https://www.baeldung.com/java-switch)
- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java)
+- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator)
diff --git a/core-java/src/main/java/com/baeldung/string/DoubleToString.java b/core-java/src/main/java/com/baeldung/string/DoubleToString.java
new file mode 100644
index 0000000000..d26d26f3df
--- /dev/null
+++ b/core-java/src/main/java/com/baeldung/string/DoubleToString.java
@@ -0,0 +1,41 @@
+package com.baeldung.string;
+
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+public class DoubleToString {
+
+ public static String truncateByCast(double d) {
+ return String.valueOf((int) d);
+ }
+
+ public static String roundWithStringFormat(double d) {
+ return String.format("%.0f", d);
+ }
+
+ public static String truncateWithNumberFormat(double d) {
+ NumberFormat nf = NumberFormat.getInstance();
+ nf.setMaximumFractionDigits(0);
+ nf.setRoundingMode(RoundingMode.FLOOR);
+ return nf.format(d);
+ }
+
+ public static String roundWithNumberFormat(double d) {
+ NumberFormat nf = NumberFormat.getInstance();
+ nf.setMaximumFractionDigits(0);
+ return nf.format(d);
+ }
+
+ public static String truncateWithDecimalFormat(double d) {
+ DecimalFormat df = new DecimalFormat("#,###");
+ df.setRoundingMode(RoundingMode.FLOOR);
+ return df.format(d);
+ }
+
+ public static String roundWithDecimalFormat(double d) {
+ DecimalFormat df = new DecimalFormat("#,###");
+ return df.format(d);
+ }
+
+}
diff --git a/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java b/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java
new file mode 100644
index 0000000000..ba4ea32e21
--- /dev/null
+++ b/core-java/src/test/java/com/baeldung/simpledateformat/SimpleDateFormatUnitTest.java
@@ -0,0 +1,59 @@
+package com.baeldung;
+
+import org.junit.Test;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+import java.util.logging.Logger;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+
+public class SimpleDateFormatUnitTest {
+
+ private static final Logger logger = Logger.getLogger(SimpleDateFormatUnitTest.class.getName());
+
+ @Test
+ public void givenSpecificDate_whenFormatted_thenCheckFormatCorrect() throws Exception {
+ SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
+ assertEquals("24-05-1977", formatter.format(new Date(233345223232L)));
+ }
+
+ @Test
+ public void givenSpecificDate_whenFormattedUsingDateFormat_thenCheckFormatCorrect() throws Exception {
+ DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT);
+ assertEquals("5/24/77", formatter.format(new Date(233345223232L)));
+ }
+
+ @Test
+ public void givenStringDate_whenParsed_thenCheckDateCorrect() throws Exception{
+ SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
+ Date myDate = new Date(233276400000L);
+ Date parsedDate = formatter.parse("24-05-1977");
+ assertEquals(myDate.getTime(), parsedDate.getTime());
+ }
+
+ @Test
+ public void givenFranceLocale_whenFormatted_thenCheckFormatCorrect() throws Exception{
+ SimpleDateFormat franceDateFormatter = new SimpleDateFormat("EEEEE dd-MMMMMMM-yyyy", Locale.FRANCE);
+ Date myWednesday = new Date(1539341312904L);
+ assertTrue(franceDateFormatter.format(myWednesday).startsWith("vendredi"));
+ }
+
+ @Test
+ public void given2TimeZones_whenFormatted_thenCheckTimeDifference() throws Exception {
+ Date now = new Date();
+
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEEE dd-MMM-yy HH:mm:ssZ");
+
+ simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Europe/London"));
+ logger.info(simpleDateFormat.format(now));
+ //change the date format
+ simpleDateFormat.setTimeZone(TimeZone.getTimeZone("America/New_York"));
+ logger.info(simpleDateFormat.format(now));
+ }
+}
diff --git a/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java b/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java
new file mode 100644
index 0000000000..5212d7aa1a
--- /dev/null
+++ b/core-java/src/test/java/com/baeldung/string/DoubleToStringUnitTest.java
@@ -0,0 +1,45 @@
+package com.baeldung.string;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+public class DoubleToStringUnitTest {
+
+ private static final double DOUBLE_VALUE = 3.56;
+ private static final String TRUNCATED_DOUBLE = "3";
+ private static final String ROUNDED_UP_DOUBLE = "4";
+
+
+ @Test
+ public void truncateByCastTest() {
+ assertThat(DoubleToString.truncateByCast(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE);
+ }
+
+ @Test
+ public void roundingWithStringFormatTest() {
+ assertThat(DoubleToString.roundWithStringFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE);
+ }
+
+ @Test
+ public void truncateWithNumberFormatTest() {
+ assertThat(DoubleToString.truncateWithNumberFormat(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE);
+ }
+
+ @Test
+ public void roundWithNumberFormatTest() {
+ assertThat(DoubleToString.roundWithNumberFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE);
+ }
+
+ @Test
+ public void truncateWithDecimalFormatTest() {
+ assertThat(DoubleToString.truncateWithDecimalFormat(DOUBLE_VALUE)).isEqualTo(TRUNCATED_DOUBLE);
+ }
+
+ @Test
+ public void roundWithDecimalFormatTest() {
+ assertThat(DoubleToString.roundWithDecimalFormat(DOUBLE_VALUE)).isEqualTo(ROUNDED_UP_DOUBLE);
+ }
+
+
+}
diff --git a/core-kotlin/README.md b/core-kotlin/README.md
index 523f5b6e78..9906b59a93 100644
--- a/core-kotlin/README.md
+++ b/core-kotlin/README.md
@@ -39,3 +39,4 @@
- [Introduction to Kovenant Library for Kotlin](https://www.baeldung.com/kotlin-kovenant)
- [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class)
- [Concatenate Strings in Kotlin](https://www.baeldung.com/kotlin-concatenate-strings)
+- [Kotlin return, break, continue Keywords](https://www.baeldung.com/kotlin-return-break-continue)
diff --git a/hibernate5/README.md b/hibernate5/README.md
index fbf46eed50..7f52531076 100644
--- a/hibernate5/README.md
+++ b/hibernate5/README.md
@@ -17,3 +17,4 @@
- [Mapping A Hibernate Query to a Custom Class](https://www.baeldung.com/hibernate-query-to-custom-class)
- [@JoinColumn Annotation Explained](https://www.baeldung.com/jpa-join-column)
- [Hibernate 5 Naming Strategy Configuration](https://www.baeldung.com/hibernate-naming-strategy)
+- [Proxy in Hibernate load() Method](https://www.baeldung.com/hibernate-proxy-load-method)
diff --git a/hibernate5/pom.xml b/hibernate5/pom.xml
index 610c893bdc..748a106cca 100644
--- a/hibernate5/pom.xml
+++ b/hibernate5/pom.xml
@@ -44,6 +44,11 @@
mariaDB4j
${mariaDB4j.version}
+
+ org.hibernate
+ hibernate-testing
+ 5.2.2.Final
+
@@ -57,7 +62,7 @@
- 5.3.2.Final
+ 5.3.6.Final
6.0.6
2.2.3
1.4.196
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java b/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java
index 2212e736ab..e0d1de591b 100644
--- a/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/HibernateUtil.java
@@ -5,6 +5,8 @@ import java.io.IOException;
import java.net.URL;
import java.util.Properties;
+import com.baeldung.hibernate.customtypes.LocalDateStringType;
+import com.baeldung.hibernate.customtypes.OfficeEmployee;
import com.baeldung.hibernate.entities.DeptEmployee;
import com.baeldung.hibernate.optimisticlocking.OptimisticLockingCourse;
import com.baeldung.hibernate.optimisticlocking.OptimisticLockingStudent;
@@ -18,8 +20,10 @@ import com.baeldung.hibernate.pojo.inheritance.*;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.SessionFactory;
import org.hibernate.boot.Metadata;
+import org.hibernate.boot.MetadataBuilder;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import com.baeldung.hibernate.pojo.Course;
@@ -66,6 +70,7 @@ public class HibernateUtil {
private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) {
MetadataSources metadataSources = new MetadataSources(serviceRegistry);
+
metadataSources.addPackage("com.baeldung.hibernate.pojo");
metadataSources.addAnnotatedClass(Employee.class);
metadataSources.addAnnotatedClass(Phone.class);
@@ -102,8 +107,12 @@ public class HibernateUtil {
metadataSources.addAnnotatedClass(com.baeldung.hibernate.entities.Department.class);
metadataSources.addAnnotatedClass(OptimisticLockingCourse.class);
metadataSources.addAnnotatedClass(OptimisticLockingStudent.class);
+ metadataSources.addAnnotatedClass(OfficeEmployee.class);
+
+ Metadata metadata = metadataSources.getMetadataBuilder()
+ .applyBasicType(LocalDateStringType.INSTANCE)
+ .build();
- Metadata metadata = metadataSources.buildMetadata();
return metadata.getSessionFactoryBuilder()
.build();
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java
new file mode 100644
index 0000000000..d559e5a6c2
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Address.java
@@ -0,0 +1,69 @@
+package com.baeldung.hibernate.customtypes;
+
+import java.util.Objects;
+
+public class Address {
+
+ private String addressLine1;
+ private String addressLine2;
+ private String city;
+ private String country;
+ private int zipCode;
+
+ public String getAddressLine1() {
+ return addressLine1;
+ }
+
+ public String getAddressLine2() {
+ return addressLine2;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public int getZipCode() {
+ return zipCode;
+ }
+
+ public void setAddressLine1(String addressLine1) {
+ this.addressLine1 = addressLine1;
+ }
+
+ public void setAddressLine2(String addressLine2) {
+ this.addressLine2 = addressLine2;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public void setZipCode(int zipCode) {
+ this.zipCode = zipCode;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Address address = (Address) o;
+ return zipCode == address.zipCode &&
+ Objects.equals(addressLine1, address.addressLine1) &&
+ Objects.equals(addressLine2, address.addressLine2) &&
+ Objects.equals(city, address.city) &&
+ Objects.equals(country, address.country);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(addressLine1, addressLine2, city, country, zipCode);
+ }
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java
new file mode 100644
index 0000000000..c10c67df9a
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/AddressType.java
@@ -0,0 +1,169 @@
+package com.baeldung.hibernate.customtypes;
+
+import org.hibernate.HibernateException;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
+import org.hibernate.type.IntegerType;
+import org.hibernate.type.StringType;
+import org.hibernate.type.Type;
+import org.hibernate.usertype.CompositeUserType;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Objects;
+
+public class AddressType implements CompositeUserType {
+
+ @Override
+ public String[] getPropertyNames() {
+ return new String[]{"addressLine1", "addressLine2",
+ "city", "country", "zipcode"};
+ }
+
+ @Override
+ public Type[] getPropertyTypes() {
+ return new Type[]{StringType.INSTANCE, StringType.INSTANCE,
+ StringType.INSTANCE, StringType.INSTANCE, IntegerType.INSTANCE};
+ }
+
+ @Override
+ public Object getPropertyValue(Object component, int property) throws HibernateException {
+
+ Address empAdd = (Address) component;
+
+ switch (property) {
+ case 0:
+ return empAdd.getAddressLine1();
+ case 1:
+ return empAdd.getAddressLine2();
+ case 2:
+ return empAdd.getCity();
+ case 3:
+ return empAdd.getCountry();
+ case 4:
+ return Integer.valueOf(empAdd.getZipCode());
+ }
+
+ throw new IllegalArgumentException(property +
+ " is an invalid property index for class type " +
+ component.getClass().getName());
+ }
+
+ @Override
+ public void setPropertyValue(Object component, int property, Object value) throws HibernateException {
+
+ Address empAdd = (Address) component;
+
+ switch (property) {
+ case 0:
+ empAdd.setAddressLine1((String) value);
+ case 1:
+ empAdd.setAddressLine2((String) value);
+ case 2:
+ empAdd.setCity((String) value);
+ case 3:
+ empAdd.setCountry((String) value);
+ case 4:
+ empAdd.setZipCode((Integer) value);
+ }
+
+ throw new IllegalArgumentException(property +
+ " is an invalid property index for class type " +
+ component.getClass().getName());
+
+ }
+
+ @Override
+ public Class returnedClass() {
+ return Address.class;
+ }
+
+ @Override
+ public boolean equals(Object x, Object y) throws HibernateException {
+ if (x == y)
+ return true;
+
+ if (Objects.isNull(x) || Objects.isNull(y))
+ return false;
+
+ return x.equals(y);
+ }
+
+ @Override
+ public int hashCode(Object x) throws HibernateException {
+ return x.hashCode();
+ }
+
+ @Override
+ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
+
+ Address empAdd = new Address();
+ empAdd.setAddressLine1(rs.getString(names[0]));
+
+ if (rs.wasNull())
+ return null;
+
+ empAdd.setAddressLine2(rs.getString(names[1]));
+ empAdd.setCity(rs.getString(names[2]));
+ empAdd.setCountry(rs.getString(names[3]));
+ empAdd.setZipCode(rs.getInt(names[4]));
+
+ return empAdd;
+ }
+
+ @Override
+ public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
+
+ if (Objects.isNull(value))
+ st.setNull(index, Types.VARCHAR);
+ else {
+
+ Address empAdd = (Address) value;
+ st.setString(index, empAdd.getAddressLine1());
+ st.setString(index + 1, empAdd.getAddressLine2());
+ st.setString(index + 2, empAdd.getCity());
+ st.setString(index + 3, empAdd.getCountry());
+ st.setInt(index + 4, empAdd.getZipCode());
+ }
+ }
+
+ @Override
+ public Object deepCopy(Object value) throws HibernateException {
+
+ if (Objects.isNull(value))
+ return null;
+
+ Address oldEmpAdd = (Address) value;
+ Address newEmpAdd = new Address();
+
+ newEmpAdd.setAddressLine1(oldEmpAdd.getAddressLine1());
+ newEmpAdd.setAddressLine2(oldEmpAdd.getAddressLine2());
+ newEmpAdd.setCity(oldEmpAdd.getCity());
+ newEmpAdd.setCountry(oldEmpAdd.getCountry());
+ newEmpAdd.setZipCode(oldEmpAdd.getZipCode());
+
+ return newEmpAdd;
+ }
+
+ @Override
+ public boolean isMutable() {
+ return true;
+ }
+
+ @Override
+ public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException {
+ return (Serializable) deepCopy(value);
+ }
+
+ @Override
+ public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException {
+ return deepCopy(cached);
+ }
+
+ @Override
+ public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException {
+ return original;
+ }
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java
new file mode 100644
index 0000000000..56be9e693f
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringJavaDescriptor.java
@@ -0,0 +1,51 @@
+package com.baeldung.hibernate.customtypes;
+
+import org.hibernate.type.LocalDateType;
+import org.hibernate.type.descriptor.WrapperOptions;
+import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
+import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
+import org.hibernate.type.descriptor.java.MutabilityPlan;
+
+import java.time.LocalDate;
+
+public class LocalDateStringJavaDescriptor extends AbstractTypeDescriptor {
+
+ public static final LocalDateStringJavaDescriptor INSTANCE = new LocalDateStringJavaDescriptor();
+
+ public LocalDateStringJavaDescriptor() {
+ super(LocalDate.class, ImmutableMutabilityPlan.INSTANCE);
+ }
+
+ @Override
+ public String toString(LocalDate value) {
+ return LocalDateType.FORMATTER.format(value);
+ }
+
+ @Override
+ public LocalDate fromString(String string) {
+ return LocalDate.from(LocalDateType.FORMATTER.parse(string));
+ }
+
+ @Override
+ public X unwrap(LocalDate value, Class type, WrapperOptions options) {
+
+ if (value == null)
+ return null;
+
+ if (String.class.isAssignableFrom(type))
+ return (X) LocalDateType.FORMATTER.format(value);
+
+ throw unknownUnwrap(type);
+ }
+
+ @Override
+ public LocalDate wrap(X value, WrapperOptions options) {
+ if (value == null)
+ return null;
+
+ if(String.class.isInstance(value))
+ return LocalDate.from(LocalDateType.FORMATTER.parse((CharSequence) value));
+
+ throw unknownWrap(value.getClass());
+ }
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java
new file mode 100644
index 0000000000..c8d37073e8
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/LocalDateStringType.java
@@ -0,0 +1,34 @@
+package com.baeldung.hibernate.customtypes;
+
+import org.hibernate.dialect.Dialect;
+import org.hibernate.type.AbstractSingleColumnStandardBasicType;
+import org.hibernate.type.DiscriminatorType;
+import org.hibernate.type.descriptor.java.LocalDateJavaDescriptor;
+import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
+
+import java.time.LocalDate;
+
+public class LocalDateStringType extends AbstractSingleColumnStandardBasicType implements DiscriminatorType {
+
+ public static final LocalDateStringType INSTANCE = new LocalDateStringType();
+
+ public LocalDateStringType() {
+ super(VarcharTypeDescriptor.INSTANCE, LocalDateStringJavaDescriptor.INSTANCE);
+ }
+
+ @Override
+ public String getName() {
+ return "LocalDateString";
+ }
+
+ @Override
+ public LocalDate stringToObject(String xml) throws Exception {
+ return fromString(xml);
+ }
+
+ @Override
+ public String objectToSQLString(LocalDate value, Dialect dialect) throws Exception {
+ return '\'' + toString(value) + '\'';
+ }
+
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java
new file mode 100644
index 0000000000..3ca06e4316
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/OfficeEmployee.java
@@ -0,0 +1,88 @@
+package com.baeldung.hibernate.customtypes;
+
+import com.baeldung.hibernate.pojo.Phone;
+import org.hibernate.annotations.Columns;
+import org.hibernate.annotations.Parameter;
+import org.hibernate.annotations.Type;
+import org.hibernate.annotations.TypeDef;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.time.LocalDate;
+
+@TypeDef(name = "PhoneNumber",
+ typeClass = PhoneNumberType.class,
+ defaultForType = PhoneNumber.class)
+@Entity
+@Table(name = "OfficeEmployee")
+public class OfficeEmployee {
+
+ @Id
+ @GeneratedValue
+ private long id;
+
+ @Column
+ @Type(type = "LocalDateString")
+ private LocalDate dateOfJoining;
+
+ @Columns(columns = {@Column(name = "country_code"),
+ @Column(name = "city_code"),
+ @Column(name = "number")})
+ private PhoneNumber employeeNumber;
+
+ @Columns(columns = {@Column(name = "address_line_1"),
+ @Column(name = "address_line_2"),
+ @Column(name = "city"), @Column(name = "country"),
+ @Column(name = "zip_code")})
+ @Type(type = "com.baeldung.hibernate.customtypes.AddressType")
+ private Address empAddress;
+
+ @Type(type = "com.baeldung.hibernate.customtypes.SalaryType",
+ parameters = {@Parameter(name = "currency", value = "USD")})
+ @Columns(columns = {@Column(name = "amount"),
+ @Column(name = "currency")})
+ private Salary salary;
+
+ public Salary getSalary() {
+ return salary;
+ }
+
+ public void setSalary(Salary salary) {
+ this.salary = salary;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public LocalDate getDateOfJoining() {
+ return dateOfJoining;
+ }
+
+ public void setDateOfJoining(LocalDate dateOfJoining) {
+ this.dateOfJoining = dateOfJoining;
+ }
+
+ public PhoneNumber getEmployeeNumber() {
+ return employeeNumber;
+ }
+
+ public void setEmployeeNumber(PhoneNumber employeeNumber) {
+ this.employeeNumber = employeeNumber;
+ }
+
+ public Address getEmpAddress() {
+ return empAddress;
+ }
+
+ public void setEmpAddress(Address empAddress) {
+ this.empAddress = empAddress;
+ }
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java
new file mode 100644
index 0000000000..0be6cbc910
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumber.java
@@ -0,0 +1,43 @@
+package com.baeldung.hibernate.customtypes;
+
+import java.util.Objects;
+
+public final class PhoneNumber {
+
+ private final int countryCode;
+ private final int cityCode;
+ private final int number;
+
+ public PhoneNumber(int countryCode, int cityCode, int number) {
+ this.countryCode = countryCode;
+ this.cityCode = cityCode;
+ this.number = number;
+ }
+
+ public int getCountryCode() {
+ return countryCode;
+ }
+
+ public int getCityCode() {
+ return cityCode;
+ }
+
+ public int getNumber() {
+ return number;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ PhoneNumber that = (PhoneNumber) o;
+ return countryCode == that.countryCode &&
+ cityCode == that.cityCode &&
+ number == that.number;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(countryCode, cityCode, number);
+ }
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java
new file mode 100644
index 0000000000..9f09352bec
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java
@@ -0,0 +1,98 @@
+package com.baeldung.hibernate.customtypes;
+
+import org.hibernate.HibernateException;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
+import org.hibernate.usertype.UserType;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Objects;
+
+
+public class PhoneNumberType implements UserType {
+ @Override
+ public int[] sqlTypes() {
+ return new int[]{Types.INTEGER, Types.INTEGER, Types.INTEGER};
+ }
+
+ @Override
+ public Class returnedClass() {
+ return PhoneNumber.class;
+ }
+
+ @Override
+ public boolean equals(Object x, Object y) throws HibernateException {
+ if (x == y)
+ return true;
+ if (Objects.isNull(x) || Objects.isNull(y))
+ return false;
+
+ return x.equals(y);
+ }
+
+ @Override
+ public int hashCode(Object x) throws HibernateException {
+ return x.hashCode();
+ }
+
+ @Override
+ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
+ int countryCode = rs.getInt(names[0]);
+
+ if (rs.wasNull())
+ return null;
+
+ int cityCode = rs.getInt(names[1]);
+ int number = rs.getInt(names[2]);
+ PhoneNumber employeeNumber = new PhoneNumber(countryCode, cityCode, number);
+
+ return employeeNumber;
+ }
+
+ @Override
+ public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
+
+ if (Objects.isNull(value)) {
+ st.setNull(index, Types.INTEGER);
+ } else {
+ PhoneNumber employeeNumber = (PhoneNumber) value;
+ st.setInt(index,employeeNumber.getCountryCode());
+ st.setInt(index+1,employeeNumber.getCityCode());
+ st.setInt(index+2,employeeNumber.getNumber());
+ }
+ }
+
+ @Override
+ public Object deepCopy(Object value) throws HibernateException {
+ if (Objects.isNull(value))
+ return null;
+
+ PhoneNumber empNumber = (PhoneNumber) value;
+ PhoneNumber newEmpNumber = new PhoneNumber(empNumber.getCountryCode(),empNumber.getCityCode(),empNumber.getNumber());
+
+ return newEmpNumber;
+ }
+
+ @Override
+ public boolean isMutable() {
+ return false;
+ }
+
+ @Override
+ public Serializable disassemble(Object value) throws HibernateException {
+ return (Serializable) value;
+ }
+
+ @Override
+ public Object assemble(Serializable cached, Object owner) throws HibernateException {
+ return cached;
+ }
+
+ @Override
+ public Object replace(Object original, Object target, Object owner) throws HibernateException {
+ return original;
+ }
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java
new file mode 100644
index 0000000000..f9a7ac5902
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/Salary.java
@@ -0,0 +1,39 @@
+package com.baeldung.hibernate.customtypes;
+
+import java.util.Objects;
+
+public class Salary {
+
+ private Long amount;
+ private String currency;
+
+ public Long getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Long amount) {
+ this.amount = amount;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Salary salary = (Salary) o;
+ return Objects.equals(amount, salary.amount) &&
+ Objects.equals(currency, salary.currency);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(amount, currency);
+ }
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java
new file mode 100644
index 0000000000..340c697c11
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryCurrencyConvertor.java
@@ -0,0 +1,15 @@
+package com.baeldung.hibernate.customtypes;
+
+public class SalaryCurrencyConvertor {
+
+ public static Long convert(Long amount, String oldCurr, String newCurr){
+ if (newCurr.equalsIgnoreCase(oldCurr))
+ return amount;
+
+ return convertTo();
+ }
+
+ private static Long convertTo() {
+ return 10L;
+ }
+}
diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java
new file mode 100644
index 0000000000..266b85140b
--- /dev/null
+++ b/hibernate5/src/main/java/com/baeldung/hibernate/customtypes/SalaryType.java
@@ -0,0 +1,161 @@
+package com.baeldung.hibernate.customtypes;
+
+import org.hibernate.HibernateException;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
+import org.hibernate.type.LongType;
+import org.hibernate.type.StringType;
+import org.hibernate.type.Type;
+import org.hibernate.usertype.CompositeUserType;
+import org.hibernate.usertype.DynamicParameterizedType;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Objects;
+import java.util.Properties;
+
+public class SalaryType implements CompositeUserType, DynamicParameterizedType {
+
+ private String localCurrency;
+
+ @Override
+ public String[] getPropertyNames() {
+ return new String[]{"amount", "currency"};
+ }
+
+ @Override
+ public Type[] getPropertyTypes() {
+ return new Type[]{LongType.INSTANCE, StringType.INSTANCE};
+ }
+
+ @Override
+ public Object getPropertyValue(Object component, int property) throws HibernateException {
+
+ Salary salary = (Salary) component;
+
+ switch (property) {
+ case 0:
+ return salary.getAmount();
+ case 1:
+ return salary.getCurrency();
+ }
+
+ throw new IllegalArgumentException(property +
+ " is an invalid property index for class type " +
+ component.getClass().getName());
+
+ }
+
+
+ @Override
+ public void setPropertyValue(Object component, int property, Object value) throws HibernateException {
+
+ Salary salary = (Salary) component;
+
+ switch (property) {
+ case 0:
+ salary.setAmount((Long) value);
+ case 1:
+ salary.setCurrency((String) value);
+ }
+
+ throw new IllegalArgumentException(property +
+ " is an invalid property index for class type " +
+ component.getClass().getName());
+
+ }
+
+ @Override
+ public Class returnedClass() {
+ return Salary.class;
+ }
+
+ @Override
+ public boolean equals(Object x, Object y) throws HibernateException {
+
+ if (x == y)
+ return true;
+
+ if (Objects.isNull(x) || Objects.isNull(y))
+ return false;
+
+ return x.equals(y);
+
+ }
+
+ @Override
+ public int hashCode(Object x) throws HibernateException {
+ return x.hashCode();
+ }
+
+ @Override
+ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
+
+ Salary salary = new Salary();
+ salary.setAmount(rs.getLong(names[0]));
+
+ if (rs.wasNull())
+ return null;
+
+ salary.setCurrency(rs.getString(names[1]));
+
+ return salary;
+ }
+
+ @Override
+ public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
+
+
+ if (Objects.isNull(value))
+ st.setNull(index, Types.BIGINT);
+ else {
+
+ Salary salary = (Salary) value;
+ st.setLong(index, SalaryCurrencyConvertor.convert(salary.getAmount(),
+ salary.getCurrency(), localCurrency));
+ st.setString(index + 1, salary.getCurrency());
+ }
+ }
+
+ @Override
+ public Object deepCopy(Object value) throws HibernateException {
+
+ if (Objects.isNull(value))
+ return null;
+
+ Salary oldSal = (Salary) value;
+ Salary newSal = new Salary();
+
+ newSal.setAmount(oldSal.getAmount());
+ newSal.setCurrency(oldSal.getCurrency());
+
+ return newSal;
+ }
+
+ @Override
+ public boolean isMutable() {
+ return true;
+ }
+
+ @Override
+ public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException {
+ return (Serializable) deepCopy(value);
+ }
+
+ @Override
+ public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) throws HibernateException {
+ return deepCopy(cached);
+ }
+
+ @Override
+ public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) throws HibernateException {
+ return original;
+ }
+
+ @Override
+ public void setParameterValues(Properties parameters) {
+ this.localCurrency = parameters.getProperty("currency");
+ }
+}
diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesUnitTest.java b/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesUnitTest.java
new file mode 100644
index 0000000000..f0179701df
--- /dev/null
+++ b/hibernate5/src/test/java/com/baeldung/hibernate/customtypes/HibernateCustomTypesUnitTest.java
@@ -0,0 +1,90 @@
+package com.baeldung.hibernate.customtypes;
+
+import com.baeldung.hibernate.HibernateUtil;
+import org.hibernate.SessionFactory;
+import org.hibernate.query.Query;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.time.LocalDate;
+
+import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
+
+public class HibernateCustomTypesUnitTest {
+
+ @Test
+ public void givenEmployee_whenSavedWithCustomTypes_thenEntityIsSaved() throws IOException {
+
+ final OfficeEmployee e = new OfficeEmployee();
+ e.setDateOfJoining(LocalDate.now());
+
+ PhoneNumber number = new PhoneNumber(1, 222, 8781902);
+ e.setEmployeeNumber(number);
+
+ Address empAdd = new Address();
+ empAdd.setAddressLine1("Street");
+ empAdd.setAddressLine2("Area");
+ empAdd.setCity("City");
+ empAdd.setCountry("Country");
+ empAdd.setZipCode(100);
+
+ e.setEmpAddress(empAdd);
+
+ Salary empSalary = new Salary();
+ empSalary.setAmount(1000L);
+ empSalary.setCurrency("USD");
+ e.setSalary(empSalary);
+
+ doInHibernate(this::sessionFactory, session -> {
+ session.save(e);
+ boolean contains = session.contains(e);
+ Assert.assertTrue(contains);
+ });
+
+ }
+
+ @Test
+ public void givenEmployee_whenCustomTypeInQuery_thenReturnEntity() throws IOException {
+
+ final OfficeEmployee e = new OfficeEmployee();
+ e.setDateOfJoining(LocalDate.now());
+
+ PhoneNumber number = new PhoneNumber(1, 222, 8781902);
+ e.setEmployeeNumber(number);
+
+ Address empAdd = new Address();
+ empAdd.setAddressLine1("Street");
+ empAdd.setAddressLine2("Area");
+ empAdd.setCity("City");
+ empAdd.setCountry("Country");
+ empAdd.setZipCode(100);
+ e.setEmpAddress(empAdd);
+
+ Salary empSalary = new Salary();
+ empSalary.setAmount(1000L);
+ empSalary.setCurrency("USD");
+ e.setSalary(empSalary);
+
+ doInHibernate(this::sessionFactory, session -> {
+ session.save(e);
+
+ Query query = session.createQuery("FROM OfficeEmployee OE WHERE OE.empAddress.zipcode = :pinCode");
+ query.setParameter("pinCode",100);
+ int size = query.list().size();
+
+ Assert.assertEquals(1, size);
+ });
+
+ }
+
+ private SessionFactory sessionFactory() {
+ try {
+ return HibernateUtil.getSessionFactory("hibernate-customtypes.properties");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+}
diff --git a/hibernate5/src/test/resources/hibernate-customtypes.properties b/hibernate5/src/test/resources/hibernate-customtypes.properties
new file mode 100644
index 0000000000..345f3d37b0
--- /dev/null
+++ b/hibernate5/src/test/resources/hibernate-customtypes.properties
@@ -0,0 +1,10 @@
+hibernate.connection.driver_class=org.postgresql.Driver
+hibernate.connection.url=jdbc:postgresql://localhost:5432/test
+hibernate.connection.username=postgres
+hibernate.connection.password=thule
+hibernate.connection.autocommit=true
+jdbc.password=thule
+
+hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
+hibernate.show_sql=true
+hibernate.hbm2ddl.auto=create-drop
\ No newline at end of file
diff --git a/java-collections-conversions/README.md b/java-collections-conversions/README.md
new file mode 100644
index 0000000000..761a78d7b0
--- /dev/null
+++ b/java-collections-conversions/README.md
@@ -0,0 +1,11 @@
+=========
+
+## Java Collections Cookbooks and Examples
+
+### Relevant Articles:
+- [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array)
+- [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array)
+- [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list)
+- [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set)
+- [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)
\ No newline at end of file
diff --git a/java-collections-conversions/pom.xml b/java-collections-conversions/pom.xml
new file mode 100644
index 0000000000..9b54652001
--- /dev/null
+++ b/java-collections-conversions/pom.xml
@@ -0,0 +1,40 @@
+
+ 4.0.0
+ java-collections-conversions
+ 0.1.0-SNAPSHOT
+ jar
+ java-collections-conversions
+
+
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../parent-java
+
+
+
+
+ org.apache.commons
+ commons-collections4
+ ${commons-collections4.version}
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
+ org.assertj
+ assertj-core
+ ${assertj.version}
+ test
+
+
+
+
+ 3.5
+ 4.1
+ 3.6.1
+
+
diff --git a/core-java-collections/src/main/java/com/baeldung/convertcollectiontoarraylist/Foo.java b/java-collections-conversions/src/main/java/com/baeldung/convertcollectiontoarraylist/Foo.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/convertcollectiontoarraylist/Foo.java
rename to java-collections-conversions/src/main/java/com/baeldung/convertcollectiontoarraylist/Foo.java
diff --git a/core-java-collections/src/main/java/com/baeldung/convertlisttomap/Animal.java b/java-collections-conversions/src/main/java/com/baeldung/convertlisttomap/Animal.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/convertlisttomap/Animal.java
rename to java-collections-conversions/src/main/java/com/baeldung/convertlisttomap/Animal.java
diff --git a/core-java-collections/src/main/java/com/baeldung/convertlisttomap/ConvertListToMapService.java b/java-collections-conversions/src/main/java/com/baeldung/convertlisttomap/ConvertListToMapService.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/convertlisttomap/ConvertListToMapService.java
rename to java-collections-conversions/src/main/java/com/baeldung/convertlisttomap/ConvertListToMapService.java
diff --git a/core-java-persistence/src/main/resources/logback.xml b/java-collections-conversions/src/main/resources/logback.xml
similarity index 100%
rename from core-java-persistence/src/main/resources/logback.xml
rename to java-collections-conversions/src/main/resources/logback.xml
diff --git a/core-java-collections/src/test/java/com/baeldung/convertcollectiontoarraylist/FooUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/convertcollectiontoarraylist/FooUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/convertcollectiontoarraylist/FooUnitTest.java
rename to java-collections-conversions/src/test/java/com/baeldung/convertcollectiontoarraylist/FooUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/convertlisttomap/ConvertListToMapServiceUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/convertlisttomap/ConvertListToMapServiceUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/convertlisttomap/ConvertListToMapServiceUnitTest.java
rename to java-collections-conversions/src/test/java/com/baeldung/convertlisttomap/ConvertListToMapServiceUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/convertlisttomap/ConvertListWithDiplicatedIdToMapServiceUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/convertlisttomap/ConvertListWithDiplicatedIdToMapServiceUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/convertlisttomap/ConvertListWithDiplicatedIdToMapServiceUnitTest.java
rename to java-collections-conversions/src/test/java/com/baeldung/convertlisttomap/ConvertListWithDiplicatedIdToMapServiceUnitTest.java
diff --git a/core-java-collections/src/test/java/org/baeldung/java/collections/JavaCollectionConversionUnitTest.java b/java-collections-conversions/src/test/java/org/baeldung/java/collections/JavaCollectionConversionUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/org/baeldung/java/collections/JavaCollectionConversionUnitTest.java
rename to java-collections-conversions/src/test/java/org/baeldung/java/collections/JavaCollectionConversionUnitTest.java
diff --git a/core-java-collections/src/test/java/org/baeldung/java/lists/ListToSTring.java b/java-collections-conversions/src/test/java/org/baeldung/java/lists/ListToSTring.java
similarity index 100%
rename from core-java-collections/src/test/java/org/baeldung/java/lists/ListToSTring.java
rename to java-collections-conversions/src/test/java/org/baeldung/java/lists/ListToSTring.java
diff --git a/java-collections-maps/README.md b/java-collections-maps/README.md
new file mode 100644
index 0000000000..a6037a3c57
--- /dev/null
+++ b/java-collections-maps/README.md
@@ -0,0 +1,19 @@
+=========
+
+## Java Collections Cookbooks and Examples
+
+### Relevant Articles:
+- [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap)
+- [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap)
+- [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap)
+- [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap)
+- [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap)
+- [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map)
+- [Java TreeMap vs HashMap](http://www.baeldung.com/java-treemap-vs-hashmap)
+- [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys)
+- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
+- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value)
+- [Sort a HashMap in Java](https://www.baeldung.com/java-hashmap-sort)
+- [Finding the Highest Value in a Java Map](https://www.baeldung.com/java-find-map-max)
+- [Merging Two Maps with Java 8](https://www.baeldung.com/java-merge-maps)
+- [How to Check If a Key Exists in a Map](https://www.baeldung.com/java-map-key-exists)
diff --git a/java-collections-maps/pom.xml b/java-collections-maps/pom.xml
new file mode 100644
index 0000000000..0803866c51
--- /dev/null
+++ b/java-collections-maps/pom.xml
@@ -0,0 +1,54 @@
+
+ 4.0.0
+ java-collections-maps
+ 0.1.0-SNAPSHOT
+ jar
+ java-collections-maps
+
+
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../parent-java
+
+
+
+
+ org.apache.commons
+ commons-collections4
+ ${commons-collections4.version}
+
+
+ com.jayway.awaitility
+ awaitility
+ ${avaitility.version}
+ test
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
+ org.assertj
+ assertj-core
+ ${assertj.version}
+ test
+
+
+ one.util
+ streamex
+ 0.6.5
+
+
+
+
+ 3.5
+ 4.1
+ 4.01
+ 1.7.0
+ 3.6.1
+ 7.1.0
+
+
diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/MapUtil.java b/java-collections-maps/src/main/java/com/baeldung/java/map/MapUtil.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/map/MapUtil.java
rename to java-collections-maps/src/main/java/com/baeldung/java/map/MapUtil.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/MyKey.java b/java-collections-maps/src/main/java/com/baeldung/java/map/MyKey.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/map/MyKey.java
rename to java-collections-maps/src/main/java/com/baeldung/java/map/MyKey.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/MyLinkedHashMap.java b/java-collections-maps/src/main/java/com/baeldung/java/map/MyLinkedHashMap.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/map/MyLinkedHashMap.java
rename to java-collections-maps/src/main/java/com/baeldung/java/map/MyLinkedHashMap.java
diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java b/java-collections-maps/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java
rename to java-collections-maps/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java
diff --git a/core-java-collections/src/main/java/com/baeldung/map/iteration/MapIteration.java b/java-collections-maps/src/main/java/com/baeldung/map/iteration/MapIteration.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/map/iteration/MapIteration.java
rename to java-collections-maps/src/main/java/com/baeldung/map/iteration/MapIteration.java
diff --git a/core-java-collections/src/main/java/com/baeldung/map/java_8/MergeMaps.java b/java-collections-maps/src/main/java/com/baeldung/map/java_8/MergeMaps.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/map/java_8/MergeMaps.java
rename to java-collections-maps/src/main/java/com/baeldung/map/java_8/MergeMaps.java
diff --git a/core-java-collections/src/main/java/com/baeldung/map/util/MapMax.java b/java-collections-maps/src/main/java/com/baeldung/map/util/MapMax.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/map/util/MapMax.java
rename to java-collections-maps/src/main/java/com/baeldung/map/util/MapMax.java
diff --git a/core-java-collections/src/main/java/com/baeldung/sort/Employee.java b/java-collections-maps/src/main/java/com/baeldung/sort/Employee.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/sort/Employee.java
rename to java-collections-maps/src/main/java/com/baeldung/sort/Employee.java
diff --git a/core-java-collections/src/main/java/com/baeldung/sort/SortHashMap.java b/java-collections-maps/src/main/java/com/baeldung/sort/SortHashMap.java
similarity index 100%
rename from core-java-collections/src/main/java/com/baeldung/sort/SortHashMap.java
rename to java-collections-maps/src/main/java/com/baeldung/sort/SortHashMap.java
diff --git a/deltaspike/src/main/resources/logback.xml b/java-collections-maps/src/main/resources/logback.xml
similarity index 100%
rename from deltaspike/src/main/resources/logback.xml
rename to java-collections-maps/src/main/resources/logback.xml
diff --git a/core-java-collections/src/test/java/com/baeldung/collection/WhenComparingTreeMapVsHashMap.java b/java-collections-maps/src/test/java/com/baeldung/collection/WhenComparingTreeMapVsHashMap.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/collection/WhenComparingTreeMapVsHashMap.java
rename to java-collections-maps/src/test/java/com/baeldung/collection/WhenComparingTreeMapVsHashMap.java
diff --git a/core-java/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java
similarity index 100%
rename from core-java/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java
rename to java-collections-maps/src/test/java/com/baeldung/guava/GuavaBiMapUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/KeyCheckUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/KeyCheckUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/java/map/KeyCheckUnitTest.java
rename to java-collections-maps/src/test/java/com/baeldung/java/map/KeyCheckUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/MapMultipleValuesUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/MapMultipleValuesUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/java/map/MapMultipleValuesUnitTest.java
rename to java-collections-maps/src/test/java/com/baeldung/java/map/MapMultipleValuesUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/MapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/MapUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/java/map/MapUnitTest.java
rename to java-collections-maps/src/test/java/com/baeldung/java/map/MapUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/MapUtilUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/MapUtilUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/java/map/MapUtilUnitTest.java
rename to java-collections-maps/src/test/java/com/baeldung/java/map/MapUtilUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java
rename to java-collections-maps/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java
rename to java-collections-maps/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java
diff --git a/core-java-collections/src/test/java/com/baeldung/weakhashmap/WeakHashMapUnitTest.java b/java-collections-maps/src/test/java/com/baeldung/weakhashmap/WeakHashMapUnitTest.java
similarity index 100%
rename from core-java-collections/src/test/java/com/baeldung/weakhashmap/WeakHashMapUnitTest.java
rename to java-collections-maps/src/test/java/com/baeldung/weakhashmap/WeakHashMapUnitTest.java
diff --git a/java-dates/README.md b/java-dates/README.md
index 54843f90ee..f99bfeb861 100644
--- a/java-dates/README.md
+++ b/java-dates/README.md
@@ -21,4 +21,5 @@
- [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end)
- [Calculate Age in Java](http://www.baeldung.com/java-get-age)
- [Increment Date in Java](http://www.baeldung.com/java-increment-date)
-- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date)
\ No newline at end of file
+- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date)
+- [Guide to DateTimeFormatter](https://www.baeldung.com/java-datetimeformatter)
diff --git a/java-numbers/README.md b/java-numbers/README.md
index 6d6a279cc9..1138d9a74c 100644
--- a/java-numbers/README.md
+++ b/java-numbers/README.md
@@ -12,3 +12,4 @@
- [BigDecimal and BigInteger in Java](http://www.baeldung.com/java-bigdecimal-biginteger)
- [Find All Pairs of Numbers in an Array That Add Up to a Given Sum](http://www.baeldung.com/java-algorithm-number-pairs-sum)
- [Java – Random Long, Float, Integer and Double](http://www.baeldung.com/java-generate-random-long-float-integer-double)
+- [Using Math.sin with Degrees](https://www.baeldung.com/java-math-sin-degrees)
diff --git a/libraries-data/pom.xml b/libraries-data/pom.xml
index bbf0c7832f..54d24edbf6 100644
--- a/libraries-data/pom.xml
+++ b/libraries-data/pom.xml
@@ -259,6 +259,11 @@
slf4j-api
${slf4j.version}
+
+ org.apache.storm
+ storm-core
+ ${storm.version}
+
ch.qos.logback
@@ -432,6 +437,7 @@
+ 1.2.2
4.0.1
1.4.196
16.5.1
diff --git a/libraries-data/src/main/java/com/baeldung/storm/TopologyRunner.java b/libraries-data/src/main/java/com/baeldung/storm/TopologyRunner.java
new file mode 100644
index 0000000000..326f53c0b8
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/TopologyRunner.java
@@ -0,0 +1,34 @@
+package com.baeldung.storm;
+
+import com.baeldung.storm.bolt.AggregatingBolt;
+import com.baeldung.storm.bolt.FileWritingBolt;
+import com.baeldung.storm.bolt.FilteringBolt;
+import com.baeldung.storm.bolt.PrintingBolt;
+import com.baeldung.storm.spout.RandomNumberSpout;
+import org.apache.storm.Config;
+import org.apache.storm.LocalCluster;
+import org.apache.storm.topology.TopologyBuilder;
+import org.apache.storm.topology.base.BaseWindowedBolt;
+
+public class TopologyRunner {
+ public static void main(String[] args) {
+ runTopology();
+ }
+
+ public static void runTopology() {
+ String filePath = "./src/main/resources/operations.txt";
+ TopologyBuilder builder = new TopologyBuilder();
+ builder.setSpout("randomNumberSpout", new RandomNumberSpout());
+ builder.setBolt("filteringBolt", new FilteringBolt()).shuffleGrouping("randomNumberSpout");
+ builder.setBolt("aggregatingBolt", new AggregatingBolt()
+ .withTimestampField("timestamp")
+ .withLag(BaseWindowedBolt.Duration.seconds(1))
+ .withWindow(BaseWindowedBolt.Duration.seconds(5))).shuffleGrouping("filteringBolt");
+ builder.setBolt("fileBolt", new FileWritingBolt(filePath)).shuffleGrouping("aggregatingBolt");
+
+ Config config = new Config();
+ config.setDebug(false);
+ LocalCluster cluster = new LocalCluster();
+ cluster.submitTopology("Test", config, builder.createTopology());
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/bolt/AggregatingBolt.java b/libraries-data/src/main/java/com/baeldung/storm/bolt/AggregatingBolt.java
new file mode 100644
index 0000000000..c7263cd8d5
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/bolt/AggregatingBolt.java
@@ -0,0 +1,39 @@
+package com.baeldung.storm.bolt;
+
+import org.apache.storm.task.OutputCollector;
+import org.apache.storm.task.TopologyContext;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.topology.base.BaseWindowedBolt;
+import org.apache.storm.tuple.Fields;
+import org.apache.storm.tuple.Tuple;
+import org.apache.storm.tuple.Values;
+import org.apache.storm.windowing.TupleWindow;
+
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+public class AggregatingBolt extends BaseWindowedBolt {
+ private OutputCollector outputCollector;
+ @Override
+ public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
+ this.outputCollector = collector;
+ }
+
+ @Override
+ public void declareOutputFields(OutputFieldsDeclarer declarer) {
+ declarer.declare(new Fields("sumOfOperations", "beginningTimestamp", "endTimestamp"));
+ }
+
+ @Override
+ public void execute(TupleWindow tupleWindow) {
+ List tuples = tupleWindow.get();
+ tuples.sort(Comparator.comparing(a -> a.getLongByField("timestamp")));
+ //This is safe since the window is calculated basing on Tuple's timestamp, thus it can't really be empty
+ Long beginningTimestamp = tuples.get(0).getLongByField("timestamp");
+ Long endTimestamp = tuples.get(tuples.size() - 1).getLongByField("timestamp");
+ int sumOfOperations = tuples.stream().mapToInt(tuple -> tuple.getIntegerByField("operation")).sum();
+ Values values = new Values(sumOfOperations, beginningTimestamp, endTimestamp);
+ outputCollector.emit(values);
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/bolt/FileWritingBolt.java b/libraries-data/src/main/java/com/baeldung/storm/bolt/FileWritingBolt.java
new file mode 100644
index 0000000000..339e0dc055
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/bolt/FileWritingBolt.java
@@ -0,0 +1,72 @@
+package com.baeldung.storm.bolt;
+
+import com.baeldung.storm.model.AggregatedWindow;
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.storm.task.OutputCollector;
+import org.apache.storm.task.TopologyContext;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.topology.base.BaseRichBolt;
+import org.apache.storm.tuple.Tuple;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Map;
+
+public class FileWritingBolt extends BaseRichBolt {
+ public static Logger logger = LoggerFactory.getLogger(FileWritingBolt.class);
+ private BufferedWriter writer;
+ private String filePath;
+ private ObjectMapper objectMapper;
+
+ @Override
+ public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
+ objectMapper = new ObjectMapper();
+ objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
+ try {
+ writer = new BufferedWriter(new FileWriter(filePath));
+ } catch (IOException e) {
+ logger.error("Failed to open a file for writing.", e);
+ }
+ }
+
+ @Override
+ public void execute(Tuple tuple) {
+ int sumOfOperations = tuple.getIntegerByField("sumOfOperations");
+ long beginningTimestamp = tuple.getLongByField("beginningTimestamp");
+ long endTimestamp = tuple.getLongByField("endTimestamp");
+
+ if(sumOfOperations > 200) {
+ AggregatedWindow aggregatedWindow = new AggregatedWindow(sumOfOperations, beginningTimestamp, endTimestamp);
+ try {
+ writer.write(objectMapper.writeValueAsString(aggregatedWindow));
+ writer.write("\n");
+ writer.flush();
+ } catch (IOException e) {
+ logger.error("Failed to write data to file.", e);
+ }
+ }
+ }
+
+ public FileWritingBolt(String filePath) {
+ this.filePath = filePath;
+ }
+
+ @Override
+ public void cleanup() {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ logger.error("Failed to close the writer!");
+ }
+ }
+
+ @Override
+ public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
+
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/bolt/FilteringBolt.java b/libraries-data/src/main/java/com/baeldung/storm/bolt/FilteringBolt.java
new file mode 100644
index 0000000000..564076a1df
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/bolt/FilteringBolt.java
@@ -0,0 +1,22 @@
+package com.baeldung.storm.bolt;
+
+import org.apache.storm.topology.BasicOutputCollector;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.topology.base.BaseBasicBolt;
+import org.apache.storm.tuple.Fields;
+import org.apache.storm.tuple.Tuple;
+
+public class FilteringBolt extends BaseBasicBolt {
+ @Override
+ public void execute(Tuple tuple, BasicOutputCollector basicOutputCollector) {
+ int operation = tuple.getIntegerByField("operation");
+ if(operation > 0 ) {
+ basicOutputCollector.emit(tuple.getValues());
+ }
+ }
+
+ @Override
+ public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
+ outputFieldsDeclarer.declare(new Fields("operation", "timestamp"));
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/bolt/PrintingBolt.java b/libraries-data/src/main/java/com/baeldung/storm/bolt/PrintingBolt.java
new file mode 100644
index 0000000000..efd2c9b1d9
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/bolt/PrintingBolt.java
@@ -0,0 +1,18 @@
+package com.baeldung.storm.bolt;
+
+import org.apache.storm.topology.BasicOutputCollector;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.topology.base.BaseBasicBolt;
+import org.apache.storm.tuple.Tuple;
+
+public class PrintingBolt extends BaseBasicBolt {
+ @Override
+ public void execute(Tuple tuple, BasicOutputCollector basicOutputCollector) {
+ System.out.println(tuple);
+ }
+
+ @Override
+ public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
+
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/model/AggregatedWindow.java b/libraries-data/src/main/java/com/baeldung/storm/model/AggregatedWindow.java
new file mode 100644
index 0000000000..beaf54d34c
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/model/AggregatedWindow.java
@@ -0,0 +1,16 @@
+package com.baeldung.storm.model;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize
+public class AggregatedWindow {
+ int sumOfOperations;
+ long beginningTimestamp;
+ long endTimestamp;
+
+ public AggregatedWindow(int sumOfOperations, long beginningTimestamp, long endTimestamp) {
+ this.sumOfOperations = sumOfOperations;
+ this.beginningTimestamp = beginningTimestamp;
+ this.endTimestamp = endTimestamp;
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/model/User.java b/libraries-data/src/main/java/com/baeldung/storm/model/User.java
new file mode 100644
index 0000000000..eafbf0e1eb
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/model/User.java
@@ -0,0 +1,40 @@
+package com.baeldung.storm.model;
+
+public class User {
+ private String username;
+ private String password;
+ private String email;
+ private int age;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/serialization/UserSerializer.java b/libraries-data/src/main/java/com/baeldung/storm/serialization/UserSerializer.java
new file mode 100644
index 0000000000..6199a203da
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/serialization/UserSerializer.java
@@ -0,0 +1,30 @@
+package com.baeldung.storm.serialization;
+
+
+import com.baeldung.storm.model.User;
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+
+public class UserSerializer extends Serializer{
+ @Override
+ public void write(Kryo kryo, Output output, User user) {
+ output.writeString(user.getEmail());
+ output.writeString(user.getUsername());
+ output.write(user.getAge());
+ }
+
+ @Override
+ public User read(Kryo kryo, Input input, Class aClass) {
+ User user = new User();
+ String email = input.readString();
+ String name = input.readString();
+ int age = input.read();
+ user.setAge(age);
+ user.setEmail(email);
+ user.setUsername(name);
+
+ return user;
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/spout/RandomIntSpout.java b/libraries-data/src/main/java/com/baeldung/storm/spout/RandomIntSpout.java
new file mode 100644
index 0000000000..4a8ef76598
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/spout/RandomIntSpout.java
@@ -0,0 +1,35 @@
+package com.baeldung.storm.spout;
+
+import org.apache.storm.spout.SpoutOutputCollector;
+import org.apache.storm.task.TopologyContext;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.topology.base.BaseRichSpout;
+import org.apache.storm.tuple.Fields;
+import org.apache.storm.tuple.Values;
+import org.apache.storm.utils.Utils;
+
+import java.util.Map;
+import java.util.Random;
+
+public class RandomIntSpout extends BaseRichSpout {
+
+ private Random random;
+ private SpoutOutputCollector outputCollector;
+
+ @Override
+ public void open(Map map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) {
+ random = new Random();
+ outputCollector = spoutOutputCollector;
+ }
+
+ @Override
+ public void nextTuple() {
+ Utils.sleep(1000);
+ outputCollector.emit(new Values(random.nextInt(), System.currentTimeMillis()));
+ }
+
+ @Override
+ public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
+ outputFieldsDeclarer.declare(new Fields("randomInt", "timestamp"));
+ }
+}
diff --git a/libraries-data/src/main/java/com/baeldung/storm/spout/RandomNumberSpout.java b/libraries-data/src/main/java/com/baeldung/storm/spout/RandomNumberSpout.java
new file mode 100644
index 0000000000..c9291cdc9d
--- /dev/null
+++ b/libraries-data/src/main/java/com/baeldung/storm/spout/RandomNumberSpout.java
@@ -0,0 +1,40 @@
+package com.baeldung.storm.spout;
+
+import org.apache.storm.spout.SpoutOutputCollector;
+import org.apache.storm.task.OutputCollector;
+import org.apache.storm.task.TopologyContext;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.topology.base.BaseRichSpout;
+import org.apache.storm.tuple.Fields;
+import org.apache.storm.tuple.Values;
+import org.apache.storm.utils.Utils;
+
+import java.util.Map;
+import java.util.Random;
+
+public class RandomNumberSpout extends BaseRichSpout {
+ private Random random;
+ private SpoutOutputCollector collector;
+
+ @Override
+ public void open(Map map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) {
+ random = new Random();
+ collector = spoutOutputCollector;
+ }
+
+ @Override
+ public void nextTuple() {
+ Utils.sleep(1000);
+ //This will select random int from the range (0, 100)
+ int operation = random.nextInt(101);
+ long timestamp = System.currentTimeMillis();
+
+ Values values = new Values(operation, timestamp);
+ collector.emit(values);
+ }
+
+ @Override
+ public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
+ outputFieldsDeclarer.declare(new Fields("operation", "timestamp"));
+ }
+}
diff --git a/libraries-security/README.md b/libraries-security/README.md
index c42e91a888..6923e0474e 100644
--- a/libraries-security/README.md
+++ b/libraries-security/README.md
@@ -1,3 +1,4 @@
### Relevant Articles:
- [Guide to ScribeJava](https://www.baeldung.com/scribejava)
+- [Guide to Passay](https://www.baeldung.com/java-passay)
diff --git a/maven-polyglot/README.md b/maven-polyglot/README.md
index 589315efd1..8635c8eddf 100644
--- a/maven-polyglot/README.md
+++ b/maven-polyglot/README.md
@@ -1,3 +1,4 @@
To run the maven-polyglot-json-app successfully, you first have to build the maven-polyglot-json-extension module using: mvn clean install.
-Related Articles:
+### Relevant Articles:
+- [Maven Polyglot](https://www.baeldung.com/maven-polyglot)
diff --git a/maven/README.md b/maven/README.md
index 2d838bcb76..970250d142 100644
--- a/maven/README.md
+++ b/maven/README.md
@@ -10,3 +10,6 @@
- [Build a Jar with Maven and Ignore the Test Results](http://www.baeldung.com/maven-ignore-test-results)
- [Maven Project with Multiple Source Directories](https://www.baeldung.com/maven-project-multiple-src-directories)
- [Integration Testing with Maven](https://www.baeldung.com/maven-integration-test)
+- [Apache Maven Standard Directory Layout](https://www.baeldung.com/maven-directory-structure)
+- [Apache Maven Tutorial](https://www.baeldung.com/maven)
+- [Use the Latest Version of a Dependency in Maven](https://www.baeldung.com/maven-dependency-latest-version)
diff --git a/parent-boot-1/pom.xml b/parent-boot-1/pom.xml
index d220b4a6b7..c61b791ef3 100644
--- a/parent-boot-1/pom.xml
+++ b/parent-boot-1/pom.xml
@@ -17,7 +17,7 @@
org.springframework.boot
spring-boot-dependencies
- 1.5.16.RELEASE
+ ${spring-boot.version}
pom
import
@@ -42,7 +42,7 @@
org.springframework.boot
spring-boot-maven-plugin
- 1.5.15.RELEASE
+ ${spring-boot.version}
@@ -50,6 +50,7 @@
3.1.0
+ 1.5.16.RELEASE
-
-
\ No newline at end of file
+
+
diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml
index de6cb5d068..bcfcfdec44 100644
--- a/parent-boot-2/pom.xml
+++ b/parent-boot-2/pom.xml
@@ -17,7 +17,7 @@
org.springframework.boot
spring-boot-dependencies
- 2.0.4.RELEASE
+ ${spring-boot.version}
pom
import
@@ -41,7 +41,7 @@
org.springframework.boot
spring-boot-maven-plugin
- 2.0.4.RELEASE
+ ${spring-boot.version}
@@ -73,6 +73,6 @@
3.1.0
1.0.11.RELEASE
+ 2.0.5.RELEASE
-
-
\ No newline at end of file
+
diff --git a/parent-spring-4/pom.xml b/parent-spring-4/pom.xml
index d1b1298013..9b3c42599b 100644
--- a/parent-spring-4/pom.xml
+++ b/parent-spring-4/pom.xml
@@ -29,7 +29,7 @@
- 4.3.17.RELEASE
+ 4.3.20.RELEASE
5.0.2
diff --git a/core-java-persistence/README.md b/persistence-modules/core-java-persistence/README.md
similarity index 100%
rename from core-java-persistence/README.md
rename to persistence-modules/core-java-persistence/README.md
diff --git a/core-java-persistence/pom.xml b/persistence-modules/core-java-persistence/pom.xml
similarity index 95%
rename from core-java-persistence/pom.xml
rename to persistence-modules/core-java-persistence/pom.xml
index 7279fd763b..f012d60ee6 100644
--- a/core-java-persistence/pom.xml
+++ b/persistence-modules/core-java-persistence/pom.xml
@@ -1,71 +1,71 @@
-
- 4.0.0
- com.baeldung.core-java-persistence
- core-java-persistence
- 0.1.0-SNAPSHOT
- jar
- core-java-persistence
-
- com.baeldung
- parent-java
- 0.0.1-SNAPSHOT
- ../parent-java
-
-
-
- org.assertj
- assertj-core
- ${assertj-core.version}
- test
-
-
- com.h2database
- h2
- ${h2database.version}
-
-
- org.apache.commons
- commons-dbcp2
- ${commons-dbcp2.version}
-
-
- com.zaxxer
- HikariCP
- ${HikariCP.version}
-
-
- com.mchange
- c3p0
- ${c3p0.version}
-
-
- org.springframework
- spring-web
- ${springframework.spring-web.version}
-
-
- org.springframework.boot
- spring-boot-starter
- ${springframework.boot.spring-boot-starter.version}
-
-
-
- core-java-persistence
-
-
- src/main/resources
- true
-
-
-
-
- 3.10.0
- 1.4.197
- 2.4.0
- 3.2.0
- 0.9.5.2
- 1.5.8.RELEASE
- 4.3.4.RELEASE
-
+
+ 4.0.0
+ com.baeldung.core-java-persistence
+ core-java-persistence
+ 0.1.0-SNAPSHOT
+ jar
+ core-java-persistence
+
+ com.baeldung
+ parent-java
+ 0.0.1-SNAPSHOT
+ ../../parent-java
+
+
+
+ org.assertj
+ assertj-core
+ ${assertj-core.version}
+ test
+
+
+ com.h2database
+ h2
+ ${h2database.version}
+
+
+ org.apache.commons
+ commons-dbcp2
+ ${commons-dbcp2.version}
+
+
+ com.zaxxer
+ HikariCP
+ ${HikariCP.version}
+
+
+ com.mchange
+ c3p0
+ ${c3p0.version}
+
+
+ org.springframework
+ spring-web
+ ${springframework.spring-web.version}
+
+
+ org.springframework.boot
+ spring-boot-starter
+ ${springframework.boot.spring-boot-starter.version}
+
+
+
+ core-java-persistence
+
+
+ src/main/resources
+ true
+
+
+
+
+ 3.10.0
+ 1.4.197
+ 2.4.0
+ 3.2.0
+ 0.9.5.2
+ 1.5.8.RELEASE
+ 4.3.4.RELEASE
+
\ No newline at end of file
diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java
diff --git a/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java
similarity index 100%
rename from core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java
rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java
diff --git a/influxdb/src/main/resources/logback.xml b/persistence-modules/core-java-persistence/src/main/resources/logback.xml
similarity index 100%
rename from influxdb/src/main/resources/logback.xml
rename to persistence-modules/core-java-persistence/src/main/resources/logback.xml
diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java
similarity index 97%
rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java
rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java
index 479cd0db25..3b3c9870fb 100644
--- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java
+++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java
@@ -1,67 +1,67 @@
-package com.baeldung.connectionpool;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class BasicConnectionPoolUnitTest {
-
- private static ConnectionPool connectionPool;
-
- @BeforeClass
- public static void setUpBasicConnectionPoolInstance() throws SQLException {
- connectionPool = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
- }
-
- @Test
- public void givenBasicConnectionPoolInstance_whenCalledgetConnection_thenCorrect() throws Exception {
- assertTrue(connectionPool.getConnection().isValid(1));
- }
-
- @Test
- public void givenBasicConnectionPoolInstance_whenCalledreleaseConnection_thenCorrect() throws Exception {
- Connection connection = connectionPool.getConnection();
- assertThat(connectionPool.releaseConnection(connection)).isTrue();
- }
-
- @Test
- public void givenBasicConnectionPoolInstance_whenCalledgetUrl_thenCorrect() {
- assertThat(connectionPool.getUrl()).isEqualTo("jdbc:h2:mem:test");
- }
-
- @Test
- public void givenBasicConnectionPoolInstance_whenCalledgetUser_thenCorrect() {
- assertThat(connectionPool.getUser()).isEqualTo("user");
- }
-
- @Test
- public void givenBasicConnectionPoolInstance_whenCalledgetPassword_thenCorrect() {
- assertThat(connectionPool.getPassword()).isEqualTo("password");
- }
-
- @Test(expected = RuntimeException.class)
- public void givenBasicConnectionPoolInstance_whenAskedForMoreThanMax_thenError() throws Exception {
- // this test needs to be independent so it doesn't share the same connection pool as other tests
- ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
- final int MAX_POOL_SIZE = 20;
- for (int i = 0; i < MAX_POOL_SIZE + 1; i++) {
- cp.getConnection();
- }
- fail();
- }
-
- @Test
- public void givenBasicConnectionPoolInstance_whenSutdown_thenEmpty() throws Exception {
- ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
- assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(10);
-
- ((BasicConnectionPool) cp).shutdown();
- assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(0);
- }
-}
+package com.baeldung.connectionpool;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class BasicConnectionPoolUnitTest {
+
+ private static ConnectionPool connectionPool;
+
+ @BeforeClass
+ public static void setUpBasicConnectionPoolInstance() throws SQLException {
+ connectionPool = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
+ }
+
+ @Test
+ public void givenBasicConnectionPoolInstance_whenCalledgetConnection_thenCorrect() throws Exception {
+ assertTrue(connectionPool.getConnection().isValid(1));
+ }
+
+ @Test
+ public void givenBasicConnectionPoolInstance_whenCalledreleaseConnection_thenCorrect() throws Exception {
+ Connection connection = connectionPool.getConnection();
+ assertThat(connectionPool.releaseConnection(connection)).isTrue();
+ }
+
+ @Test
+ public void givenBasicConnectionPoolInstance_whenCalledgetUrl_thenCorrect() {
+ assertThat(connectionPool.getUrl()).isEqualTo("jdbc:h2:mem:test");
+ }
+
+ @Test
+ public void givenBasicConnectionPoolInstance_whenCalledgetUser_thenCorrect() {
+ assertThat(connectionPool.getUser()).isEqualTo("user");
+ }
+
+ @Test
+ public void givenBasicConnectionPoolInstance_whenCalledgetPassword_thenCorrect() {
+ assertThat(connectionPool.getPassword()).isEqualTo("password");
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void givenBasicConnectionPoolInstance_whenAskedForMoreThanMax_thenError() throws Exception {
+ // this test needs to be independent so it doesn't share the same connection pool as other tests
+ ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
+ final int MAX_POOL_SIZE = 20;
+ for (int i = 0; i < MAX_POOL_SIZE + 1; i++) {
+ cp.getConnection();
+ }
+ fail();
+ }
+
+ @Test
+ public void givenBasicConnectionPoolInstance_whenSutdown_thenEmpty() throws Exception {
+ ConnectionPool cp = BasicConnectionPool.create("jdbc:h2:mem:test", "user", "password");
+ assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(10);
+
+ ((BasicConnectionPool) cp).shutdown();
+ assertThat(((BasicConnectionPool)cp).getSize()).isEqualTo(0);
+ }
+}
diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java
similarity index 96%
rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java
rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java
index a07fa9e74b..acad9fe5e4 100644
--- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java
+++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java
@@ -1,13 +1,13 @@
-package com.baeldung.connectionpool;
-
-import java.sql.SQLException;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-public class C3poDataSourceUnitTest {
-
- @Test
- public void givenC3poDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
- assertTrue(C3poDataSource.getConnection().isValid(1));
- }
+package com.baeldung.connectionpool;
+
+import java.sql.SQLException;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+public class C3poDataSourceUnitTest {
+
+ @Test
+ public void givenC3poDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
+ assertTrue(C3poDataSource.getConnection().isValid(1));
+ }
}
\ No newline at end of file
diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java
similarity index 96%
rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java
rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java
index 43aaf330b6..4882d2af73 100644
--- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java
+++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java
@@ -1,13 +1,13 @@
-package com.baeldung.connectionpool;
-
-import java.sql.SQLException;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-public class DBCPDataSourceUnitTest {
-
- @Test
- public void givenDBCPDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
- assertTrue(DBCPDataSource.getConnection().isValid(1));
- }
+package com.baeldung.connectionpool;
+
+import java.sql.SQLException;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+public class DBCPDataSourceUnitTest {
+
+ @Test
+ public void givenDBCPDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
+ assertTrue(DBCPDataSource.getConnection().isValid(1));
+ }
}
\ No newline at end of file
diff --git a/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java
similarity index 96%
rename from core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java
rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java
index b20ce70efd..885743ab2b 100644
--- a/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java
+++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java
@@ -1,13 +1,13 @@
-package com.baeldung.connectionpool;
-
-import java.sql.SQLException;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-public class HikariCPDataSourceUnitTest {
-
- @Test
- public void givenHikariDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
- assertTrue(HikariCPDataSource.getConnection().isValid(1));
- }
+package com.baeldung.connectionpool;
+
+import java.sql.SQLException;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+public class HikariCPDataSourceUnitTest {
+
+ @Test
+ public void givenHikariDataSourceClass_whenCalledgetConnection_thenCorrect() throws SQLException {
+ assertTrue(HikariCPDataSource.getConnection().isValid(1));
+ }
}
\ No newline at end of file
diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java
similarity index 100%
rename from core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java
rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java
diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java
similarity index 100%
rename from core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java
rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java
diff --git a/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java
similarity index 100%
rename from core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java
rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java
diff --git a/deltaspike/.gitignore b/persistence-modules/deltaspike/.gitignore
similarity index 100%
rename from deltaspike/.gitignore
rename to persistence-modules/deltaspike/.gitignore
diff --git a/deltaspike/README.md b/persistence-modules/deltaspike/README.md
similarity index 100%
rename from deltaspike/README.md
rename to persistence-modules/deltaspike/README.md
diff --git a/deltaspike/pom.xml b/persistence-modules/deltaspike/pom.xml
similarity index 99%
rename from deltaspike/pom.xml
rename to persistence-modules/deltaspike/pom.xml
index 8ab3e3fd80..b798d2f39e 100644
--- a/deltaspike/pom.xml
+++ b/persistence-modules/deltaspike/pom.xml
@@ -14,6 +14,7 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+ ../../
diff --git a/deltaspike/src/main/java/baeldung/controller/MemberController.java b/persistence-modules/deltaspike/src/main/java/baeldung/controller/MemberController.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/controller/MemberController.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/controller/MemberController.java
diff --git a/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java
diff --git a/deltaspike/src/main/java/baeldung/data/MemberListProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/MemberListProducer.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/MemberListProducer.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/MemberListProducer.java
diff --git a/deltaspike/src/main/java/baeldung/data/MemberRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/MemberRepository.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/MemberRepository.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/MemberRepository.java
diff --git a/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslRepositoryExtension.java
diff --git a/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/QueryDslSupport.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/QueryDslSupport.java
diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java
diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerResolver.java
diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SecondaryPersistenceUnit.java
diff --git a/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/SimpleUserRepository.java
diff --git a/deltaspike/src/main/java/baeldung/data/UserRepository.java b/persistence-modules/deltaspike/src/main/java/baeldung/data/UserRepository.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/data/UserRepository.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/data/UserRepository.java
diff --git a/deltaspike/src/main/java/baeldung/model/Address.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/Address.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/model/Address.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/model/Address.java
diff --git a/deltaspike/src/main/java/baeldung/model/Member.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/Member.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/model/Member.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/model/Member.java
diff --git a/deltaspike/src/main/java/baeldung/model/User.java b/persistence-modules/deltaspike/src/main/java/baeldung/model/User.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/model/User.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/model/User.java
diff --git a/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java b/persistence-modules/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java
diff --git a/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java b/persistence-modules/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java
diff --git a/deltaspike/src/main/java/baeldung/service/MemberRegistration.java b/persistence-modules/deltaspike/src/main/java/baeldung/service/MemberRegistration.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/service/MemberRegistration.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/service/MemberRegistration.java
diff --git a/deltaspike/src/main/java/baeldung/util/Resources.java b/persistence-modules/deltaspike/src/main/java/baeldung/util/Resources.java
similarity index 100%
rename from deltaspike/src/main/java/baeldung/util/Resources.java
rename to persistence-modules/deltaspike/src/main/java/baeldung/util/Resources.java
diff --git a/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties b/persistence-modules/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties
similarity index 100%
rename from deltaspike/src/main/resources/META-INF/apache-deltaspike.properties
rename to persistence-modules/deltaspike/src/main/resources/META-INF/apache-deltaspike.properties
diff --git a/deltaspike/src/main/resources/META-INF/beans.xml b/persistence-modules/deltaspike/src/main/resources/META-INF/beans.xml
similarity index 100%
rename from deltaspike/src/main/resources/META-INF/beans.xml
rename to persistence-modules/deltaspike/src/main/resources/META-INF/beans.xml
diff --git a/deltaspike/src/main/resources/META-INF/persistence.xml b/persistence-modules/deltaspike/src/main/resources/META-INF/persistence.xml
similarity index 100%
rename from deltaspike/src/main/resources/META-INF/persistence.xml
rename to persistence-modules/deltaspike/src/main/resources/META-INF/persistence.xml
diff --git a/deltaspike/src/main/resources/import.sql b/persistence-modules/deltaspike/src/main/resources/import.sql
similarity index 100%
rename from deltaspike/src/main/resources/import.sql
rename to persistence-modules/deltaspike/src/main/resources/import.sql
diff --git a/influxdb/src/test/resources/logback.xml b/persistence-modules/deltaspike/src/main/resources/logback.xml
similarity index 100%
rename from influxdb/src/test/resources/logback.xml
rename to persistence-modules/deltaspike/src/main/resources/logback.xml
diff --git a/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml
similarity index 100%
rename from deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml
rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-ds.xml
diff --git a/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml
similarity index 100%
rename from deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml
rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/baeldung-jee7-seed-secondary-ds.xml
diff --git a/deltaspike/src/main/webapp/WEB-INF/beans.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/beans.xml
similarity index 100%
rename from deltaspike/src/main/webapp/WEB-INF/beans.xml
rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/beans.xml
diff --git a/deltaspike/src/main/webapp/WEB-INF/faces-config.xml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/faces-config.xml
similarity index 100%
rename from deltaspike/src/main/webapp/WEB-INF/faces-config.xml
rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/faces-config.xml
diff --git a/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml b/persistence-modules/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml
similarity index 100%
rename from deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml
rename to persistence-modules/deltaspike/src/main/webapp/WEB-INF/templates/default.xhtml
diff --git a/deltaspike/src/main/webapp/index.html b/persistence-modules/deltaspike/src/main/webapp/index.html
similarity index 100%
rename from deltaspike/src/main/webapp/index.html
rename to persistence-modules/deltaspike/src/main/webapp/index.html
diff --git a/deltaspike/src/main/webapp/index.xhtml b/persistence-modules/deltaspike/src/main/webapp/index.xhtml
similarity index 100%
rename from deltaspike/src/main/webapp/index.xhtml
rename to persistence-modules/deltaspike/src/main/webapp/index.xhtml
diff --git a/deltaspike/src/main/webapp/resources/css/screen.css b/persistence-modules/deltaspike/src/main/webapp/resources/css/screen.css
similarity index 100%
rename from deltaspike/src/main/webapp/resources/css/screen.css
rename to persistence-modules/deltaspike/src/main/webapp/resources/css/screen.css
diff --git a/deltaspike/src/main/webapp/resources/gfx/asidebkg.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/asidebkg.png
similarity index 100%
rename from deltaspike/src/main/webapp/resources/gfx/asidebkg.png
rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/asidebkg.png
diff --git a/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png
similarity index 100%
rename from deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png
rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/bkg-blkheader.png
diff --git a/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png
similarity index 100%
rename from deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png
rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/dualbrand_logo.png
diff --git a/deltaspike/src/main/webapp/resources/gfx/headerbkg.png b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/headerbkg.png
similarity index 100%
rename from deltaspike/src/main/webapp/resources/gfx/headerbkg.png
rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/headerbkg.png
diff --git a/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg b/persistence-modules/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg
similarity index 100%
rename from deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg
rename to persistence-modules/deltaspike/src/main/webapp/resources/gfx/wildfly_400x130.jpg
diff --git a/deltaspike/src/test/java/baeldung/ValidatorProducer.java b/persistence-modules/deltaspike/src/test/java/baeldung/ValidatorProducer.java
similarity index 100%
rename from deltaspike/src/test/java/baeldung/ValidatorProducer.java
rename to persistence-modules/deltaspike/src/test/java/baeldung/ValidatorProducer.java
diff --git a/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java b/persistence-modules/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java
similarity index 100%
rename from deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java
rename to persistence-modules/deltaspike/src/test/java/baeldung/data/TestEntityManagerProducer.java
diff --git a/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java
similarity index 100%
rename from deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java
rename to persistence-modules/deltaspike/src/test/java/baeldung/test/MemberRegistrationLiveTest.java
diff --git a/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java
similarity index 100%
rename from deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java
rename to persistence-modules/deltaspike/src/test/java/baeldung/test/SimpleUserRepositoryUnitTest.java
diff --git a/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java b/persistence-modules/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java
similarity index 100%
rename from deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java
rename to persistence-modules/deltaspike/src/test/java/baeldung/test/UserRepositoryUnitTest.java
diff --git a/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties b/persistence-modules/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties
similarity index 100%
rename from deltaspike/src/test/resources/META-INF/apache-deltaspike.properties
rename to persistence-modules/deltaspike/src/test/resources/META-INF/apache-deltaspike.properties
diff --git a/deltaspike/src/test/resources/META-INF/beans.xml b/persistence-modules/deltaspike/src/test/resources/META-INF/beans.xml
similarity index 100%
rename from deltaspike/src/test/resources/META-INF/beans.xml
rename to persistence-modules/deltaspike/src/test/resources/META-INF/beans.xml
diff --git a/deltaspike/src/test/resources/META-INF/persistence.xml b/persistence-modules/deltaspike/src/test/resources/META-INF/persistence.xml
similarity index 100%
rename from deltaspike/src/test/resources/META-INF/persistence.xml
rename to persistence-modules/deltaspike/src/test/resources/META-INF/persistence.xml
diff --git a/deltaspike/src/test/resources/arquillian.xml b/persistence-modules/deltaspike/src/test/resources/arquillian.xml
similarity index 100%
rename from deltaspike/src/test/resources/arquillian.xml
rename to persistence-modules/deltaspike/src/test/resources/arquillian.xml
diff --git a/deltaspike/src/test/resources/import.sql b/persistence-modules/deltaspike/src/test/resources/import.sql
similarity index 100%
rename from deltaspike/src/test/resources/import.sql
rename to persistence-modules/deltaspike/src/test/resources/import.sql
diff --git a/deltaspike/src/test/resources/test-ds.xml b/persistence-modules/deltaspike/src/test/resources/test-ds.xml
similarity index 100%
rename from deltaspike/src/test/resources/test-ds.xml
rename to persistence-modules/deltaspike/src/test/resources/test-ds.xml
diff --git a/deltaspike/src/test/resources/test-secondary-ds.xml b/persistence-modules/deltaspike/src/test/resources/test-secondary-ds.xml
similarity index 100%
rename from deltaspike/src/test/resources/test-secondary-ds.xml
rename to persistence-modules/deltaspike/src/test/resources/test-secondary-ds.xml
diff --git a/influxdb/README.md b/persistence-modules/influxdb/README.md
similarity index 100%
rename from influxdb/README.md
rename to persistence-modules/influxdb/README.md
diff --git a/influxdb/pom.xml b/persistence-modules/influxdb/pom.xml
similarity index 96%
rename from influxdb/pom.xml
rename to persistence-modules/influxdb/pom.xml
index 5bb94bb6e2..5043d61897 100644
--- a/influxdb/pom.xml
+++ b/persistence-modules/influxdb/pom.xml
@@ -12,6 +12,7 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+ ../../
diff --git a/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java b/persistence-modules/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java
similarity index 100%
rename from influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java
rename to persistence-modules/influxdb/src/main/java/com/baeldung/influxdb/MemoryPoint.java
diff --git a/orientdb/src/main/resources/logback.xml b/persistence-modules/influxdb/src/main/resources/logback.xml
similarity index 100%
rename from orientdb/src/main/resources/logback.xml
rename to persistence-modules/influxdb/src/main/resources/logback.xml
diff --git a/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java b/persistence-modules/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java
similarity index 100%
rename from influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java
rename to persistence-modules/influxdb/src/test/java/com/baeldung/influxdb/InfluxDBConnectionLiveTest.java
diff --git a/spring-boot-persistence/src/main/resources/logback.xml b/persistence-modules/influxdb/src/test/resources/logback.xml
similarity index 100%
rename from spring-boot-persistence/src/main/resources/logback.xml
rename to persistence-modules/influxdb/src/test/resources/logback.xml
diff --git a/orientdb/.gitignore b/persistence-modules/orientdb/.gitignore
similarity index 100%
rename from orientdb/.gitignore
rename to persistence-modules/orientdb/.gitignore
diff --git a/orientdb/.mvn/wrapper/maven-wrapper.jar b/persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.jar
similarity index 100%
rename from orientdb/.mvn/wrapper/maven-wrapper.jar
rename to persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.jar
diff --git a/orientdb/.mvn/wrapper/maven-wrapper.properties b/persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.properties
similarity index 100%
rename from orientdb/.mvn/wrapper/maven-wrapper.properties
rename to persistence-modules/orientdb/.mvn/wrapper/maven-wrapper.properties
diff --git a/orientdb/README.md b/persistence-modules/orientdb/README.md
similarity index 100%
rename from orientdb/README.md
rename to persistence-modules/orientdb/README.md
diff --git a/orientdb/mvnw b/persistence-modules/orientdb/mvnw
old mode 100755
new mode 100644
similarity index 100%
rename from orientdb/mvnw
rename to persistence-modules/orientdb/mvnw
diff --git a/orientdb/mvnw.cmd b/persistence-modules/orientdb/mvnw.cmd
similarity index 100%
rename from orientdb/mvnw.cmd
rename to persistence-modules/orientdb/mvnw.cmd
diff --git a/orientdb/pom.xml b/persistence-modules/orientdb/pom.xml
similarity index 97%
rename from orientdb/pom.xml
rename to persistence-modules/orientdb/pom.xml
index e1c7ac42bb..e4bc9a0585 100644
--- a/orientdb/pom.xml
+++ b/persistence-modules/orientdb/pom.xml
@@ -12,6 +12,7 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+ ../../
diff --git a/orientdb/src/main/java/com/baeldung/orientdb/Author.java b/persistence-modules/orientdb/src/main/java/com/baeldung/orientdb/Author.java
similarity index 100%
rename from orientdb/src/main/java/com/baeldung/orientdb/Author.java
rename to persistence-modules/orientdb/src/main/java/com/baeldung/orientdb/Author.java
diff --git a/spring-data-jpa/src/main/resources/logback.xml b/persistence-modules/orientdb/src/main/resources/logback.xml
similarity index 100%
rename from spring-data-jpa/src/main/resources/logback.xml
rename to persistence-modules/orientdb/src/main/resources/logback.xml
diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java
similarity index 100%
rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java
rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBDocumentAPILiveTest.java
diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java
similarity index 100%
rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java
rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBGraphAPILiveTest.java
diff --git a/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java b/persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java
similarity index 100%
rename from orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java
rename to persistence-modules/orientdb/src/test/java/com/baeldung/orientdb/OrientDBObjectAPILiveTest.java
diff --git a/spring-boot-persistence/.gitignore b/persistence-modules/spring-boot-persistence/.gitignore
similarity index 89%
rename from spring-boot-persistence/.gitignore
rename to persistence-modules/spring-boot-persistence/.gitignore
index 88e3308e9d..da7c2c5c0a 100644
--- a/spring-boot-persistence/.gitignore
+++ b/persistence-modules/spring-boot-persistence/.gitignore
@@ -1,5 +1,5 @@
-/target/
-.settings/
-.classpath
-.project
-
+/target/
+.settings/
+.classpath
+.project
+
diff --git a/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties b/persistence-modules/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties
old mode 100755
new mode 100644
similarity index 100%
rename from spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties
rename to persistence-modules/spring-boot-persistence/.mvn/wrapper/maven-wrapper.properties
diff --git a/spring-boot-persistence/README.MD b/persistence-modules/spring-boot-persistence/README.MD
similarity index 100%
rename from spring-boot-persistence/README.MD
rename to persistence-modules/spring-boot-persistence/README.MD
diff --git a/spring-boot-persistence/mvnw b/persistence-modules/spring-boot-persistence/mvnw
old mode 100755
new mode 100644
similarity index 100%
rename from spring-boot-persistence/mvnw
rename to persistence-modules/spring-boot-persistence/mvnw
diff --git a/spring-boot-persistence/mvnw.cmd b/persistence-modules/spring-boot-persistence/mvnw.cmd
old mode 100755
new mode 100644
similarity index 97%
rename from spring-boot-persistence/mvnw.cmd
rename to persistence-modules/spring-boot-persistence/mvnw.cmd
index 4f0b068a03..6a6eec39ba
--- a/spring-boot-persistence/mvnw.cmd
+++ b/persistence-modules/spring-boot-persistence/mvnw.cmd
@@ -1,145 +1,145 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven2 Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven2 Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%
diff --git a/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml
similarity index 93%
rename from spring-boot-persistence/pom.xml
rename to persistence-modules/spring-boot-persistence/pom.xml
index 08989edfa9..b34e33e38a 100644
--- a/spring-boot-persistence/pom.xml
+++ b/persistence-modules/spring-boot-persistence/pom.xml
@@ -1,75 +1,75 @@
-
-
- 4.0.0
-
- com.baeldung
- spring-boot-persistence
- 0.1.0
-
-
- parent-boot-2
- com.baeldung
- 0.0.1-SNAPSHOT
- ../parent-boot-2
-
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- com.zaxxer
- HikariCP
-
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.apache.tomcat
- tomcat-jdbc
- ${tomcat-jdbc.version}
-
-
- mysql
- mysql-connector-java
- ${mysql-connector-java.version}
-
-
- com.h2database
- h2
- ${h2database.version}
- runtime
-
-
-
-
- UTF-8
- 1.8
- 8.0.12
- 9.0.10
- 1.4.197
-
-
-
- spring-boot-persistence
-
-
- src/main/resources
- true
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-boot-persistence
+ 0.1.0
+
+
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-2
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ com.zaxxer
+ HikariCP
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.apache.tomcat
+ tomcat-jdbc
+ ${tomcat-jdbc.version}
+
+
+ mysql
+ mysql-connector-java
+ ${mysql-connector-java.version}
+
+
+ com.h2database
+ h2
+ ${h2database.version}
+ runtime
+
+
+
+
+ UTF-8
+ 1.8
+ 8.0.12
+ 9.0.10
+ 1.4.197
+
+
+
+ spring-boot-persistence
+
+
+ src/main/resources
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/Application.java
similarity index 100%
rename from spring-boot-persistence/src/main/java/com/baeldung/Application.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/Application.java
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java
similarity index 100%
rename from spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java
similarity index 100%
rename from spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java
similarity index 100%
rename from spring-boot-persistence/src/main/java/com/baeldung/domain/User.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/domain/User.java
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java
similarity index 100%
rename from spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/repository/UserRepository.java
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java
similarity index 97%
rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java
index ff37442cd4..5be61b972f 100644
--- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java
+++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/SpringBootConsoleApplication.java
@@ -1,22 +1,22 @@
-package com.baeldung.tomcatconnectionpool.application;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-
-@SpringBootApplication
-@EnableAutoConfiguration
-@ComponentScan(basePackages={"com.baeldung.tomcatconnectionpool.application"})
-@EnableJpaRepositories(basePackages="com.baeldung.tomcatconnectionpool.application.repositories")
-@EnableTransactionManagement
-@EntityScan(basePackages="com.baeldung.tomcatconnectionpool.application.entities")
-public class SpringBootConsoleApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(SpringBootConsoleApplication.class);
- }
-}
+package com.baeldung.tomcatconnectionpool.application;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+@EnableAutoConfiguration
+@ComponentScan(basePackages={"com.baeldung.tomcatconnectionpool.application"})
+@EnableJpaRepositories(basePackages="com.baeldung.tomcatconnectionpool.application.repositories")
+@EnableTransactionManagement
+@EntityScan(basePackages="com.baeldung.tomcatconnectionpool.application.entities")
+public class SpringBootConsoleApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootConsoleApplication.class);
+ }
+}
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java
similarity index 95%
rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java
index 4003d5aca9..712506eb98 100644
--- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java
+++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/entities/Customer.java
@@ -1,53 +1,53 @@
-package com.baeldung.tomcatconnectionpool.application.entities;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "customers")
-public class Customer {
-
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- private long id;
- @Column(name = "first_name")
- private String firstName;
- @Column(name = "last_name")
- private String lastName;
-
- public Customer() {}
-
- public Customer(String firstName, String lastName) {
- this.firstName = firstName;
- this.lastName = lastName;
- }
-
- public long getId() {
- return id;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- @Override
- public String toString() {
- return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + '}';
- }
-}
+package com.baeldung.tomcatconnectionpool.application.entities;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "customers")
+public class Customer {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private long id;
+ @Column(name = "first_name")
+ private String firstName;
+ @Column(name = "last_name")
+ private String lastName;
+
+ public Customer() {}
+
+ public Customer(String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ @Override
+ public String toString() {
+ return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + '}';
+ }
+}
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java
similarity index 97%
rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java
index 770906439c..c461243cf8 100644
--- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java
+++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/repositories/CustomerRepository.java
@@ -1,12 +1,12 @@
-package com.baeldung.tomcatconnectionpool.application.repositories;
-
-import com.baeldung.tomcatconnectionpool.application.entities.Customer;
-import java.util.List;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface CustomerRepository extends CrudRepository {
-
- List findByLastName(String lastName);
-}
+package com.baeldung.tomcatconnectionpool.application.repositories;
+
+import com.baeldung.tomcatconnectionpool.application.entities.Customer;
+import java.util.List;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CustomerRepository extends CrudRepository {
+
+ List findByLastName(String lastName);
+}
diff --git a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java
similarity index 97%
rename from spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java
rename to persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java
index 9666bac5a5..722c7582a1 100644
--- a/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java
+++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/tomcatconnectionpool/application/runners/CommandLineCrudRunner.java
@@ -1,37 +1,37 @@
-package com.baeldung.tomcatconnectionpool.application.runners;
-
-import com.baeldung.tomcatconnectionpool.application.entities.Customer;
-import com.baeldung.tomcatconnectionpool.application.repositories.CustomerRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.stereotype.Component;
-
-@Component
-public class CommandLineCrudRunner implements CommandLineRunner {
-
- private static final Logger logger = LoggerFactory.getLogger(CommandLineCrudRunner.class);
-
- @Autowired
- private CustomerRepository customerRepository;
-
- @Override
- public void run(String... args) throws Exception {
- customerRepository.save(new Customer("John", "Doe"));
- customerRepository.save(new Customer("Jennifer", "Wilson"));
-
- logger.info("Customers found with findAll():");
- customerRepository.findAll().forEach(c -> logger.info(c.toString()));
-
- logger.info("Customer found with findById(1L):");
- Customer customer = customerRepository.findById(1L)
- .orElseGet(() -> new Customer("Non-existing customer", ""));
- logger.info(customer.toString());
-
- logger.info("Customer found with findByLastName('Wilson'):");
- customerRepository.findByLastName("Wilson").forEach(c -> {
- logger.info(c.toString());
- });
- }
-}
+package com.baeldung.tomcatconnectionpool.application.runners;
+
+import com.baeldung.tomcatconnectionpool.application.entities.Customer;
+import com.baeldung.tomcatconnectionpool.application.repositories.CustomerRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CommandLineCrudRunner implements CommandLineRunner {
+
+ private static final Logger logger = LoggerFactory.getLogger(CommandLineCrudRunner.class);
+
+ @Autowired
+ private CustomerRepository customerRepository;
+
+ @Override
+ public void run(String... args) throws Exception {
+ customerRepository.save(new Customer("John", "Doe"));
+ customerRepository.save(new Customer("Jennifer", "Wilson"));
+
+ logger.info("Customers found with findAll():");
+ customerRepository.findAll().forEach(c -> logger.info(c.toString()));
+
+ logger.info("Customer found with findById(1L):");
+ Customer customer = customerRepository.findById(1L)
+ .orElseGet(() -> new Customer("Non-existing customer", ""));
+ logger.info(customer.toString());
+
+ logger.info("Customer found with findByLastName('Wilson'):");
+ customerRepository.findByLastName("Wilson").forEach(c -> {
+ logger.info(c.toString());
+ });
+ }
+}
diff --git a/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java b/persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java
similarity index 100%
rename from spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java
rename to persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java
diff --git a/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java b/persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java
similarity index 100%
rename from spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java
rename to persistence-modules/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java
diff --git a/spring-boot-persistence/src/main/resources/application.properties b/persistence-modules/spring-boot-persistence/src/main/resources/application.properties
similarity index 100%
rename from spring-boot-persistence/src/main/resources/application.properties
rename to persistence-modules/spring-boot-persistence/src/main/resources/application.properties
diff --git a/spring-boot-persistence/src/main/resources/data.sql b/persistence-modules/spring-boot-persistence/src/main/resources/data.sql
similarity index 100%
rename from spring-boot-persistence/src/main/resources/data.sql
rename to persistence-modules/spring-boot-persistence/src/main/resources/data.sql
diff --git a/spring-data-keyvalue/src/main/resources/logback.xml b/persistence-modules/spring-boot-persistence/src/main/resources/logback.xml
similarity index 100%
rename from spring-data-keyvalue/src/main/resources/logback.xml
rename to persistence-modules/spring-boot-persistence/src/main/resources/logback.xml
diff --git a/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties b/persistence-modules/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties
similarity index 100%
rename from spring-boot-persistence/src/main/resources/persistence-generic-entity.properties
rename to persistence-modules/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties
diff --git a/spring-boot-persistence/src/main/resources/schema.sql b/persistence-modules/spring-boot-persistence/src/main/resources/schema.sql
similarity index 100%
rename from spring-boot-persistence/src/main/resources/schema.sql
rename to persistence-modules/spring-boot-persistence/src/main/resources/schema.sql
diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java
similarity index 100%
rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java
rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java
diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java
similarity index 100%
rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java
rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java
diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java
similarity index 100%
rename from spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java
rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java
diff --git a/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java
similarity index 100%
rename from spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java
rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/repository/UserRepositoryIntegrationTest.java
diff --git a/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java
similarity index 97%
rename from spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java
rename to persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java
index c68e137fb0..eb000bbc09 100644
--- a/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java
+++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/tomcatconnectionpool/test/application/SpringBootTomcatConnectionPoolIntegrationTest.java
@@ -1,22 +1,22 @@
-package com.baeldung.tomcatconnectionpool.test.application;
-
-import javax.sql.DataSource;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.junit4.SpringRunner;
-import static org.assertj.core.api.Assertions.*;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class SpringBootTomcatConnectionPoolIntegrationTest {
-
- @Autowired
- private DataSource dataSource;
-
- @Test
- public void givenTomcatConnectionPoolInstance_whenCheckedPoolClassName_thenCorrect() {
- assertThat(dataSource.getClass().getName()).isEqualTo("org.apache.tomcat.jdbc.pool.DataSource");
- }
-}
+package com.baeldung.tomcatconnectionpool.test.application;
+
+import javax.sql.DataSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.junit4.SpringRunner;
+import static org.assertj.core.api.Assertions.*;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class SpringBootTomcatConnectionPoolIntegrationTest {
+
+ @Autowired
+ private DataSource dataSource;
+
+ @Test
+ public void givenTomcatConnectionPoolInstance_whenCheckedPoolClassName_thenCorrect() {
+ assertThat(dataSource.getClass().getName()).isEqualTo("org.apache.tomcat.jdbc.pool.DataSource");
+ }
+}
diff --git a/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java b/persistence-modules/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java
similarity index 100%
rename from spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java
rename to persistence-modules/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java
diff --git a/spring-boot-persistence/src/test/resources/application.properties b/persistence-modules/spring-boot-persistence/src/test/resources/application.properties
similarity index 100%
rename from spring-boot-persistence/src/test/resources/application.properties
rename to persistence-modules/spring-boot-persistence/src/test/resources/application.properties
diff --git a/spring-boot-persistence/src/test/resources/import_active_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/import_active_users.sql
similarity index 100%
rename from spring-boot-persistence/src/test/resources/import_active_users.sql
rename to persistence-modules/spring-boot-persistence/src/test/resources/import_active_users.sql
diff --git a/spring-boot-persistence/src/test/resources/import_inactive_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/import_inactive_users.sql
similarity index 100%
rename from spring-boot-persistence/src/test/resources/import_inactive_users.sql
rename to persistence-modules/spring-boot-persistence/src/test/resources/import_inactive_users.sql
diff --git a/spring-boot-persistence/src/test/resources/migrated_users.sql b/persistence-modules/spring-boot-persistence/src/test/resources/migrated_users.sql
similarity index 100%
rename from spring-boot-persistence/src/test/resources/migrated_users.sql
rename to persistence-modules/spring-boot-persistence/src/test/resources/migrated_users.sql
diff --git a/spring-data-elasticsearch/README.md b/persistence-modules/spring-data-elasticsearch/README.md
similarity index 100%
rename from spring-data-elasticsearch/README.md
rename to persistence-modules/spring-data-elasticsearch/README.md
diff --git a/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml
similarity index 98%
rename from spring-data-elasticsearch/pom.xml
rename to persistence-modules/spring-data-elasticsearch/pom.xml
index 99d8a70807..ee9e71a1cb 100644
--- a/spring-data-elasticsearch/pom.xml
+++ b/persistence-modules/spring-data-elasticsearch/pom.xml
@@ -11,7 +11,7 @@
com.baeldung
parent-spring-5
0.0.1-SNAPSHOT
- ../parent-spring-5
+ ../../parent-spring-5
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java
similarity index 100%
rename from spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java
rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/elasticsearch/Person.java
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java
similarity index 100%
rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java
rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java
similarity index 100%
rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java
rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java
similarity index 100%
rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java
rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java
similarity index 100%
rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java
rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java
similarity index 100%
rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java
rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java
diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java b/persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java
similarity index 100%
rename from spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java
rename to persistence-modules/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java
diff --git a/spring-data-elasticsearch/src/main/resources/log4j2.properties b/persistence-modules/spring-data-elasticsearch/src/main/resources/log4j2.properties
similarity index 100%
rename from spring-data-elasticsearch/src/main/resources/log4j2.properties
rename to persistence-modules/spring-data-elasticsearch/src/main/resources/log4j2.properties
diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java
similarity index 100%
rename from spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java
rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java
diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java
similarity index 100%
rename from spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java
rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java
diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java
similarity index 100%
rename from spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java
rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java
diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java
similarity index 100%
rename from spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java
rename to persistence-modules/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java
diff --git a/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 100%
rename from spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
rename to persistence-modules/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
diff --git a/spring-data-jpa/README.md b/persistence-modules/spring-data-jpa/README.md
similarity index 100%
rename from spring-data-jpa/README.md
rename to persistence-modules/spring-data-jpa/README.md
diff --git a/spring-data-jpa/pom.xml b/persistence-modules/spring-data-jpa/pom.xml
similarity index 96%
rename from spring-data-jpa/pom.xml
rename to persistence-modules/spring-data-jpa/pom.xml
index 8691ce1f09..643210ab89 100644
--- a/spring-data-jpa/pom.xml
+++ b/persistence-modules/spring-data-jpa/pom.xml
@@ -2,15 +2,16 @@
+ 4.0.0
+ com.baeldung
+ spring-data-jpa
+
parent-boot-2
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../../parent-boot-2
- 4.0.0
-
- spring-data-jpa
diff --git a/spring-data-jpa/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/Application.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/Application.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/Application.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceProductConfiguration.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceUserConfiguration.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/IFooDao.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ArticleRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/CustomItemTypeRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ExtendedStudentRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/IBarCrudRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/InventoryRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ItemTypeRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/LocationRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/ReadOnlyLocationRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/StoreRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemRepositoryImpl.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/CustomItemTypeRepositoryImpl.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/impl/ExtendedRepositoryImpl.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/product/ProductRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/PossessionRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/dao/repositories/user/UserRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate2Repository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/Aggregate3Repository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/AggregateRepository.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DddConfig.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainEvent.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/ddd/event/DomainService.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/Article.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Article.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Bar.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Foo.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java
similarity index 94%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/Item.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java
index 97ce14d92d..1e58fb25ba 100644
--- a/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java
+++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java
@@ -1,81 +1,81 @@
-package com.baeldung.domain;
-
-import java.math.BigDecimal;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-
-@Entity
-public class Item {
-
- private String color;
- private String grade;
-
- @Id
- private Long id;
-
- @ManyToOne
- private ItemType itemType;
-
- private String name;
- private BigDecimal price;
- @ManyToOne
- private Store store;
-
- public String getColor() {
- return color;
- }
-
- public String getGrade() {
- return grade;
- }
-
- public Long getId() {
- return id;
- }
-
- public ItemType getItemType() {
- return itemType;
- }
-
- public String getName() {
- return name;
- }
-
- public BigDecimal getPrice() {
- return price;
- }
-
- public Store getStore() {
- return store;
- }
-
- public void setColor(String color) {
- this.color = color;
- }
-
- public void setGrade(String grade) {
- this.grade = grade;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public void setItemType(ItemType itemType) {
- this.itemType = itemType;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setPrice(BigDecimal price) {
- this.price = price;
- }
-
- public void setStore(Store store) {
- this.store = store;
- }
-}
+package com.baeldung.domain;
+
+import java.math.BigDecimal;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+@Entity
+public class Item {
+
+ private String color;
+ private String grade;
+
+ @Id
+ private Long id;
+
+ @ManyToOne
+ private ItemType itemType;
+
+ private String name;
+ private BigDecimal price;
+ @ManyToOne
+ private Store store;
+
+ public String getColor() {
+ return color;
+ }
+
+ public String getGrade() {
+ return grade;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public ItemType getItemType() {
+ return itemType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public Store getStore() {
+ return store;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public void setGrade(String grade) {
+ this.grade = grade;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public void setItemType(ItemType itemType) {
+ this.itemType = itemType;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public void setStore(Store store) {
+ this.store = store;
+ }
+}
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java
similarity index 94%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java
index 412079c2ae..b0349e0471 100644
--- a/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java
+++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java
@@ -1,46 +1,46 @@
-package com.baeldung.domain;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToMany;
-
-@Entity
-public class ItemType {
-
- @Id
- private Long id;
- @OneToMany(cascade = CascadeType.ALL)
- @JoinColumn(name = "ITEM_TYPE_ID")
- private List- items = new ArrayList<>();
-
- private String name;
-
- public Long getId() {
- return id;
- }
-
- public List
- getItems() {
- return items;
- }
-
- public String getName() {
- return name;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
+package com.baeldung.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+
+@Entity
+public class ItemType {
+
+ @Id
+ private Long id;
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinColumn(name = "ITEM_TYPE_ID")
+ private List
- items = new ArrayList<>();
+
+ private String name;
+
+ public Long getId() {
+ return id;
+ }
+
+ public List
- getItems() {
+ return items;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public void setItems(List
- items) {
+ this.items = items;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/KVTag.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java
similarity index 95%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/Location.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java
index 2178d378eb..4ca7295986 100644
--- a/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java
+++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java
@@ -1,55 +1,55 @@
-package com.baeldung.domain;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToMany;
-
-@Entity
-public class Location {
-
- private String city;
- private String country;
- @Id
- private Long id;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinColumn(name = "LOCATION_ID")
- private List stores = new ArrayList<>();
-
- public String getCity() {
- return city;
- }
-
- public String getCountry() {
- return country;
- }
-
- public Long getId() {
- return id;
- }
-
- public List getStores() {
- return stores;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public void setStores(List stores) {
- this.stores = stores;
- }
-}
+package com.baeldung.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+
+@Entity
+public class Location {
+
+ private String city;
+ private String country;
+ @Id
+ private Long id;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinColumn(name = "LOCATION_ID")
+ private List stores = new ArrayList<>();
+
+ public String getCity() {
+ return city;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public List getStores() {
+ return stores;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public void setStores(List stores) {
+ this.stores = stores;
+ }
+}
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/MerchandiseEntity.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/SkillTag.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java
similarity index 95%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/Store.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java
index e04684c479..4172051c71 100644
--- a/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java
+++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java
@@ -1,76 +1,76 @@
-package com.baeldung.domain;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-
-@Entity
-public class Store {
-
- private Boolean active;
- @Id
- private Long id;
- @OneToMany(cascade = CascadeType.ALL)
- @JoinColumn(name = "STORE_ID")
- private List
- items = new ArrayList<>();
- private Long itemsSold;
-
- @ManyToOne
- private Location location;
-
- private String name;
-
- public Boolean getActive() {
- return active;
- }
-
- public Long getId() {
- return id;
- }
-
- public List
- getItems() {
- return items;
- }
-
- public Long getItemsSold() {
- return itemsSold;
- }
-
- public Location getLocation() {
- return location;
- }
-
- public String getName() {
- return name;
- }
-
- public void setActive(Boolean active) {
- this.active = active;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-
- public void setItemsSold(Long itemsSold) {
- this.itemsSold = itemsSold;
- }
-
- public void setLocation(Location location) {
- this.location = location;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
+package com.baeldung.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+
+@Entity
+public class Store {
+
+ private Boolean active;
+ @Id
+ private Long id;
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinColumn(name = "STORE_ID")
+ private List
- items = new ArrayList<>();
+ private Long itemsSold;
+
+ @ManyToOne
+ private Location location;
+
+ private String name;
+
+ public Boolean getActive() {
+ return active;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public List
- getItems() {
+ return items;
+ }
+
+ public Long getItemsSold() {
+ return itemsSold;
+ }
+
+ public Location getLocation() {
+ return location;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setActive(Boolean active) {
+ this.active = active;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public void setItems(List
- items) {
+ this.items = items;
+ }
+
+ public void setItemsSold(Long itemsSold) {
+ this.itemsSold = itemsSold;
+ }
+
+ public void setLocation(Location location) {
+ this.location = location;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/Student.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/Student.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/product/Product.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/Possession.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/domain/user/User.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IBarService.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IFooService.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/IOperations.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractService.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/AbstractSpringDataJpaService.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/BarSpringDataJpaService.java
diff --git a/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java
similarity index 100%
rename from spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java
rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/services/impl/FooService.java
diff --git a/spring-data-jpa/src/main/resources/application.properties b/persistence-modules/spring-data-jpa/src/main/resources/application.properties
similarity index 100%
rename from spring-data-jpa/src/main/resources/application.properties
rename to persistence-modules/spring-data-jpa/src/main/resources/application.properties
diff --git a/spring-data-jpa/src/main/resources/ddd.properties b/persistence-modules/spring-data-jpa/src/main/resources/ddd.properties
similarity index 100%
rename from spring-data-jpa/src/main/resources/ddd.properties
rename to persistence-modules/spring-data-jpa/src/main/resources/ddd.properties
diff --git a/spring-hibernate3/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa/src/main/resources/logback.xml
similarity index 100%
rename from spring-hibernate3/src/main/resources/logback.xml
rename to persistence-modules/spring-data-jpa/src/main/resources/logback.xml
diff --git a/spring-data-jpa/src/main/resources/persistence-multiple-db.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties
similarity index 100%
rename from spring-data-jpa/src/main/resources/persistence-multiple-db.properties
rename to persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties
diff --git a/spring-data-jpa/src/main/resources/persistence.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence.properties
similarity index 100%
rename from spring-data-jpa/src/main/resources/persistence.properties
rename to persistence-modules/spring-data-jpa/src/main/resources/persistence.properties
diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ArticleRepositoryIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/ExtendedStudentRepositoryIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/InventoryRepositoryIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/JpaRepositoriesIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/dao/repositories/UserRepositoryIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate2EventsIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/Aggregate3EventsIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/AggregateEventsIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/ddd/event/TestEventHandler.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/AbstractServicePersistenceIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/FooServicePersistenceIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/JpaMultipleDBIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/services/SpringDataJPABarAuditIntegrationTest.java
diff --git a/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java
similarity index 100%
rename from spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java
rename to persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java
diff --git a/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 100%
rename from spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java
rename to persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java
diff --git a/spring-data-jpa/src/test/resources/import_entities.sql b/persistence-modules/spring-data-jpa/src/test/resources/import_entities.sql
similarity index 100%
rename from spring-data-jpa/src/test/resources/import_entities.sql
rename to persistence-modules/spring-data-jpa/src/test/resources/import_entities.sql
diff --git a/spring-data-keyvalue/README.md b/persistence-modules/spring-data-keyvalue/README.md
similarity index 100%
rename from spring-data-keyvalue/README.md
rename to persistence-modules/spring-data-keyvalue/README.md
diff --git a/spring-data-keyvalue/pom.xml b/persistence-modules/spring-data-keyvalue/pom.xml
similarity index 94%
rename from spring-data-keyvalue/pom.xml
rename to persistence-modules/spring-data-keyvalue/pom.xml
index edd8967b97..6675595f2b 100644
--- a/spring-data-keyvalue/pom.xml
+++ b/persistence-modules/spring-data-keyvalue/pom.xml
@@ -7,7 +7,7 @@
parent-boot-2
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../../parent-boot-2
diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java
similarity index 100%
rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java
rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/Configurations.java
diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java
similarity index 100%
rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java
rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/SpringDataKeyValueApplication.java
diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java
similarity index 100%
rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java
rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/repositories/EmployeeRepository.java
diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java
similarity index 100%
rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java
rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/EmployeeService.java
diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java
similarity index 100%
rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java
rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithKeyValueTemplate.java
diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java
similarity index 100%
rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java
rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/services/impl/EmployeeServicesWithRepository.java
diff --git a/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java b/persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java
similarity index 100%
rename from spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java
rename to persistence-modules/spring-data-keyvalue/src/main/java/com/baeldung/spring/data/keyvalue/vo/Employee.java
diff --git a/persistence-modules/spring-data-keyvalue/src/main/resources/logback.xml b/persistence-modules/spring-data-keyvalue/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/persistence-modules/spring-data-keyvalue/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/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java
similarity index 100%
rename from spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java
rename to persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithKeyValueRepositoryIntegrationTest.java
diff --git a/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java
similarity index 100%
rename from spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java
rename to persistence-modules/spring-data-keyvalue/src/test/java/com/baeldung/spring/data/keyvalue/services/test/EmployeeServicesWithRepositoryIntegrationTest.java
diff --git a/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 100%
rename from spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java
rename to persistence-modules/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java
diff --git a/spring-data-mongodb/README.md b/persistence-modules/spring-data-mongodb/README.md
similarity index 89%
rename from spring-data-mongodb/README.md
rename to persistence-modules/spring-data-mongodb/README.md
index 4e12a2218a..c7bc7584be 100644
--- a/spring-data-mongodb/README.md
+++ b/persistence-modules/spring-data-mongodb/README.md
@@ -11,3 +11,4 @@
- [Introduction to Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-tutorial)
- [Spring Data MongoDB: Projections and Aggregations](http://www.baeldung.com/spring-data-mongodb-projections-aggregations)
- [Spring Data Annotations](http://www.baeldung.com/spring-data-annotations)
+- [Spring Data MongoDB Transactions](https://www.baeldung.com/spring-data-mongodb-transactions )
diff --git a/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml
similarity index 98%
rename from spring-data-mongodb/pom.xml
rename to persistence-modules/spring-data-mongodb/pom.xml
index 072ed7a2ac..466acf5a43 100644
--- a/spring-data-mongodb/pom.xml
+++ b/persistence-modules/spring-data-mongodb/pom.xml
@@ -10,7 +10,7 @@
com.baeldung
parent-spring-5
0.0.1-SNAPSHOT
- ../parent-spring-5
+ ../../parent-spring-5
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/annotation/CascadeSave.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/converter/UserWriterConverter.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeCallback.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/CascadeSaveMongoEventListener.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/FieldCallback.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/event/UserCascadeSaveMongoEventListener.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/EmailAddress.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/model/User.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/User.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/model/User.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/model/User.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java
similarity index 100%
rename from spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java
rename to persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java
diff --git a/spring-data-mongodb/src/main/resources/logback.xml b/persistence-modules/spring-data-mongodb/src/main/resources/logback.xml
similarity index 100%
rename from spring-data-mongodb/src/main/resources/logback.xml
rename to persistence-modules/spring-data-mongodb/src/main/resources/logback.xml
diff --git a/spring-data-mongodb/src/main/resources/mongoConfig.xml b/persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml
similarity index 100%
rename from spring-data-mongodb/src/main/resources/mongoConfig.xml
rename to persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml
diff --git a/spring-data-mongodb/src/main/resources/test.png b/persistence-modules/spring-data-mongodb/src/main/resources/test.png
similarity index 100%
rename from spring-data-mongodb/src/main/resources/test.png
rename to persistence-modules/spring-data-mongodb/src/main/resources/test.png
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/model/StatePopulation.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/BaseQueryLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/DSLQueryLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/JSONQueryLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/QueryMethodsLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryProjectionLiveTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java
diff --git a/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 100%
rename from spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java
rename to persistence-modules/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java
diff --git a/spring-data-mongodb/src/test/resources/zips.json b/persistence-modules/spring-data-mongodb/src/test/resources/zips.json
similarity index 100%
rename from spring-data-mongodb/src/test/resources/zips.json
rename to persistence-modules/spring-data-mongodb/src/test/resources/zips.json
diff --git a/spring-hibernate3/README.md b/persistence-modules/spring-hibernate3/README.md
similarity index 100%
rename from spring-hibernate3/README.md
rename to persistence-modules/spring-hibernate3/README.md
diff --git a/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java b/persistence-modules/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java
similarity index 97%
rename from spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java
rename to persistence-modules/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java
index a128d8848c..f38da21dc0 100644
--- a/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java
+++ b/persistence-modules/spring-hibernate3/src/main/java/org/baeldung/spring/PersistenceConfigHibernate3.java
@@ -1,81 +1,81 @@
-package org.baeldung.spring;
-
-import java.util.Properties;
-
-import javax.sql.DataSource;
-
-import org.apache.tomcat.dbcp.dbcp2.BasicDataSource;
-import org.hibernate.SessionFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.core.env.Environment;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
-import org.springframework.orm.hibernate3.HibernateTransactionManager;
-import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-
-import com.google.common.base.Preconditions;
-
-@Configuration
-@EnableTransactionManagement
-@PropertySource({ "classpath:persistence-h2.properties" })
-@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" })
-public class PersistenceConfigHibernate3 {
-
- @Autowired
- private Environment env;
-
- public PersistenceConfigHibernate3() {
- super();
- }
-
- @Bean
- public LocalSessionFactoryBean sessionFactory() {
- final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
- Resource config = new ClassPathResource("exceptionDemo.cfg.xml");
- sessionFactory.setDataSource(dataSource());
- sessionFactory.setConfigLocation(config);
- sessionFactory.setHibernateProperties(hibernateProperties());
-
- return sessionFactory;
- }
-
- @Bean
- public DataSource dataSource() {
- final BasicDataSource dataSource = new BasicDataSource();
- dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName")));
- dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url")));
- dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user")));
- dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass")));
-
- return dataSource;
- }
-
- @Bean
- @Autowired
- public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) {
- final HibernateTransactionManager txManager = new HibernateTransactionManager();
- txManager.setSessionFactory(sessionFactory);
-
- return txManager;
- }
-
- @Bean
- public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
- return new PersistenceExceptionTranslationPostProcessor();
- }
-
- final Properties hibernateProperties() {
- final Properties hibernateProperties = new Properties();
- hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
- hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
- // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
- return hibernateProperties;
- }
-
-}
+package org.baeldung.spring;
+
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import org.apache.tomcat.dbcp.dbcp2.BasicDataSource;
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
+import org.springframework.orm.hibernate3.HibernateTransactionManager;
+import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import com.google.common.base.Preconditions;
+
+@Configuration
+@EnableTransactionManagement
+@PropertySource({ "classpath:persistence-h2.properties" })
+@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" })
+public class PersistenceConfigHibernate3 {
+
+ @Autowired
+ private Environment env;
+
+ public PersistenceConfigHibernate3() {
+ super();
+ }
+
+ @Bean
+ public LocalSessionFactoryBean sessionFactory() {
+ final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
+ Resource config = new ClassPathResource("exceptionDemo.cfg.xml");
+ sessionFactory.setDataSource(dataSource());
+ sessionFactory.setConfigLocation(config);
+ sessionFactory.setHibernateProperties(hibernateProperties());
+
+ return sessionFactory;
+ }
+
+ @Bean
+ public DataSource dataSource() {
+ final BasicDataSource dataSource = new BasicDataSource();
+ dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName")));
+ dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url")));
+ dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user")));
+ dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass")));
+
+ return dataSource;
+ }
+
+ @Bean
+ @Autowired
+ public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) {
+ final HibernateTransactionManager txManager = new HibernateTransactionManager();
+ txManager.setSessionFactory(sessionFactory);
+
+ return txManager;
+ }
+
+ @Bean
+ public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
+ return new PersistenceExceptionTranslationPostProcessor();
+ }
+
+ final Properties hibernateProperties() {
+ final Properties hibernateProperties = new Properties();
+ hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
+ hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
+ // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
+ return hibernateProperties;
+ }
+
+}
diff --git a/persistence-modules/spring-hibernate3/src/main/resources/logback.xml b/persistence-modules/spring-hibernate3/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/persistence-modules/spring-hibernate3/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/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java b/persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java
similarity index 97%
rename from spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java
rename to persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java
index d53c4445a8..bbbf074c1a 100644
--- a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java
+++ b/persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen1MainIntegrationTest.java
@@ -1,43 +1,43 @@
-package org.baeldung.persistence.service;
-
-import java.util.List;
-
-import org.baeldung.persistence.model.Event;
-import org.baeldung.spring.PersistenceConfigHibernate3;
-import org.hamcrest.core.IsInstanceOf;
-import org.hibernate.HibernateException;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { PersistenceConfigHibernate3.class }, loader = AnnotationConfigContextLoader.class)
-public class HibernateExceptionScen1MainIntegrationTest {
-
- @Autowired
- EventService service;
-
- @Rule
- public ExpectedException expectedEx = ExpectedException.none();
-
- @Test
- public final void whenEntityIsCreated_thenNoExceptions() {
- service.create(new Event("from LocalSessionFactoryBean"));
- }
-
- @Test
- @Ignore
- public final void whenNoTransBoundToSession_thenException() {
- expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class));
- expectedEx.expectMessage("No Hibernate Session bound to thread, "
- + "and configuration does not allow creation "
- + "of non-transactional one here");
- service.create(new Event("from LocalSessionFactoryBean"));
- }
-}
+package org.baeldung.persistence.service;
+
+import java.util.List;
+
+import org.baeldung.persistence.model.Event;
+import org.baeldung.spring.PersistenceConfigHibernate3;
+import org.hamcrest.core.IsInstanceOf;
+import org.hibernate.HibernateException;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { PersistenceConfigHibernate3.class }, loader = AnnotationConfigContextLoader.class)
+public class HibernateExceptionScen1MainIntegrationTest {
+
+ @Autowired
+ EventService service;
+
+ @Rule
+ public ExpectedException expectedEx = ExpectedException.none();
+
+ @Test
+ public final void whenEntityIsCreated_thenNoExceptions() {
+ service.create(new Event("from LocalSessionFactoryBean"));
+ }
+
+ @Test
+ @Ignore
+ public final void whenNoTransBoundToSession_thenException() {
+ expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class));
+ expectedEx.expectMessage("No Hibernate Session bound to thread, "
+ + "and configuration does not allow creation "
+ + "of non-transactional one here");
+ service.create(new Event("from LocalSessionFactoryBean"));
+ }
+}
diff --git a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java b/persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java
similarity index 97%
rename from spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java
rename to persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java
index 84cafe0536..d8810f0e90 100644
--- a/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java
+++ b/persistence-modules/spring-hibernate3/src/test/java/org/baeldung/persistence/service/HibernateExceptionScen2MainIntegrationTest.java
@@ -1,45 +1,45 @@
-package org.baeldung.persistence.service;
-
-import java.util.List;
-
-import org.baeldung.persistence.model.Event;
-import org.baeldung.spring.PersistenceConfig;
-import org.hamcrest.core.IsInstanceOf;
-import org.hibernate.HibernateException;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
-
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class HibernateExceptionScen2MainIntegrationTest {
-
- @Autowired
- EventService service;
-
- @Rule
- public ExpectedException expectedEx = ExpectedException.none();
-
- @Test
- public final void whenEntityIsCreated_thenNoExceptions() {
- service.create(new Event("from AnnotationSessionFactoryBean"));
- }
-
- @Test
- @Ignore
- public final void whenNoTransBoundToSession_thenException() {
- expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class));
- expectedEx.expectMessage("No Hibernate Session bound to thread, "
- + "and configuration does not allow creation "
- + "of non-transactional one here");
- service.create(new Event("from AnnotationSessionFactoryBean"));
- }
-
-}
+package org.baeldung.persistence.service;
+
+import java.util.List;
+
+import org.baeldung.persistence.model.Event;
+import org.baeldung.spring.PersistenceConfig;
+import org.hamcrest.core.IsInstanceOf;
+import org.hibernate.HibernateException;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
+public class HibernateExceptionScen2MainIntegrationTest {
+
+ @Autowired
+ EventService service;
+
+ @Rule
+ public ExpectedException expectedEx = ExpectedException.none();
+
+ @Test
+ public final void whenEntityIsCreated_thenNoExceptions() {
+ service.create(new Event("from AnnotationSessionFactoryBean"));
+ }
+
+ @Test
+ @Ignore
+ public final void whenNoTransBoundToSession_thenException() {
+ expectedEx.expectCause(IsInstanceOf.instanceOf(HibernateException.class));
+ expectedEx.expectMessage("No Hibernate Session bound to thread, "
+ + "and configuration does not allow creation "
+ + "of non-transactional one here");
+ service.create(new Event("from AnnotationSessionFactoryBean"));
+ }
+
+}
diff --git a/spring-hibernate4/.gitignore b/persistence-modules/spring-hibernate4/.gitignore
similarity index 100%
rename from spring-hibernate4/.gitignore
rename to persistence-modules/spring-hibernate4/.gitignore
diff --git a/spring-hibernate4/README.md b/persistence-modules/spring-hibernate4/README.md
similarity index 100%
rename from spring-hibernate4/README.md
rename to persistence-modules/spring-hibernate4/README.md
diff --git a/spring-hibernate4/pom.xml b/persistence-modules/spring-hibernate4/pom.xml
similarity index 99%
rename from spring-hibernate4/pom.xml
rename to persistence-modules/spring-hibernate4/pom.xml
index 505a218a94..fad84870df 100644
--- a/spring-hibernate4/pom.xml
+++ b/persistence-modules/spring-hibernate4/pom.xml
@@ -10,6 +10,7 @@
com.baeldung
parent-modules
1.0.0-SNAPSHOT
+ ../../
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/config/HibernateAnnotationUtil.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMain.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Cart.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/oneToMany/model/Items.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java
diff --git a/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java
similarity index 100%
rename from spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java
rename to persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java
diff --git a/spring-hibernate4/src/main/resources/fetching.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml
similarity index 100%
rename from spring-hibernate4/src/main/resources/fetching.cfg.xml
rename to persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml
diff --git a/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml
similarity index 100%
rename from spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml
rename to persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml
diff --git a/spring-hibernate4/src/main/resources/fetching_create_queries.sql b/persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql
similarity index 100%
rename from spring-hibernate4/src/main/resources/fetching_create_queries.sql
rename to persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql
diff --git a/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml
similarity index 100%
rename from spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml
rename to persistence-modules/spring-hibernate4/src/main/resources/hibernate-annotation.cfg.xml
diff --git a/spring-hibernate4/src/main/resources/hibernate4Config.xml b/persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml
similarity index 100%
rename from spring-hibernate4/src/main/resources/hibernate4Config.xml
rename to persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml
diff --git a/spring-hibernate4/src/main/resources/immutable.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml
similarity index 100%
rename from spring-hibernate4/src/main/resources/immutable.cfg.xml
rename to persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml
diff --git a/spring-hibernate4/src/main/resources/insert_statements.sql b/persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql
similarity index 100%
rename from spring-hibernate4/src/main/resources/insert_statements.sql
rename to persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql
diff --git a/spring-hibernate4/src/main/resources/logback.xml b/persistence-modules/spring-hibernate4/src/main/resources/logback.xml
similarity index 100%
rename from spring-hibernate4/src/main/resources/logback.xml
rename to persistence-modules/spring-hibernate4/src/main/resources/logback.xml
diff --git a/spring-hibernate4/src/main/resources/one_to_many.sql b/persistence-modules/spring-hibernate4/src/main/resources/one_to_many.sql
similarity index 100%
rename from spring-hibernate4/src/main/resources/one_to_many.sql
rename to persistence-modules/spring-hibernate4/src/main/resources/one_to_many.sql
diff --git a/spring-hibernate4/src/main/resources/persistence-mysql.properties b/persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties
similarity index 100%
rename from spring-hibernate4/src/main/resources/persistence-mysql.properties
rename to persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties
diff --git a/spring-hibernate4/src/main/resources/stored_procedure.sql b/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql
similarity index 95%
rename from spring-hibernate4/src/main/resources/stored_procedure.sql
rename to persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql
index 8e1bdf57dd..9cedb75c37 100644
--- a/spring-hibernate4/src/main/resources/stored_procedure.sql
+++ b/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql
@@ -1,20 +1,20 @@
-DELIMITER //
- CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255))
- LANGUAGE SQL
- DETERMINISTIC
- SQL SECURITY DEFINER
- BEGIN
- SELECT * FROM foo WHERE name = fooName;
- END //
-DELIMITER ;
-
-
-DELIMITER //
- CREATE PROCEDURE GetAllFoos()
- LANGUAGE SQL
- DETERMINISTIC
- SQL SECURITY DEFINER
- BEGIN
- SELECT * FROM foo;
- END //
+DELIMITER //
+ CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255))
+ LANGUAGE SQL
+ DETERMINISTIC
+ SQL SECURITY DEFINER
+ BEGIN
+ SELECT * FROM foo WHERE name = fooName;
+ END //
+DELIMITER ;
+
+
+DELIMITER //
+ CREATE PROCEDURE GetAllFoos()
+ LANGUAGE SQL
+ DETERMINISTIC
+ SQL SECURITY DEFINER
+ BEGIN
+ SELECT * FROM foo;
+ END //
DELIMITER ;
\ No newline at end of file
diff --git a/spring-hibernate4/src/main/resources/webSecurityConfig.xml b/persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml
similarity index 100%
rename from spring-hibernate4/src/main/resources/webSecurityConfig.xml
rename to persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml
diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/oneToMany/main/HibernateOneToManyAnnotationMainIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
similarity index 97%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
index 9ec04d297c..d9353f1ad1 100644
--- a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
+++ b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
@@ -1,121 +1,121 @@
-package com.baeldung.persistence.service;
-
-import java.util.List;
-
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
-import static org.junit.Assert.assertEquals;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.exception.SQLGrammarException;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
-
-import com.baeldung.persistence.model.Foo;
-import com.baeldung.spring.PersistenceConfig;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class FooStoredProceduresLiveTest {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class);
-
- @Autowired
- private SessionFactory sessionFactory;
-
- @Autowired
- private IFooService fooService;
-
- private Session session;
-
- @Before
- public final void before() {
- session = sessionFactory.openSession();
- Assume.assumeTrue(getAllFoosExists());
- Assume.assumeTrue(getFoosByNameExists());
- }
-
- private boolean getFoosByNameExists() {
- try {
- Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class);
- sqlQuery.list();
- return true;
- } catch (SQLGrammarException e) {
- LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e);
- return false;
- }
- }
-
- private boolean getAllFoosExists() {
- try {
- Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class);
- sqlQuery.list();
- return true;
- } catch (SQLGrammarException e) {
- LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e);
- return false;
- }
- }
-
- @After
- public final void after() {
- session.close();
- }
-
- @Test
- public final void getAllFoosUsingStoredProcedures() {
-
- fooService.create(new Foo(randomAlphabetic(6)));
-
- // Stored procedure getAllFoos using createSQLQuery
- Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class);
- @SuppressWarnings("unchecked")
- List allFoos = sqlQuery.list();
- for (Foo foo : allFoos) {
- LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName());
- }
- assertEquals(allFoos.size(), fooService.findAll().size());
-
- // Stored procedure getAllFoos using a Named Query
- Query namedQuery = session.getNamedQuery("callGetAllFoos");
- @SuppressWarnings("unchecked")
- List allFoos2 = namedQuery.list();
- for (Foo foo : allFoos2) {
- LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName());
- }
- assertEquals(allFoos2.size(), fooService.findAll().size());
- }
-
- @Test
- public final void getFoosByNameUsingStoredProcedures() {
-
- fooService.create(new Foo("NewFooName"));
-
- // Stored procedure getFoosByName using createSQLQuery()
- Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName");
- @SuppressWarnings("unchecked")
- List allFoosByName = sqlQuery.list();
- for (Foo foo : allFoosByName) {
- LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString());
- }
-
- // Stored procedure getFoosByName using getNamedQuery()
- Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName");
- @SuppressWarnings("unchecked")
- List allFoosByName2 = namedQuery.list();
- for (Foo foo : allFoosByName2) {
- LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString());
- }
-
- }
-}
+package com.baeldung.persistence.service;
+
+import java.util.List;
+
+import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.junit.Assert.assertEquals;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.exception.SQLGrammarException;
+import org.junit.After;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+import com.baeldung.persistence.model.Foo;
+import com.baeldung.spring.PersistenceConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
+public class FooStoredProceduresLiveTest {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class);
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Autowired
+ private IFooService fooService;
+
+ private Session session;
+
+ @Before
+ public final void before() {
+ session = sessionFactory.openSession();
+ Assume.assumeTrue(getAllFoosExists());
+ Assume.assumeTrue(getFoosByNameExists());
+ }
+
+ private boolean getFoosByNameExists() {
+ try {
+ Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class);
+ sqlQuery.list();
+ return true;
+ } catch (SQLGrammarException e) {
+ LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e);
+ return false;
+ }
+ }
+
+ private boolean getAllFoosExists() {
+ try {
+ Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class);
+ sqlQuery.list();
+ return true;
+ } catch (SQLGrammarException e) {
+ LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e);
+ return false;
+ }
+ }
+
+ @After
+ public final void after() {
+ session.close();
+ }
+
+ @Test
+ public final void getAllFoosUsingStoredProcedures() {
+
+ fooService.create(new Foo(randomAlphabetic(6)));
+
+ // Stored procedure getAllFoos using createSQLQuery
+ Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class);
+ @SuppressWarnings("unchecked")
+ List allFoos = sqlQuery.list();
+ for (Foo foo : allFoos) {
+ LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName());
+ }
+ assertEquals(allFoos.size(), fooService.findAll().size());
+
+ // Stored procedure getAllFoos using a Named Query
+ Query namedQuery = session.getNamedQuery("callGetAllFoos");
+ @SuppressWarnings("unchecked")
+ List allFoos2 = namedQuery.list();
+ for (Foo foo : allFoos2) {
+ LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName());
+ }
+ assertEquals(allFoos2.size(), fooService.findAll().size());
+ }
+
+ @Test
+ public final void getFoosByNameUsingStoredProcedures() {
+
+ fooService.create(new Foo("NewFooName"));
+
+ // Stored procedure getFoosByName using createSQLQuery()
+ Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName");
+ @SuppressWarnings("unchecked")
+ List allFoosByName = sqlQuery.list();
+ for (Foo foo : allFoosByName) {
+ LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString());
+ }
+
+ // Stored procedure getFoosByName using getNamedQuery()
+ Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName");
+ @SuppressWarnings("unchecked")
+ List allFoosByName2 = namedQuery.list();
+ for (Foo foo : allFoosByName2) {
+ LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString());
+ }
+
+ }
+}
diff --git a/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java
diff --git a/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java
similarity index 100%
rename from spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java
rename to persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java
diff --git a/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 100%
rename from spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java
rename to persistence-modules/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java
diff --git a/spring-hibernate4/src/test/resources/.gitignore b/persistence-modules/spring-hibernate4/src/test/resources/.gitignore
similarity index 100%
rename from spring-hibernate4/src/test/resources/.gitignore
rename to persistence-modules/spring-hibernate4/src/test/resources/.gitignore
diff --git a/spring-hibernate4/src/test/resources/fetching.cfg.xml b/persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml
similarity index 100%
rename from spring-hibernate4/src/test/resources/fetching.cfg.xml
rename to persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml
diff --git a/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml
similarity index 100%
rename from spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml
rename to persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml
diff --git a/spring-hibernate4/src/test/resources/persistence-h2.properties b/persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties
similarity index 100%
rename from spring-hibernate4/src/test/resources/persistence-h2.properties
rename to persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties
diff --git a/pom.xml b/pom.xml
index ed7ca7d6d3..302530fd24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -354,17 +354,19 @@
core-java
core-java-collections
+ java-collections-conversions
+ java-collections-maps
core-java-io
core-java-8
java-streams
- core-java-persistence
+ persistence-modules/core-java-persistence
core-kotlin
kotlin-libraries
core-groovy
core-java-concurrency
core-java-concurrency-collections
couchbase
- deltaspike
+ persistence-modules/deltaspike
dozer
ethereum
ejb
@@ -392,7 +394,7 @@
hystrix
image-processing
immutables
- influxdb
+ persistence-modules/influxdb
jackson
persistence-modules/java-cassandra
vavr
@@ -436,7 +438,7 @@
mustache
mvn-wrapper
noexception
- orientdb
+ persistence-modules/orientdb
osgi
orika
patterns
@@ -477,7 +479,7 @@
spring-boot-admin
spring-boot-camel
spring-boot-ops
- spring-boot-persistence
+ persistence-modules/spring-boot-persistence
spring-boot-security
spring-boot-mvc
spring-boot-vue
@@ -489,15 +491,14 @@
spring-core
spring-cucumber
spring-ejb
- spring-ejb/spring-ejb-client
spring-aop
persistence-modules/spring-data-cassandra
spring-data-couchbase-2
persistence-modules/spring-data-dynamodb
- spring-data-elasticsearch
- spring-data-jpa
- spring-data-keyvalue
- spring-data-mongodb
+ persistence-modules/spring-data-elasticsearch
+ persistence-modules/spring-data-jpa
+ persistence-modules/spring-data-keyvalue
+ persistence-modules/spring-data-mongodb
persistence-modules/spring-data-neo4j
persistence-modules/spring-data-redis
spring-data-rest
@@ -506,7 +507,7 @@
spring-exceptions
spring-freemarker
persistence-modules/spring-hibernate-3
- spring-hibernate4
+ persistence-modules/spring-hibernate4
persistence-modules/spring-hibernate-5
persistence-modules/spring-data-eclipselink
spring-integration
@@ -806,13 +807,13 @@
spring-cloud/spring-cloud-data-flow/time-processor
spring-cloud/spring-cloud-data-flow/time-source
spring-cucumber
- spring-data-keyvalue
+ persistence-modules/spring-data-keyvalue
spring-data-rest
spring-dispatcher-servlet
spring-drools
spring-freemarker
- spring-hibernate-3
- spring-hibernate4
+ persistence-modules/spring-hibernate-3
+ persistence-modules/spring-hibernate4
spring-integration
spring-jenkins-pipeline
spring-jersey
@@ -941,7 +942,7 @@
azure bootique cdi core-java
core-java-collections core-java-io core-java-8
core-kotlin core-groovy core-java-concurrency
- couchbase deltaspike dozer
+ couchbase persistence-modules/deltaspike dozer
ethereum ejb feign flips
geotools testing-modules/groovy-spock testing-modules/gatling
google-cloud google-web-toolkit gson
@@ -949,7 +950,7 @@
guava-modules/guava-21 guice disruptor
spring-static-resources hazelcast hbase
hibernate5 httpclient hystrix
- image-processing immutables influxdb
+ image-processing immutables persistence-modules/influxdb
jackson persistence-modules/java-cassandra
vavr java-lite java-numbers
java-rmi java-vavr-stream javax-servlets
@@ -974,7 +975,7 @@
mustache
mvn-wrapper
noexception
- orientdb
+ persistence-modules/orientdb
osgi
orika
patterns
@@ -1021,7 +1022,7 @@
spring-boot-admin
spring-boot-camel
spring-boot-ops
- spring-boot-persistence
+ persistence-modules/spring-boot-persistence
spring-boot-security
spring-boot-mvc
spring-boot-logging-log4j2
@@ -1032,15 +1033,14 @@
spring-core
spring-cucumber
spring-ejb
- spring-ejb/spring-ejb-client
spring-aop
persistence-modules/spring-data-cassandra
spring-data-couchbase-2
persistence-modules/spring-data-dynamodb
- spring-data-elasticsearch
- spring-data-keyvalue
- spring-data-mongodb
- spring-data-jpa
+ persistence-modules/spring-data-elasticsearch
+ persistence-modules/spring-data-keyvalue
+ persistence-modules/spring-data-mongodb
+ persistence-modules/spring-data-jpa
persistence-modules/spring-data-neo4j
persistence-modules/spring-data-redis
spring-data-rest
@@ -1055,7 +1055,7 @@
spring-exceptions
spring-freemarker
persistence-modules/spring-hibernate-3
- spring-hibernate4
+ persistence-modules/spring-hibernate4
persistence-modules/spring-hibernate-5
persistence-modules/spring-data-eclipselink
spring-integration
@@ -1272,13 +1272,15 @@
java-strings
core-java-collections
+ java-collections-conversions
+ java-collections-maps
core-java-io
core-java-8
java-streams
core-groovy
couchbase
- deltaspike
+ persistence-modules/deltaspike
dozer
ethereum
feign
@@ -1300,7 +1302,7 @@
hystrix
image-processing
immutables
- influxdb
+ persistence-modules/influxdb
jackson
vavr
java-lite
@@ -1341,7 +1343,7 @@
mustache
mvn-wrapper
noexception
- orientdb
+ persistence-modules/orientdb
osgi
orika
patterns
@@ -1378,7 +1380,7 @@
spring-boot-bootstrap
spring-boot-admin
spring-boot-camel
- spring-boot-persistence
+ persistence-modules/spring-boot-persistence
spring-boot-security
spring-boot-mvc
spring-boot-logging-log4j2
@@ -1389,12 +1391,11 @@
spring-core
spring-cucumber
spring-ejb
- spring-ejb/spring-ejb-client
spring-aop
persistence-modules/spring-data-dynamodb
- spring-data-keyvalue
- spring-data-mongodb
+ persistence-modules/spring-data-keyvalue
+ persistence-modules/spring-data-mongodb
persistence-modules/spring-data-neo4j
spring-data-rest
@@ -1509,7 +1510,7 @@
maven-archetype
apache-meecrowave
- spring-hibernate4
+ persistence-modules/spring-hibernate4
xml
vertx
metrics
@@ -1603,7 +1604,7 @@
google-web-toolkit
spring-security-mvc-custom
hibernate5
- spring-data-elasticsearch
+ persistence-modules/spring-data-elasticsearch
core-java-concurrency
core-java-concurrency-collections
diff --git a/spring-5-reactive-security/README.md b/spring-5-reactive-security/README.md
index 3395cf5562..845d07cd7f 100644
--- a/spring-5-reactive-security/README.md
+++ b/spring-5-reactive-security/README.md
@@ -8,4 +8,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators)
- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive)
- [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux)
-
+- [Introduction to the Functional Web Framework in Spring 5](https://www.baeldung.com/spring-5-functional-web)
diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md
index 7977fd820f..1431554882 100644
--- a/spring-5-reactive/README.md
+++ b/spring-5-reactive/README.md
@@ -14,3 +14,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring Webflux and CORS](http://www.baeldung.com/spring-webflux-cors)
- [Handling Errors in Spring WebFlux](http://www.baeldung.com/spring-webflux-errors)
- [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events)
+- [A Guide to Spring Session Reactive Support: WebSession](https://www.baeldung.com/a-guide-to-spring-session-reactive-support-websession/)
\ No newline at end of file
diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml
index 5f455c3906..e903b57c4e 100644
--- a/spring-5-reactive/pom.xml
+++ b/spring-5-reactive/pom.xml
@@ -76,6 +76,28 @@
test
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.session
+ spring-session-core
+
+
+ org.springframework.session
+ spring-session-data-redis
+
+
org.apache.commons
commons-collections4
diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/Application.java b/spring-5-reactive/src/main/java/com/baeldung/websession/Application.java
new file mode 100644
index 0000000000..667ef29658
--- /dev/null
+++ b/spring-5-reactive/src/main/java/com/baeldung/websession/Application.java
@@ -0,0 +1,15 @@
+package com.baeldung.websession;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+
+@SpringBootApplication
+@ComponentScan(basePackages = {"com.baeldung"})
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java
new file mode 100644
index 0000000000..aa85cf9fd9
--- /dev/null
+++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/RedisConfig.java
@@ -0,0 +1,17 @@
+package com.baeldung.websession.configuration;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
+import org.springframework.session.data.redis.config.annotation.web.server.EnableRedisWebSession;
+
+@Configuration
+//@EnableRedisWebSession
+public class RedisConfig {
+/**
+ @Bean
+ public LettuceConnectionFactory redisConnectionFactory() {
+ return new LettuceConnectionFactory();
+ }
+*/
+}
\ No newline at end of file
diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java
new file mode 100644
index 0000000000..7cb2ff680e
--- /dev/null
+++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/SessionConfig.java
@@ -0,0 +1,20 @@
+package com.baeldung.websession.configuration;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.session.ReactiveMapSessionRepository;
+import org.springframework.session.ReactiveSessionRepository;
+import org.springframework.session.config.annotation.web.server.EnableSpringWebSession;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+@Configuration
+@EnableSpringWebSession
+public class SessionConfig {
+
+ @Bean
+ public ReactiveSessionRepository reactiveSessionRepository() {
+ return new ReactiveMapSessionRepository(new ConcurrentHashMap<>());
+ }
+
+}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java
new file mode 100644
index 0000000000..964b544916
--- /dev/null
+++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxConfig.java
@@ -0,0 +1,20 @@
+package com.baeldung.websession.configuration;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.reactive.config.EnableWebFlux;
+import org.springframework.web.reactive.config.ResourceHandlerRegistry;
+import org.springframework.web.reactive.config.WebFluxConfigurer;
+
+@Configuration
+@EnableWebFlux
+public class WebFluxConfig implements ApplicationContextAware, WebFluxConfigurer {
+
+ private ApplicationContext context;
+
+ @Override
+ public void setApplicationContext(ApplicationContext context) {
+ this.context = context;
+ }
+}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java
new file mode 100644
index 0000000000..452bcac8ab
--- /dev/null
+++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java
@@ -0,0 +1,58 @@
+package com.baeldung.websession.configuration;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
+import org.springframework.security.config.web.server.ServerHttpSecurity;
+import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.web.server.SecurityWebFilterChain;
+import org.springframework.security.web.server.context.WebSessionServerSecurityContextRepository;
+
+@Configuration
+@EnableWebFluxSecurity
+public class WebFluxSecurityConfig {
+
+ @Bean
+ public MapReactiveUserDetailsService userDetailsService() {
+ UserDetails admin = User
+ .withUsername("admin")
+ .password(encoder().encode("password"))
+ .roles("ADMIN")
+ .build();
+
+ UserDetails user = User
+ .withUsername("user")
+ .password(encoder().encode("password"))
+ .roles("USER")
+ .build();
+
+ return new MapReactiveUserDetailsService(admin, user);
+ }
+
+ @Bean
+ public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
+ http
+ .authorizeExchange()
+ .anyExchange().authenticated()
+ .and()
+ .httpBasic()
+ .securityContextRepository(new WebSessionServerSecurityContextRepository())
+ .and()
+ .formLogin();
+
+ http
+ .csrf().disable();
+
+ return http.build();
+
+ }
+
+ @Bean
+ public PasswordEncoder encoder() {
+ return new BCryptPasswordEncoder();
+ }
+}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java b/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java
new file mode 100644
index 0000000000..b91a050322
--- /dev/null
+++ b/spring-5-reactive/src/main/java/com/baeldung/websession/controller/SessionController.java
@@ -0,0 +1,42 @@
+package com.baeldung.websession.controller;
+
+import com.baeldung.websession.transfer.CustomResponse;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.server.WebSession;
+import reactor.core.publisher.Mono;
+
+@RestController
+public class SessionController {
+
+ @GetMapping("/websession/test")
+ public Mono testWebSessionByParam(
+ @RequestParam(value = "id") int id,
+ @RequestParam(value = "note") String note,
+ WebSession session) {
+
+ session.getAttributes().put("id", id);
+ session.getAttributes().put("note", note);
+
+ CustomResponse r = new CustomResponse();
+ r.setId((int) session.getAttributes().get("id"));
+ r.setNote((String) session.getAttributes().get("note"));
+
+ return Mono.just(r);
+ }
+
+ @GetMapping("/websession")
+ public Mono getSession(WebSession session) {
+
+ session.getAttributes().putIfAbsent("id", 0);
+ session.getAttributes().putIfAbsent("note", "Howdy Cosmic Spheroid!");
+
+ CustomResponse r = new CustomResponse();
+ r.setId((int) session.getAttributes().get("id"));
+ r.setNote((String) session.getAttributes().get("note"));
+
+ return Mono.just(r);
+ }
+
+}
\ No newline at end of file
diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java b/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java
new file mode 100644
index 0000000000..2d562de157
--- /dev/null
+++ b/spring-5-reactive/src/main/java/com/baeldung/websession/transfer/CustomResponse.java
@@ -0,0 +1,31 @@
+package com.baeldung.websession.transfer;
+
+public class CustomResponse {
+
+ private int id;
+ private String note;
+
+ public CustomResponse() {}
+
+ public CustomResponse(int id, String note) {
+ this.id = id;
+ this.note = note;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
+
+}
diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml
index 0a19f483c1..4e21c5b032 100644
--- a/spring-activiti/pom.xml
+++ b/spring-activiti/pom.xml
@@ -41,9 +41,21 @@
test
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+ com.baeldung.activitiwithspring.ActivitiWithSpringApplication
+
+
+
+
- com.example.activitiwithspring.ActivitiWithSpringApplication
UTF-8
UTF-8
6.0.0
diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java
similarity index 97%
rename from spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java
rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java
index 96b551c03c..54dd4670f0 100644
--- a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java
+++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiController.java
@@ -1,4 +1,4 @@
-package com.example.activitiwithspring;
+package com.baeldung.activitiwithspring;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java
similarity index 91%
rename from spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java
rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java
index a9cd1301eb..d43ae3cc35 100644
--- a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java
+++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplication.java
@@ -1,4 +1,4 @@
-package com.example.activitiwithspring;
+package com.baeldung.activitiwithspring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java
similarity index 90%
rename from spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java
rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java
index bb1412b057..de1ad88ba9 100644
--- a/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java
+++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/TaskRepresentation.java
@@ -1,4 +1,4 @@
-package com.example.activitiwithspring;
+package com.baeldung.activitiwithspring;
class TaskRepresentation {
diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java
similarity index 83%
rename from spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java
rename to spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java
index c11b48f37a..c174b6ae4a 100644
--- a/spring-activiti/src/main/java/com/example/activitiwithspring/servicetasks/SendEmailServiceTask.java
+++ b/spring-activiti/src/main/java/com/baeldung/activitiwithspring/servicetasks/SendEmailServiceTask.java
@@ -1,4 +1,4 @@
-package com.example.activitiwithspring.servicetasks;
+package com.baeldung.activitiwithspring.servicetasks;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
diff --git a/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java
similarity index 81%
rename from spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java
rename to spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java
index ae37e77f86..ce48080753 100644
--- a/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java
+++ b/spring-activiti/src/test/java/com/baeldung/SpringContextIntegrationTest.java
@@ -1,11 +1,11 @@
-package org.baeldung;
+package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-import com.example.activitiwithspring.ActivitiWithSpringApplication;
+import com.baeldung.activitiwithspring.ActivitiWithSpringApplication;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ActivitiWithSpringApplication.class)
diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java
similarity index 97%
rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java
rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java
index 65fd33bfc6..12c855e5ff 100644
--- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerIntegrationTest.java
+++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiControllerIntegrationTest.java
@@ -1,5 +1,6 @@
-package com.example.activitiwithspring;
+package com.baeldung.activitiwithspring;
+import com.baeldung.activitiwithspring.TaskRepresentation;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java
similarity index 96%
rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java
rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java
index c2eeb96555..53bdcee888 100644
--- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java
+++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiSpringSecurityIntegrationTest.java
@@ -1,4 +1,4 @@
-package com.example.activitiwithspring;
+package com.baeldung.activitiwithspring;
import org.activiti.engine.IdentityService;
import org.junit.Test;
diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java
similarity index 89%
rename from spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java
rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java
index 7460c302d8..8c1e400215 100644
--- a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java
+++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ActivitiWithSpringApplicationIntegrationTest.java
@@ -1,4 +1,4 @@
-package com.example.activitiwithspring;
+package com.baeldung.activitiwithspring;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java
similarity index 98%
rename from spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java
rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java
index 00afd14590..00538f8e6e 100644
--- a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessEngineCreationIntegrationTest.java
+++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessEngineCreationIntegrationTest.java
@@ -1,4 +1,4 @@
-package com.example.activitiwithspring;
+package com.baeldung.activitiwithspring;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java
similarity index 99%
rename from spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java
rename to spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java
index 9c35ea413b..4342590ea9 100644
--- a/spring-activiti/src/test/java/com/example/activitiwithspring/ProcessExecutionIntegrationTest.java
+++ b/spring-activiti/src/test/java/com/baeldung/activitiwithspring/ProcessExecutionIntegrationTest.java
@@ -1,4 +1,4 @@
-package com.example.activitiwithspring;
+package com.baeldung.activitiwithspring;
import org.activiti.engine.ActivitiException;
diff --git a/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml b/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml
index 4eac7eba19..88c5d1caf5 100644
--- a/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml
+++ b/spring-boot-custom-starter/greeter-spring-boot-sample-app/pom.xml
@@ -7,11 +7,23 @@
0.0.1-SNAPSHOT
- parent-boot-1
+ spring-boot-custom-starter
com.baeldung
0.0.1-SNAPSHOT
- ../../parent-boot-1
+ ../../spring-boot-custom-starter
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
@@ -19,9 +31,27 @@
greeter-spring-boot-starter
${greeter-starter.version}
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+
+ 1.5.15.RELEASE
0.0.1-SNAPSHOT
diff --git a/spring-boot-custom-starter/pom.xml b/spring-boot-custom-starter/pom.xml
index b8ad8fa12c..97b33ce2b8 100644
--- a/spring-boot-custom-starter/pom.xml
+++ b/spring-boot-custom-starter/pom.xml
@@ -18,5 +18,6 @@
greeter-spring-boot-starter
greeter-spring-boot-sample-app
+
\ No newline at end of file
diff --git a/spring-boot-mvc/README.md b/spring-boot-mvc/README.md
index b46dbe3bae..e7b42f8f50 100644
--- a/spring-boot-mvc/README.md
+++ b/spring-boot-mvc/README.md
@@ -7,4 +7,5 @@
- [Spring Web Annotations](http://www.baeldung.com/spring-mvc-annotations)
- [Spring Core Annotations](http://www.baeldung.com/spring-core-annotations)
- [Display RSS Feed with Spring MVC](http://www.baeldung.com/spring-mvc-rss-feed)
-
+- [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao)
+- [Cache Eviction in Spring Boot](https://www.baeldung.com/spring-boot-evict-cache)
diff --git a/spring-boot/README.MD b/spring-boot/README.MD
index aed2d2c5f8..9a9f44e1cf 100644
--- a/spring-boot/README.MD
+++ b/spring-boot/README.MD
@@ -35,3 +35,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring Component Scanning](https://www.baeldung.com/spring-component-scanning)
- [Load Spring Boot Properties From a JSON File](https://www.baeldung.com/spring-boot-json-properties)
- [Display Auto-Configuration Report in Spring Boot](https://www.baeldung.com/spring-boot-auto-configuration-report)
+- [Logging to Graylog with Spring Boot](https://www.baeldung.com/graylog-with-spring-boot)
diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java b/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java
index 2e0d9eb8d8..2ee265f134 100644
--- a/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java
+++ b/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java
@@ -16,5 +16,6 @@ public class CollectionInjectionDemo {
collectionsBean.printNameSet();
collectionsBean.printNameMap();
collectionsBean.printBeanList();
+ collectionsBean.printNameListWithDefaults();
}
}
diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java b/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java
index a0e985267f..fc90f2c6ff 100644
--- a/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java
+++ b/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java
@@ -1,13 +1,14 @@
package com.baeldung.collection;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+
/**
* Created by Gebruiker on 5/18/2018.
*/
@@ -24,6 +25,9 @@ public class CollectionsBean {
@Qualifier("CollectionsBean")
private List beanList = new ArrayList<>();
+ @Value("${names.list:}#{T(java.util.Collections).emptyList()}")
+ private List nameListWithDefaultValue;
+
public CollectionsBean() {
}
@@ -51,4 +55,8 @@ public class CollectionsBean {
public void printBeanList() {
System.out.println(beanList);
}
+
+ public void printNameListWithDefaults() {
+ System.out.println(nameListWithDefaultValue);
+ }
}
diff --git a/spring-ejb/pom.xml b/spring-ejb/pom.xml
index 31cde720f9..055df9ea04 100755
--- a/spring-ejb/pom.xml
+++ b/spring-ejb/pom.xml
@@ -73,6 +73,7 @@
ejb-remote-for-spring
ejb-beans
+ spring-ejb-client
diff --git a/spring-ejb/spring-ejb-client/pom.xml b/spring-ejb/spring-ejb-client/pom.xml
index c935e1f14a..50337e8b21 100644
--- a/spring-ejb/spring-ejb-client/pom.xml
+++ b/spring-ejb/spring-ejb-client/pom.xml
@@ -10,11 +10,22 @@
Spring EJB Client
- com.baeldung
- parent-boot-2
- 0.0.1-SNAPSHOT
- ../../parent-boot-2
+ com.baeldung.spring.ejb
+ spring-ejb
+ 1.0.1
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ 2.0.4.RELEASE
+ pom
+ import
+
+
+
@@ -54,6 +65,7 @@
org.springframework.boot
spring-boot-maven-plugin
+ 2.0.4.RELEASE
diff --git a/spring-security-mvc-boot/pom.xml b/spring-security-mvc-boot/pom.xml
index 4090beab99..d2316ddca5 100644
--- a/spring-security-mvc-boot/pom.xml
+++ b/spring-security-mvc-boot/pom.xml
@@ -229,12 +229,16 @@
-
+
+
+
1.1.2
1.2
1.6.1
2.6.11
+ 1.8
diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java
new file mode 100644
index 0000000000..70fe30abdc
--- /dev/null
+++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/HttpsEnabledApplication.java
@@ -0,0 +1,14 @@
+package org.baeldung.ssl;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class HttpsEnabledApplication {
+
+ public static void main(String... args) {
+ SpringApplication application = new SpringApplication(HttpsEnabledApplication.class);
+ application.setAdditionalProfiles("ssl");
+ application.run(args);
+ }
+}
diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java
new file mode 100644
index 0000000000..92f92d8fc7
--- /dev/null
+++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/SecurityConfig.java
@@ -0,0 +1,16 @@
+package org.baeldung.ssl;
+
+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;
+
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.authorizeRequests()
+ .antMatchers("/**")
+ .permitAll();
+ }
+}
diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java
new file mode 100644
index 0000000000..72ad8abb85
--- /dev/null
+++ b/spring-security-mvc-boot/src/main/java/org/baeldung/ssl/WelcomeController.java
@@ -0,0 +1,15 @@
+package org.baeldung.ssl;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+public class WelcomeController {
+
+ @GetMapping("/welcome")
+ public String welcome() {
+ return "ssl/welcome";
+ }
+
+}
diff --git a/spring-security-mvc-boot/src/main/resources/application-ssl.properties b/spring-security-mvc-boot/src/main/resources/application-ssl.properties
new file mode 100644
index 0000000000..090b775d03
--- /dev/null
+++ b/spring-security-mvc-boot/src/main/resources/application-ssl.properties
@@ -0,0 +1,20 @@
+
+http.port=8080
+
+server.port=8443
+
+security.require-ssl=true
+
+# The format used for the keystore
+server.ssl.key-store-type=PKCS12
+# The path to the keystore containing the certificate
+server.ssl.key-store=classpath:keystore/baeldung.p12
+# The password used to generate the certificate
+server.ssl.key-store-password=password
+# The alias mapped to the certificate
+server.ssl.key-alias=baeldung
+
+#trust store location
+trust.store=classpath:keystore/baeldung.p12
+#trust store password
+trust.store.password=password
diff --git a/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 b/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12
new file mode 100644
index 0000000000..cd8eb28429
Binary files /dev/null and b/spring-security-mvc-boot/src/main/resources/keystore/baeldung.p12 differ
diff --git a/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html b/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html
new file mode 100644
index 0000000000..93b3577f5c
--- /dev/null
+++ b/spring-security-mvc-boot/src/main/resources/templates/ssl/welcome.html
@@ -0,0 +1 @@
+Welcome to Secured Site
\ No newline at end of file
diff --git a/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java b/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java
new file mode 100644
index 0000000000..fe7883ec94
--- /dev/null
+++ b/spring-security-mvc-boot/src/test/java/org/baeldung/web/HttpsApplicationIntegrationTest.java
@@ -0,0 +1,56 @@
+package org.baeldung.web;
+
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.baeldung.ssl.HttpsEnabledApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.core.io.Resource;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.client.RestTemplate;
+
+import javax.net.ssl.SSLContext;
+import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = HttpsEnabledApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
+@ActiveProfiles("ssl")
+public class HttpsApplicationIntegrationTest {
+
+ private static final String WELCOME_URL = "https://localhost:8443/welcome";
+
+ @Value("${trust.store}")
+ private Resource trustStore;
+
+ @Value("${trust.store.password}")
+ private String trustStorePassword;
+
+ @Test
+ public void whenGETanHTTPSResource_thenCorrectResponse() throws Exception {
+ ResponseEntity response = restTemplate().getForEntity(WELCOME_URL, String.class, Collections.emptyMap());
+
+ assertEquals("Welcome to Secured Site
", response.getBody());
+ assertEquals(HttpStatus.OK, response.getStatusCode());
+ }
+
+ RestTemplate restTemplate() throws Exception {
+ SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray())
+ .build();
+ SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
+ HttpClient httpClient = HttpClients.custom()
+ .setSSLSocketFactory(socketFactory)
+ .build();
+ HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient);
+ return new RestTemplate(factory);
+ }
+}
diff --git a/testing-modules/testng/README.md b/testing-modules/testng/README.md
index e54ee1dbf2..a7e0e29d62 100644
--- a/testing-modules/testng/README.md
+++ b/testing-modules/testng/README.md
@@ -2,3 +2,4 @@
- [Introduction to TestNG](http://www.baeldung.com/testng)
- [Custom Reporting with TestNG](http://www.baeldung.com/testng-custom-reporting)
+- [A Quick JUnit vs TestNG Comparison](https://www.baeldung.com/junit-vs-testng)
diff --git a/xml/README.md b/xml/README.md
index 80c6a069f0..fb070100db 100644
--- a/xml/README.md
+++ b/xml/README.md
@@ -3,3 +3,4 @@
- [Introduction to JiBX](http://www.baeldung.com/jibx)
- [XML Libraries Support in Java](http://www.baeldung.com/java-xml-libraries)
- [DOM parsing with Xerces](http://www.baeldung.com/java-xerces-dom-parsing)
+- [Write an org.w3.dom.Document to a File](https://www.baeldung.com/java-write-xml-document-file)