diff --git a/README.md b/README.md
index b08a93f23e..88750cf654 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,3 @@
-**UPDATE**: The price of "Learn Spring Security OAuth" will permanently change on the 11th of December, along with the upcoming OAuth2 material: http://bit.ly/github-lss
-
The Courses
==============================
diff --git a/algorithms-genetic/README.md b/algorithms-genetic/README.md
index 1c9e831ac2..eb4e3fb798 100644
--- a/algorithms-genetic/README.md
+++ b/algorithms-genetic/README.md
@@ -5,6 +5,6 @@ This module contains articles about genetic algorithms.
### Relevant articles:
- [Introduction to Jenetics Library](https://www.baeldung.com/jenetics)
-- [Ant Colony Optimization](https://www.baeldung.com/java-ant-colony-optimization)
+- [Ant Colony Optimization with a Java Example](https://www.baeldung.com/java-ant-colony-optimization)
- [Design a Genetic Algorithm in Java](https://www.baeldung.com/java-genetic-algorithm)
- [The Traveling Salesman Problem in Java](https://www.baeldung.com/java-simulated-annealing-for-traveling-salesman)
diff --git a/algorithms-miscellaneous-1/README.md b/algorithms-miscellaneous-1/README.md
index 25e2733538..02bf874197 100644
--- a/algorithms-miscellaneous-1/README.md
+++ b/algorithms-miscellaneous-1/README.md
@@ -6,8 +6,8 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
### Relevant articles:
- [Validating Input With Finite Automata in Java](https://www.baeldung.com/java-finite-automata)
-- [Example of Hill Climbing Algorithm](https://www.baeldung.com/java-hill-climbing-algorithm)
-- [Introduction to Minimax Algorithm](https://www.baeldung.com/java-minimax-algorithm)
+- [Example of Hill Climbing Algorithm in Java](https://www.baeldung.com/java-hill-climbing-algorithm)
+- [Introduction to Minimax Algorithm with a Java Implementation](https://www.baeldung.com/java-minimax-algorithm)
- [How to Calculate Levenshtein Distance in Java?](https://www.baeldung.com/java-levenshtein-distance)
- [How to Find the Kth Largest Element in Java](https://www.baeldung.com/java-kth-largest-element)
-- More articles: [[next -->]](/../algorithms-miscellaneous-2)
+- More articles: [[next -->]](/algorithms-miscellaneous-2)
diff --git a/algorithms-miscellaneous-2/README.md b/algorithms-miscellaneous-2/README.md
index 26737b61f0..265416534e 100644
--- a/algorithms-miscellaneous-2/README.md
+++ b/algorithms-miscellaneous-2/README.md
@@ -14,4 +14,4 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
- [Displaying Money Amounts in Words](https://www.baeldung.com/java-money-into-words)
- [A Collaborative Filtering Recommendation System in Java](https://www.baeldung.com/java-collaborative-filtering-recommendations)
- [Implementing A* Pathfinding in Java](https://www.baeldung.com/java-a-star-pathfinding)
-- More articles: [[<-- prev]](/../algorithms-miscellaneous-1) [[next -->]](/../algorithms-miscellaneous-3)
+- More articles: [[<-- prev]](/algorithms-miscellaneous-1) [[next -->]](/algorithms-miscellaneous-3)
diff --git a/algorithms-miscellaneous-4/README.md b/algorithms-miscellaneous-4/README.md
index fd33b58d72..2649df9fc9 100644
--- a/algorithms-miscellaneous-4/README.md
+++ b/algorithms-miscellaneous-4/README.md
@@ -5,8 +5,8 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
### Relevant articles:
- [Multi-Swarm Optimization Algorithm in Java](https://www.baeldung.com/java-multi-swarm-algorithm)
-- [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters)
-- [Find the Middle Element of a Linked List](https://www.baeldung.com/java-linked-list-middle-element)
+- [Check If a String Contains All The Letters of The Alphabet with Java](https://www.baeldung.com/java-string-contains-all-letters)
+- [Find the Middle Element of a Linked List in Java](https://www.baeldung.com/java-linked-list-middle-element)
- [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings)
- [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters)
- [Permutations of an Array in Java](https://www.baeldung.com/java-array-permutations)
diff --git a/algorithms-miscellaneous-5/README.md b/algorithms-miscellaneous-5/README.md
index 3e6eeb4c93..54b936586f 100644
--- a/algorithms-miscellaneous-5/README.md
+++ b/algorithms-miscellaneous-5/README.md
@@ -9,11 +9,11 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
- [Reversing a Binary Tree in Java](https://www.baeldung.com/java-reversing-a-binary-tree)
- [Find If Two Numbers Are Relatively Prime in Java](https://www.baeldung.com/java-two-relatively-prime-numbers)
- [Knapsack Problem Implementation in Java](https://www.baeldung.com/java-knapsack)
-- [How to Determine if a Binary Tree is Balanced](https://www.baeldung.com/java-balanced-binary-tree)
+- [How to Determine if a Binary Tree is Balanced in Java](https://www.baeldung.com/java-balanced-binary-tree)
- [Overview of Combinatorial Problems in Java](https://www.baeldung.com/java-combinatorial-algorithms)
-- [Prim’s Algorithm](https://www.baeldung.com/java-prim-algorithm)
-- [Maximum Subarray Problem](https://www.baeldung.com/java-maximum-subarray)
-- [How to Merge Two Sorted Arrays](https://www.baeldung.com/java-merge-sorted-arrays)
-- [Median of Stream of Integers using Heap](https://www.baeldung.com/java-stream-integers-median-using-heap)
-- More articles: [[<-- prev]](/../algorithms-miscellaneous-4) [[next -->]](/../algorithms-miscellaneous-6)
+- [Prim’s Algorithm with a Java Implementation](https://www.baeldung.com/java-prim-algorithm)
+- [Maximum Subarray Problem in Java](https://www.baeldung.com/java-maximum-subarray)
+- [How to Merge Two Sorted Arrays in Java](https://www.baeldung.com/java-merge-sorted-arrays)
+- [Median of Stream of Integers using Heap in Java](https://www.baeldung.com/java-stream-integers-median-using-heap)
+- More articles: [[<-- prev]](/algorithms-miscellaneous-4) [[next -->]](/algorithms-miscellaneous-6)
diff --git a/algorithms-miscellaneous-6/README.md b/algorithms-miscellaneous-6/README.md
index 6ddae75f43..f21eddeed8 100644
--- a/algorithms-miscellaneous-6/README.md
+++ b/algorithms-miscellaneous-6/README.md
@@ -1,12 +1,13 @@
### Relevant Articles:
-- [Boruvka’s Algorithm for Minimum Spanning Trees](https://www.baeldung.com/java-boruvka-algorithm)
+- [Boruvka’s Algorithm for Minimum Spanning Trees in Java](https://www.baeldung.com/java-boruvka-algorithm)
- [Gradient Descent in Java](https://www.baeldung.com/java-gradient-descent)
-- [Kruskal’s Algorithm for Spanning Trees](https://www.baeldung.com/java-spanning-trees-kruskal)
+- [Kruskal’s Algorithm for Spanning Trees with a Java Implementation](https://www.baeldung.com/java-spanning-trees-kruskal)
- [Balanced Brackets Algorithm in Java](https://www.baeldung.com/java-balanced-brackets-algorithm)
- [Efficiently Merge Sorted Java Sequences](https://www.baeldung.com/java-merge-sorted-sequences)
- [Introduction to Greedy Algorithms with Java](https://www.baeldung.com/java-greedy-algorithms)
- [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher)
- [Implementing a 2048 Solver in Java](https://www.baeldung.com/2048-java-solver)
-- [Finding Top K Elements in an Array](https://www.baeldung.com/java-array-top-elements)
-- More articles: [[<-- prev]](/../algorithms-miscellaneous-5)
+- [Finding Top K Elements in a Java Array](https://www.baeldung.com/java-array-top-elements)
+- [Reversing a Linked List in Java](https://www.baeldung.com/java-reverse-linked-list)
+- More articles: [[<-- prev]](/algorithms-miscellaneous-5)
diff --git a/algorithms-searching/README.md b/algorithms-searching/README.md
index a3ea023da3..7d10100832 100644
--- a/algorithms-searching/README.md
+++ b/algorithms-searching/README.md
@@ -8,8 +8,8 @@ This module contains articles about searching algorithms.
- [Depth First Search in Java](https://www.baeldung.com/java-depth-first-search)
- [Interpolation Search in Java](https://www.baeldung.com/java-interpolation-search)
- [Breadth-First Search Algorithm in Java](https://www.baeldung.com/java-breadth-first-search)
-- [String Search Algorithms for Large Texts](https://www.baeldung.com/java-full-text-search-algorithms)
-- [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search)
+- [String Search Algorithms for Large Texts with Java](https://www.baeldung.com/java-full-text-search-algorithms)
+- [Monte Carlo Tree Search for Tic-Tac-Toe Game in Java](https://www.baeldung.com/java-monte-carlo-tree-search)
- [Range Search Algorithm in Java](https://www.baeldung.com/java-range-search)
-- [Fast Pattern Matching of Strings Using Suffix Tree](https://www.baeldung.com/java-pattern-matching-suffix-tree)
-- [Find the Kth Smallest Element in Two Sorted Arrays](https://www.baeldung.com/java-kth-smallest-element-in-sorted-arrays)
+- [Fast Pattern Matching of Strings Using Suffix Tree in Java](https://www.baeldung.com/java-pattern-matching-suffix-tree)
+- [Find the Kth Smallest Element in Two Sorted Arrays in Java](https://www.baeldung.com/java-kth-smallest-element-in-sorted-arrays)
diff --git a/algorithms-sorting-2/README.md b/algorithms-sorting-2/README.md
index 71c9b8f86c..b31cfceb42 100644
--- a/algorithms-sorting-2/README.md
+++ b/algorithms-sorting-2/README.md
@@ -2,6 +2,6 @@
- [Sorting a String Alphabetically in Java](https://www.baeldung.com/java-sort-string-alphabetically)
- [Sorting Strings by Contained Numbers in Java](https://www.baeldung.com/java-sort-strings-contained-numbers)
-- [How an In-Place Sorting Algorithm Works](https://www.baeldung.com/java-in-place-sorting)
-- [Partitioning and Sorting Arrays with Many Repeated Entries](https://www.baeldung.com/java-sorting-arrays-with-repeated-entries)
+- [Guide to In-Place Sorting Algorithm Works with a Java Implementation](https://www.baeldung.com/java-in-place-sorting)
+- [Partitioning and Sorting Arrays with Many Repeated Entries with Java Examples](https://www.baeldung.com/java-sorting-arrays-with-repeated-entries)
- More articles: [[<-- prev]](/algorithms-sorting)
diff --git a/apache-libraries/pom.xml b/apache-libraries/pom.xml
index 9f800f1e0b..15404676cc 100644
--- a/apache-libraries/pom.xml
+++ b/apache-libraries/pom.xml
@@ -129,6 +129,11 @@
zookeeper
${zookeeper.version}
+
+ com.fasterxml.jackson.core
+ jackson-core
+ ${jackson.version}
+
com.fasterxml.jackson.core
jackson-databind
diff --git a/apache-spark/README.md b/apache-spark/README.md
index c60b556d51..3a2d2f4e15 100644
--- a/apache-spark/README.md
+++ b/apache-spark/README.md
@@ -8,3 +8,4 @@ This module contains articles about Apache Spark
- [Building a Data Pipeline with Kafka, Spark Streaming and Cassandra](https://www.baeldung.com/kafka-spark-data-pipeline)
- [Machine Learning with Spark MLlib](https://www.baeldung.com/spark-mlib-machine-learning)
- [Introduction to Spark Graph Processing with GraphFrames](https://www.baeldung.com/spark-graph-graphframes)
+- [Apache Spark: Differences between Dataframes, Datasets and RDDs](https://www.baeldung.com/java-spark-dataframe-dataset-rdd)
diff --git a/apache-spark/data/Tourist.csv b/apache-spark/data/Tourist.csv
new file mode 100644
index 0000000000..4970e8c2f0
--- /dev/null
+++ b/apache-spark/data/Tourist.csv
@@ -0,0 +1,2247 @@
+Region,Country,Year,Series,Series_Type,Series_Type_Footnote,Value,Footnotes,Source
+4,Afghanistan,2010,Tourism expenditure (millions of US dollars),,,147.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+4,Afghanistan,2016,Tourism expenditure (millions of US dollars),,,62.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+4,Afghanistan,2017,Tourism expenditure (millions of US dollars),,,16.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+4,Afghanistan,2018,Tourism expenditure (millions of US dollars),,,50.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2010,Tourist/visitor arrivals (thousands),TF,,2191.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2016,Tourist/visitor arrivals (thousands),TF,,4070.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2017,Tourist/visitor arrivals (thousands),TF,,4643.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2018,Tourist/visitor arrivals (thousands),TF,,5340.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,1995,Tourism expenditure (millions of US dollars),,,70.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2005,Tourism expenditure (millions of US dollars),,,880.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2010,Tourism expenditure (millions of US dollars),,,1778.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2016,Tourism expenditure (millions of US dollars),,,1821.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2017,Tourism expenditure (millions of US dollars),,,2050.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+8,Albania,2018,Tourism expenditure (millions of US dollars),,,2306.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,1995,Tourist/visitor arrivals (thousands),VF,,520.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2005,Tourist/visitor arrivals (thousands),VF,,1443.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2010,Tourist/visitor arrivals (thousands),VF,,2070.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2016,Tourist/visitor arrivals (thousands),VF,,2039.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2017,Tourist/visitor arrivals (thousands),VF,,2451.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2018,Tourist/visitor arrivals (thousands),VF,,2657.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2005,Tourism expenditure (millions of US dollars),,,477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2010,Tourism expenditure (millions of US dollars),,,324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2016,Tourism expenditure (millions of US dollars),,,246.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+12,Algeria,2017,Tourism expenditure (millions of US dollars),,,172.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+16,American Samoa,1995,Tourist/visitor arrivals (thousands),TF,,34.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+16,American Samoa,2005,Tourist/visitor arrivals (thousands),TF,,24.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+16,American Samoa,2010,Tourist/visitor arrivals (thousands),TF,,23.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+16,American Samoa,2016,Tourist/visitor arrivals (thousands),TF,,20.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+16,American Samoa,2017,Tourist/visitor arrivals (thousands),TF,,20.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+16,American Samoa,2018,Tourist/visitor arrivals (thousands),TF,,20.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+16,American Samoa,2016,Tourism expenditure (millions of US dollars),,,22.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+16,American Samoa,2017,Tourism expenditure (millions of US dollars),,,22.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+20,Andorra,2005,Tourist/visitor arrivals (thousands),TF,,2418.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+20,Andorra,2010,Tourist/visitor arrivals (thousands),TF,,1808.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+20,Andorra,2016,Tourist/visitor arrivals (thousands),TF,,2819.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+20,Andorra,2017,Tourist/visitor arrivals (thousands),TF,,3003.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+20,Andorra,2018,Tourist/visitor arrivals (thousands),TF,,3042.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,1995,Tourist/visitor arrivals (thousands),TF,,9.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2005,Tourist/visitor arrivals (thousands),TF,,210.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2010,Tourist/visitor arrivals (thousands),TF,,425.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2016,Tourist/visitor arrivals (thousands),TF,,397.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2017,Tourist/visitor arrivals (thousands),TF,,261.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2018,Tourist/visitor arrivals (thousands),TF,,218.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,1995,Tourism expenditure (millions of US dollars),,,27.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2005,Tourism expenditure (millions of US dollars),,,103.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2010,Tourism expenditure (millions of US dollars),,,726.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2016,Tourism expenditure (millions of US dollars),,,628.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2017,Tourism expenditure (millions of US dollars),,,884.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+24,Angola,2018,Tourism expenditure (millions of US dollars),,,557.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,1995,Tourist/visitor arrivals (thousands),TF,,39.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2005,Tourist/visitor arrivals (thousands),TF,,62.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2010,Tourist/visitor arrivals (thousands),TF,,62.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2016,Tourist/visitor arrivals (thousands),TF,,79.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2017,Tourist/visitor arrivals (thousands),TF,,68.3000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2018,Tourist/visitor arrivals (thousands),TF,,55.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,1995,Tourism expenditure (millions of US dollars),,,50.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2005,Tourism expenditure (millions of US dollars),,,86.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2010,Tourism expenditure (millions of US dollars),,,99.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2016,Tourism expenditure (millions of US dollars),,,136.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2017,Tourism expenditure (millions of US dollars),,,141.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+660,Anguilla,2018,Tourism expenditure (millions of US dollars),,,102.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,1995,Tourist/visitor arrivals (thousands),TF,,220.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2005,Tourist/visitor arrivals (thousands),TF,,245.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2010,Tourist/visitor arrivals (thousands),TF,,230.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2016,Tourist/visitor arrivals (thousands),TF,,265.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2017,Tourist/visitor arrivals (thousands),TF,,247.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2018,Tourist/visitor arrivals (thousands),TF,,269.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,1995,Tourism expenditure (millions of US dollars),,,247.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2005,Tourism expenditure (millions of US dollars),,,309.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2010,Tourism expenditure (millions of US dollars),,,298.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2016,Tourism expenditure (millions of US dollars),,,753.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2017,Tourism expenditure (millions of US dollars),,,737.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+28,Antigua and Barbuda,2018,Tourism expenditure (millions of US dollars),,,881.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,1995,Tourist/visitor arrivals (thousands),TF,,2289.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2005,Tourist/visitor arrivals (thousands),TF,,3823.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2010,Tourist/visitor arrivals (thousands),TF,,6800.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2016,Tourist/visitor arrivals (thousands),TF,,6668.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2017,Tourist/visitor arrivals (thousands),TF,,6711.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2018,Tourist/visitor arrivals (thousands),TF,,6942.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,1995,Tourism expenditure (millions of US dollars),,,2550.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2005,Tourism expenditure (millions of US dollars),,,3209.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2010,Tourism expenditure (millions of US dollars),,,5605.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2016,Tourism expenditure (millions of US dollars),,,5466.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2017,Tourism expenditure (millions of US dollars),,,5835.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+32,Argentina,2018,Tourism expenditure (millions of US dollars),,,5999.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,1995,Tourist/visitor arrivals (thousands),TF,,12.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2005,Tourist/visitor arrivals (thousands),TF,,319.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2010,Tourist/visitor arrivals (thousands),TF,,684.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2016,Tourist/visitor arrivals (thousands),TF,,1260.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2017,Tourist/visitor arrivals (thousands),TF,,1495.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2018,Tourist/visitor arrivals (thousands),TF,,1652.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,1995,Tourism expenditure (millions of US dollars),,,14.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2005,Tourism expenditure (millions of US dollars),,,243.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2010,Tourism expenditure (millions of US dollars),,,694.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2016,Tourism expenditure (millions of US dollars),,,988.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2017,Tourism expenditure (millions of US dollars),,,1140.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+51,Armenia,2018,Tourism expenditure (millions of US dollars),,,1237.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,1995,Tourist/visitor arrivals (thousands),TF,,619.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2005,Tourist/visitor arrivals (thousands),TF,,733.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2010,Tourist/visitor arrivals (thousands),TF,,824.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2016,Tourist/visitor arrivals (thousands),TF,,1102.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2017,Tourist/visitor arrivals (thousands),TF,,1070.5000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2018,Tourist/visitor arrivals (thousands),TF,,1082.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,1995,Tourism expenditure (millions of US dollars),,,554.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2005,Tourism expenditure (millions of US dollars),,,1097.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2010,Tourism expenditure (millions of US dollars),,,1254.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2016,Tourism expenditure (millions of US dollars),,,1764.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2017,Tourism expenditure (millions of US dollars),,,1857.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+533,Aruba,2018,Tourism expenditure (millions of US dollars),,,2024.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,1995,Tourist/visitor arrivals (thousands),VF,,3726.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2005,Tourist/visitor arrivals (thousands),VF,,5499.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2010,Tourist/visitor arrivals (thousands),VF,,5790.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2016,Tourist/visitor arrivals (thousands),VF,,8269.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2017,Tourist/visitor arrivals (thousands),VF,,8815.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2018,Tourist/visitor arrivals (thousands),VF,,9246.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,1995,Tourism expenditure (millions of US dollars),,,10370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2005,Tourism expenditure (millions of US dollars),,,19719.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2010,Tourism expenditure (millions of US dollars),,,31064.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2016,Tourism expenditure (millions of US dollars),,,39059.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2017,Tourism expenditure (millions of US dollars),,,43975.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+36,Australia,2018,Tourism expenditure (millions of US dollars),,,47327.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,1995,Tourist/visitor arrivals (thousands),TCE,,17173.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2005,Tourist/visitor arrivals (thousands),TCE,,19952.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2010,Tourist/visitor arrivals (thousands),TCE,,22004.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2016,Tourist/visitor arrivals (thousands),TCE,,28121.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2017,Tourist/visitor arrivals (thousands),TCE,,29460.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2018,Tourist/visitor arrivals (thousands),TCE,,30816.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,1995,Tourism expenditure (millions of US dollars),,,13435.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2005,Tourism expenditure (millions of US dollars),,,16243.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2010,Tourism expenditure (millions of US dollars),,,18751.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2016,Tourism expenditure (millions of US dollars),,,19244.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2017,Tourism expenditure (millions of US dollars),,,20333.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+40,Austria,2018,Tourism expenditure (millions of US dollars),,,23233.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2005,Tourist/visitor arrivals (thousands),TF,,693.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2010,Tourist/visitor arrivals (thousands),TF,,1280.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2016,Tourist/visitor arrivals (thousands),TF,,2044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2017,Tourist/visitor arrivals (thousands),TF,,2454.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2018,Tourist/visitor arrivals (thousands),TF,,2633.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,1995,Tourism expenditure (millions of US dollars),,,87.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2005,Tourism expenditure (millions of US dollars),,,100.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2010,Tourism expenditure (millions of US dollars),,,792.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2016,Tourism expenditure (millions of US dollars),,,2855.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2017,Tourism expenditure (millions of US dollars),,,3214.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+31,Azerbaijan,2018,Tourism expenditure (millions of US dollars),,,2830.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,1995,Tourist/visitor arrivals (thousands),TF,,1598.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2005,Tourist/visitor arrivals (thousands),TF,,1608.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2010,Tourist/visitor arrivals (thousands),TF,,1370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2016,Tourist/visitor arrivals (thousands),TF,,1500.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2017,Tourist/visitor arrivals (thousands),TF,,1442.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2018,Tourist/visitor arrivals (thousands),TF,,1633.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,1995,Tourism expenditure (millions of US dollars),,,1356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2005,Tourism expenditure (millions of US dollars),,,2081.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2010,Tourism expenditure (millions of US dollars),,,2159.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2016,Tourism expenditure (millions of US dollars),,,3091.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2017,Tourism expenditure (millions of US dollars),,,3017.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+44,Bahamas,2018,Tourism expenditure (millions of US dollars),,,3383.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,1995,Tourist/visitor arrivals (thousands),VF,,2311.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2005,Tourist/visitor arrivals (thousands),VF,,6313.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2010,Tourist/visitor arrivals (thousands),VF,,11952.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2016,Tourist/visitor arrivals (thousands),VF,,10158.0000,Break in the time series.;Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2017,Tourist/visitor arrivals (thousands),VF,,11374.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2018,Tourist/visitor arrivals (thousands),VF,,12045.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,1995,Tourism expenditure (millions of US dollars),,,593.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2005,Tourism expenditure (millions of US dollars),,,1603.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2010,Tourism expenditure (millions of US dollars),,,2163.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2016,Tourism expenditure (millions of US dollars),,,4021.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2017,Tourism expenditure (millions of US dollars),,,4380.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+48,Bahrain,2018,Tourism expenditure (millions of US dollars),,,3834.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,1995,Tourist/visitor arrivals (thousands),TF,,156.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2005,Tourist/visitor arrivals (thousands),TF,,208.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2010,Tourist/visitor arrivals (thousands),TF,,303.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2016,Tourist/visitor arrivals (thousands),TF,,830.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2017,Tourist/visitor arrivals (thousands),TF,,1026.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2005,Tourism expenditure (millions of US dollars),,,82.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2010,Tourism expenditure (millions of US dollars),,,103.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2016,Tourism expenditure (millions of US dollars),,,214.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2017,Tourism expenditure (millions of US dollars),,,348.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+50,Bangladesh,2018,Tourism expenditure (millions of US dollars),,,357.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,1995,Tourist/visitor arrivals (thousands),TF,,442.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,2005,Tourist/visitor arrivals (thousands),TF,,548.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,2010,Tourist/visitor arrivals (thousands),TF,,532.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,2016,Tourist/visitor arrivals (thousands),TF,,632.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,2017,Tourist/visitor arrivals (thousands),TF,,664.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,2018,Tourist/visitor arrivals (thousands),TF,,680.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,1995,Tourism expenditure (millions of US dollars),,,630.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,2005,Tourism expenditure (millions of US dollars),,,1081.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+52,Barbados,2010,Tourism expenditure (millions of US dollars),,,1074.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,1995,Tourist/visitor arrivals (thousands),TF,,160.6000,Excludes the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2005,Tourist/visitor arrivals (thousands),TF,,91.0000,Excludes the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2010,Tourist/visitor arrivals (thousands),TF,,119.3000,Excludes the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2016,Tourist/visitor arrivals (thousands),TF,,10935.4000,Includes estimation of the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2017,Tourist/visitor arrivals (thousands),TF,,11060.2000,Includes estimation of the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2018,Tourist/visitor arrivals (thousands),TF,,11501.6000,Includes estimation of the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,1995,Tourism expenditure (millions of US dollars),,,28.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2005,Tourism expenditure (millions of US dollars),,,346.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2010,Tourism expenditure (millions of US dollars),,,665.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2016,Tourism expenditure (millions of US dollars),,,1019.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2017,Tourism expenditure (millions of US dollars),,,1124.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+112,Belarus,2018,Tourism expenditure (millions of US dollars),,,1221.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,1995,Tourist/visitor arrivals (thousands),TCE,,5560.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2005,Tourist/visitor arrivals (thousands),TCE,,6747.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2010,Tourist/visitor arrivals (thousands),TCE,,7186.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2016,Tourist/visitor arrivals (thousands),TCE,,7481.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2017,Tourist/visitor arrivals (thousands),TCE,,8385.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2018,Tourist/visitor arrivals (thousands),TCE,,9119.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2005,Tourism expenditure (millions of US dollars),,,10881.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2010,Tourism expenditure (millions of US dollars),,,12680.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2016,Tourism expenditure (millions of US dollars),,,8784.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2017,Tourism expenditure (millions of US dollars),,,9636.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+56,Belgium,2018,Tourism expenditure (millions of US dollars),,,10381.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,1995,Tourist/visitor arrivals (thousands),TF,,131.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2005,Tourist/visitor arrivals (thousands),TF,,237.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2010,Tourist/visitor arrivals (thousands),TF,,242.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2016,Tourist/visitor arrivals (thousands),TF,,386.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2017,Tourist/visitor arrivals (thousands),TF,,427.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2018,Tourist/visitor arrivals (thousands),TF,,489.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,1995,Tourism expenditure (millions of US dollars),,,78.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2005,Tourism expenditure (millions of US dollars),,,214.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2010,Tourism expenditure (millions of US dollars),,,264.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2016,Tourism expenditure (millions of US dollars),,,391.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2017,Tourism expenditure (millions of US dollars),,,427.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+84,Belize,2018,Tourism expenditure (millions of US dollars),,,487.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,1995,Tourist/visitor arrivals (thousands),TF,,138.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2005,Tourist/visitor arrivals (thousands),TF,,176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2010,Tourist/visitor arrivals (thousands),TF,,199.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2016,Tourist/visitor arrivals (thousands),TF,,267.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2017,Tourist/visitor arrivals (thousands),TF,,281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2018,Tourist/visitor arrivals (thousands),TF,,295.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2005,Tourism expenditure (millions of US dollars),,,107.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2010,Tourism expenditure (millions of US dollars),,,149.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2016,Tourism expenditure (millions of US dollars),,,129.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+204,Benin,2017,Tourism expenditure (millions of US dollars),,,160.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,1995,Tourist/visitor arrivals (thousands),TF,,387.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2005,Tourist/visitor arrivals (thousands),TF,,270.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2010,Tourist/visitor arrivals (thousands),TF,,232.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2016,Tourist/visitor arrivals (thousands),TF,,244.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2017,Tourist/visitor arrivals (thousands),TF,,270.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2018,Tourist/visitor arrivals (thousands),TF,,282.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,1995,Tourism expenditure (millions of US dollars),,,488.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2005,Tourism expenditure (millions of US dollars),,,429.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2010,Tourism expenditure (millions of US dollars),,,442.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2016,Tourism expenditure (millions of US dollars),,,441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2017,Tourism expenditure (millions of US dollars),,,513.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+60,Bermuda,2018,Tourism expenditure (millions of US dollars),,,583.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,1995,Tourist/visitor arrivals (thousands),TF,,4.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2005,Tourist/visitor arrivals (thousands),TF,,13.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2010,Tourist/visitor arrivals (thousands),TF,,41.0000,Break in the time series.;Including regional high end tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2016,Tourist/visitor arrivals (thousands),TF,,210.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2017,Tourist/visitor arrivals (thousands),TF,,255.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2018,Tourist/visitor arrivals (thousands),TF,,274.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,1995,Tourism expenditure (millions of US dollars),,,5.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2005,Tourism expenditure (millions of US dollars),,,19.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2010,Tourism expenditure (millions of US dollars),,,64.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2016,Tourism expenditure (millions of US dollars),,,139.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2017,Tourism expenditure (millions of US dollars),,,153.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+64,Bhutan,2018,Tourism expenditure (millions of US dollars),,,121.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),1995,Tourist/visitor arrivals (thousands),TF,,284.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2005,Tourist/visitor arrivals (thousands),TF,,524.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2010,Tourist/visitor arrivals (thousands),TF,,679.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2016,Tourist/visitor arrivals (thousands),TF,,961.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2017,Tourist/visitor arrivals (thousands),TF,,1109.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2018,Tourist/visitor arrivals (thousands),TF,,1142.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),1995,Tourism expenditure (millions of US dollars),,,92.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2005,Tourism expenditure (millions of US dollars),,,345.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2010,Tourism expenditure (millions of US dollars),,,339.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2016,Tourism expenditure (millions of US dollars),,,827.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2017,Tourism expenditure (millions of US dollars),,,912.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+68,Bolivia (Plurin. State of),2018,Tourism expenditure (millions of US dollars),,,970.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+669,Bonaire,1995,Tourist/visitor arrivals (thousands),TF,,59.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+669,Bonaire,2005,Tourist/visitor arrivals (thousands),TF,,63.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+669,Bonaire,2010,Tourist/visitor arrivals (thousands),TF,,71.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+669,Bonaire,1995,Tourism expenditure (millions of US dollars),,,37.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+669,Bonaire,2005,Tourism expenditure (millions of US dollars),,,87.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2005,Tourist/visitor arrivals (thousands),TCE,,217.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2010,Tourist/visitor arrivals (thousands),TCE,,365.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2016,Tourist/visitor arrivals (thousands),TCE,,778.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2017,Tourist/visitor arrivals (thousands),TCE,,923.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2018,Tourist/visitor arrivals (thousands),TCE,,1053.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2005,Tourism expenditure (millions of US dollars),,,557.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2010,Tourism expenditure (millions of US dollars),,,662.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2016,Tourism expenditure (millions of US dollars),,,876.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2017,Tourism expenditure (millions of US dollars),,,985.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+70,Bosnia and Herzegovina,2018,Tourism expenditure (millions of US dollars),,,1081.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,1995,Tourist/visitor arrivals (thousands),TF,,521.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2005,Tourist/visitor arrivals (thousands),TF,,1474.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2010,Tourist/visitor arrivals (thousands),TF,,1973.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2016,Tourist/visitor arrivals (thousands),TF,,1574.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2017,Tourist/visitor arrivals (thousands),TF,,1623.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,1995,Tourism expenditure (millions of US dollars),,,176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2005,Tourism expenditure (millions of US dollars),,,563.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2010,Tourism expenditure (millions of US dollars),,,440.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2016,Tourism expenditure (millions of US dollars),,,505.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2017,Tourism expenditure (millions of US dollars),,,541.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+72,Botswana,2018,Tourism expenditure (millions of US dollars),,,575.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,1995,Tourist/visitor arrivals (thousands),TF,,1991.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2005,Tourist/visitor arrivals (thousands),TF,,5358.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2010,Tourist/visitor arrivals (thousands),TF,,5161.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2016,Tourist/visitor arrivals (thousands),TF,,6547.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2017,Tourist/visitor arrivals (thousands),TF,,6589.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2018,Tourist/visitor arrivals (thousands),TF,,6621.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,1995,Tourism expenditure (millions of US dollars),,,1085.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2005,Tourism expenditure (millions of US dollars),,,4168.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2010,Tourism expenditure (millions of US dollars),,,5522.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2016,Tourism expenditure (millions of US dollars),,,6613.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2017,Tourism expenditure (millions of US dollars),,,6175.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+76,Brazil,2018,Tourism expenditure (millions of US dollars),,,6324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,1995,Tourist/visitor arrivals (thousands),TF,,219.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,2005,Tourist/visitor arrivals (thousands),TF,,337.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,2010,Tourist/visitor arrivals (thousands),TF,,330.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,2016,Tourist/visitor arrivals (thousands),TF,,408.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,2017,Tourist/visitor arrivals (thousands),TF,,335.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,2018,Tourist/visitor arrivals (thousands),TF,,192.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,1995,Tourism expenditure (millions of US dollars),,,211.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,2005,Tourism expenditure (millions of US dollars),,,412.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+92,British Virgin Islands,2010,Tourism expenditure (millions of US dollars),,,389.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2005,Tourist/visitor arrivals (thousands),TF,,126.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2010,Tourist/visitor arrivals (thousands),TF,,214.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2016,Tourist/visitor arrivals (thousands),TF,,219.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2017,Tourist/visitor arrivals (thousands),TF,,259.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2018,Tourist/visitor arrivals (thousands),TF,,278.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2005,Tourism expenditure (millions of US dollars),,,191.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2016,Tourism expenditure (millions of US dollars),,,144.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2017,Tourism expenditure (millions of US dollars),,,177.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+96,Brunei Darussalam,2018,Tourism expenditure (millions of US dollars),,,190.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,1995,Tourist/visitor arrivals (thousands),TF,,3466.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2005,Tourist/visitor arrivals (thousands),TF,,4837.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2010,Tourist/visitor arrivals (thousands),TF,,6047.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2016,Tourist/visitor arrivals (thousands),TF,,8252.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2017,Tourist/visitor arrivals (thousands),TF,,8883.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2018,Tourist/visitor arrivals (thousands),TF,,9273.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,1995,Tourism expenditure (millions of US dollars),,,662.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2005,Tourism expenditure (millions of US dollars),,,3063.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2010,Tourism expenditure (millions of US dollars),,,3807.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2016,Tourism expenditure (millions of US dollars),,,4164.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2017,Tourism expenditure (millions of US dollars),,,4678.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+100,Bulgaria,2018,Tourism expenditure (millions of US dollars),,,5072.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,1995,Tourist/visitor arrivals (thousands),THS,,124.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2005,Tourist/visitor arrivals (thousands),THS,,245.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2010,Tourist/visitor arrivals (thousands),THS,,274.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2016,Tourist/visitor arrivals (thousands),THS,,152.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2017,Tourist/visitor arrivals (thousands),THS,,143.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2018,Tourist/visitor arrivals (thousands),THS,,144.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2005,Tourism expenditure (millions of US dollars),,,46.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2010,Tourism expenditure (millions of US dollars),,,105.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2016,Tourism expenditure (millions of US dollars),,,172.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+854,Burkina Faso,2017,Tourism expenditure (millions of US dollars),,,172.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+108,Burundi,1995,Tourist/visitor arrivals (thousands),TF,,34.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+108,Burundi,2005,Tourist/visitor arrivals (thousands),TF,,148.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+108,Burundi,2010,Tourist/visitor arrivals (thousands),TF,,142.0000,Break in the time series.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+108,Burundi,2016,Tourist/visitor arrivals (thousands),TF,,187.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+108,Burundi,2017,Tourist/visitor arrivals (thousands),TF,,299.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+108,Burundi,1995,Tourism expenditure (millions of US dollars),,,2.4250,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+108,Burundi,2005,Tourism expenditure (millions of US dollars),,,1.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+108,Burundi,2010,Tourism expenditure (millions of US dollars),,,2.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,1995,Tourist/visitor arrivals (thousands),TF,,28.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2005,Tourist/visitor arrivals (thousands),TF,,198.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2010,Tourist/visitor arrivals (thousands),TF,,336.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2016,Tourist/visitor arrivals (thousands),TF,,598.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2017,Tourist/visitor arrivals (thousands),TF,,668.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2018,Tourist/visitor arrivals (thousands),TF,,710.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,1995,Tourism expenditure (millions of US dollars),,,29.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2005,Tourism expenditure (millions of US dollars),,,177.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2010,Tourism expenditure (millions of US dollars),,,387.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2016,Tourism expenditure (millions of US dollars),,,397.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2017,Tourism expenditure (millions of US dollars),,,450.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+132,Cabo Verde,2018,Tourism expenditure (millions of US dollars),,,524.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,1995,Tourist/visitor arrivals (thousands),TF,,220.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2005,Tourist/visitor arrivals (thousands),TF,,1422.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2010,Tourist/visitor arrivals (thousands),TF,,2508.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2016,Tourist/visitor arrivals (thousands),TF,,5012.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2017,Tourist/visitor arrivals (thousands),TF,,5602.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2018,Tourist/visitor arrivals (thousands),TF,,6201.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,1995,Tourism expenditure (millions of US dollars),,,71.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2005,Tourism expenditure (millions of US dollars),,,929.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2010,Tourism expenditure (millions of US dollars),,,1671.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2016,Tourism expenditure (millions of US dollars),,,3523.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2017,Tourism expenditure (millions of US dollars),,,4024.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+116,Cambodia,2018,Tourism expenditure (millions of US dollars),,,4832.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,2010,Tourist/visitor arrivals (thousands),VF,,573.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,2016,Tourist/visitor arrivals (thousands),VF,,994.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,2017,Tourist/visitor arrivals (thousands),VF,,1081.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,1995,Tourism expenditure (millions of US dollars),,,75.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,2005,Tourism expenditure (millions of US dollars),,,229.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,2010,Tourism expenditure (millions of US dollars),,,171.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,2016,Tourism expenditure (millions of US dollars),,,508.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,2017,Tourism expenditure (millions of US dollars),,,543.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+120,Cameroon,2018,Tourism expenditure (millions of US dollars),,,633.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,1995,Tourist/visitor arrivals (thousands),TF,,16932.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,2005,Tourist/visitor arrivals (thousands),TF,,18771.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,2010,Tourist/visitor arrivals (thousands),TF,,16219.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,2016,Tourist/visitor arrivals (thousands),TF,,19971.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,2017,Tourist/visitor arrivals (thousands),TF,,20883.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,2018,Tourist/visitor arrivals (thousands),TF,,21134.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,1995,Tourism expenditure (millions of US dollars),,,9176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,2005,Tourism expenditure (millions of US dollars),,,15887.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+124,Canada,2010,Tourism expenditure (millions of US dollars),,,18439.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,1995,Tourist/visitor arrivals (thousands),TF,,361.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2005,Tourist/visitor arrivals (thousands),TF,,168.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2010,Tourist/visitor arrivals (thousands),TF,,288.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2016,Tourist/visitor arrivals (thousands),TF,,385.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2017,Tourist/visitor arrivals (thousands),TF,,418.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2018,Tourist/visitor arrivals (thousands),TF,,463.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,1995,Tourism expenditure (millions of US dollars),,,394.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2005,Tourism expenditure (millions of US dollars),,,356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2010,Tourism expenditure (millions of US dollars),,,465.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2016,Tourism expenditure (millions of US dollars),,,696.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2017,Tourism expenditure (millions of US dollars),,,782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+136,Cayman Islands,2018,Tourism expenditure (millions of US dollars),,,880.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+140,Central African Republic,1995,Tourist/visitor arrivals (thousands),TF,,26.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+140,Central African Republic,2005,Tourist/visitor arrivals (thousands),TF,,12.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+140,Central African Republic,2010,Tourist/visitor arrivals (thousands),TF,,53.8000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+140,Central African Republic,2016,Tourist/visitor arrivals (thousands),TF,,82.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+140,Central African Republic,2017,Tourist/visitor arrivals (thousands),TF,,107.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+140,Central African Republic,1995,Tourism expenditure (millions of US dollars),,,4.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+140,Central African Republic,2005,Tourism expenditure (millions of US dollars),,,7.2000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+140,Central African Republic,2010,Tourism expenditure (millions of US dollars),,,14.4000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+148,Chad,2010,Tourist/visitor arrivals (thousands),TF,,71.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+148,Chad,2016,Tourist/visitor arrivals (thousands),TF,,98.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+148,Chad,2017,Tourist/visitor arrivals (thousands),TF,,87.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+148,Chad,1995,Tourism expenditure (millions of US dollars),,,43.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,1995,Tourist/visitor arrivals (thousands),TF,,1540.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2005,Tourist/visitor arrivals (thousands),TF,,2027.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2010,Tourist/visitor arrivals (thousands),TF,,2801.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2016,Tourist/visitor arrivals (thousands),TF,,5641.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2017,Tourist/visitor arrivals (thousands),TF,,6450.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2018,Tourist/visitor arrivals (thousands),TF,,5723.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,1995,Tourism expenditure (millions of US dollars),,,1186.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2005,Tourism expenditure (millions of US dollars),,,1608.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2010,Tourism expenditure (millions of US dollars),,,2362.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2016,Tourism expenditure (millions of US dollars),,,3744.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2017,Tourism expenditure (millions of US dollars),,,4372.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+152,Chile,2018,Tourism expenditure (millions of US dollars),,,3972.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,1995,Tourist/visitor arrivals (thousands),TF,,20034.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2005,Tourist/visitor arrivals (thousands),TF,,46809.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2010,Tourist/visitor arrivals (thousands),TF,,55664.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2016,Tourist/visitor arrivals (thousands),TF,,59270.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2017,Tourist/visitor arrivals (thousands),TF,,60740.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2018,Tourist/visitor arrivals (thousands),TF,,62900.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,1995,Tourism expenditure (millions of US dollars),,,8730.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2005,Tourism expenditure (millions of US dollars),,,29296.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2010,Tourism expenditure (millions of US dollars),,,45814.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2016,Tourism expenditure (millions of US dollars),,,44432.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2017,Tourism expenditure (millions of US dollars),,,38559.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+156,China,2018,Tourism expenditure (millions of US dollars),,,40386.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2005,Tourist/visitor arrivals (thousands),TF,,14773.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2010,Tourist/visitor arrivals (thousands),TF,,20085.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2016,Tourist/visitor arrivals (thousands),TF,,26553.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2017,Tourist/visitor arrivals (thousands),TF,,27884.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2018,Tourist/visitor arrivals (thousands),TF,,29263.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2005,Tourism expenditure (millions of US dollars),,,13588.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2010,Tourism expenditure (millions of US dollars),,,27208.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2016,Tourism expenditure (millions of US dollars),,,37838.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2017,Tourism expenditure (millions of US dollars),,,38170.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+344,"China, Hong Kong SAR",2018,Tourism expenditure (millions of US dollars),,,41870.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",1995,Tourist/visitor arrivals (thousands),TF,,4202.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2005,Tourist/visitor arrivals (thousands),TF,,9014.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2010,Tourist/visitor arrivals (thousands),TF,,11926.0000,"Does not include other non-residents namely workers, students, etc.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2016,Tourist/visitor arrivals (thousands),TF,,15703.6000,"Does not include other non-residents namely workers, students, etc.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2017,Tourist/visitor arrivals (thousands),TF,,17255.0000,"Does not include other non-residents namely workers, students, etc.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2018,Tourist/visitor arrivals (thousands),TF,,18493.0000,"Does not include other non-residents namely workers, students, etc.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",1995,Tourism expenditure (millions of US dollars),,,3233.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2005,Tourism expenditure (millions of US dollars),,,7181.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2010,Tourism expenditure (millions of US dollars),,,22688.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2016,Tourism expenditure (millions of US dollars),,,31015.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2017,Tourism expenditure (millions of US dollars),,,36465.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+446,"China, Macao SAR",2018,Tourism expenditure (millions of US dollars),,,40358.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,1995,Tourist/visitor arrivals (thousands),TF,,1399.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2005,Tourist/visitor arrivals (thousands),TF,,933.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2010,Tourist/visitor arrivals (thousands),TF,,1405.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2016,Tourist/visitor arrivals (thousands),TF,,3254.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2017,Tourist/visitor arrivals (thousands),TF,,3631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2018,Tourist/visitor arrivals (thousands),TF,,3904.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,1995,Tourism expenditure (millions of US dollars),,,887.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2005,Tourism expenditure (millions of US dollars),,,1891.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2010,Tourism expenditure (millions of US dollars),,,3441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2016,Tourism expenditure (millions of US dollars),,,5584.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2017,Tourism expenditure (millions of US dollars),,,5882.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+170,Colombia,2018,Tourism expenditure (millions of US dollars),,,6617.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,1995,Tourist/visitor arrivals (thousands),TF,,23.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2005,Tourist/visitor arrivals (thousands),TF,,25.9000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2010,Tourist/visitor arrivals (thousands),TF,,15.3000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2016,Tourist/visitor arrivals (thousands),TF,,26.8000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2017,Tourist/visitor arrivals (thousands),TF,,28.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2018,Tourist/visitor arrivals (thousands),TF,,35.9000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,1995,Tourism expenditure (millions of US dollars),,,22.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2005,Tourism expenditure (millions of US dollars),,,24.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2010,Tourism expenditure (millions of US dollars),,,35.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2016,Tourism expenditure (millions of US dollars),,,50.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2017,Tourism expenditure (millions of US dollars),,,60.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+174,Comoros,2018,Tourism expenditure (millions of US dollars),,,76.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+178,Congo,2005,Tourist/visitor arrivals (thousands),TF,,35.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+178,Congo,2010,Tourist/visitor arrivals (thousands),TF,,194.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+178,Congo,2016,Tourist/visitor arrivals (thousands),TF,,211.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+178,Congo,2017,Tourist/visitor arrivals (thousands),TF,,149.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+178,Congo,2018,Tourist/visitor arrivals (thousands),TF,,156.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+178,Congo,1995,Tourism expenditure (millions of US dollars),,,14.6691,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+178,Congo,2010,Tourism expenditure (millions of US dollars),,,39.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+178,Congo,2016,Tourism expenditure (millions of US dollars),,,42.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,1995,Tourist/visitor arrivals (thousands),TF,,48.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2005,Tourist/visitor arrivals (thousands),TF,,88.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2010,Tourist/visitor arrivals (thousands),TF,,104.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2016,Tourist/visitor arrivals (thousands),TF,,146.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2017,Tourist/visitor arrivals (thousands),TF,,161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2018,Tourist/visitor arrivals (thousands),TF,,169.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,1995,Tourism expenditure (millions of US dollars),,,28.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2005,Tourism expenditure (millions of US dollars),,,91.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2010,Tourism expenditure (millions of US dollars),,,111.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2016,Tourism expenditure (millions of US dollars),,,137.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+184,Cook Islands,2017,Tourism expenditure (millions of US dollars),,,153.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,1995,Tourist/visitor arrivals (thousands),TF,,785.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2005,Tourist/visitor arrivals (thousands),TF,,1679.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2010,Tourist/visitor arrivals (thousands),TF,,2100.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2016,Tourist/visitor arrivals (thousands),TF,,2925.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2017,Tourist/visitor arrivals (thousands),TF,,2960.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2018,Tourist/visitor arrivals (thousands),TF,,3017.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,1995,Tourism expenditure (millions of US dollars),,,763.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2005,Tourism expenditure (millions of US dollars),,,2008.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2010,Tourism expenditure (millions of US dollars),,,2426.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2016,Tourism expenditure (millions of US dollars),,,3776.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2017,Tourism expenditure (millions of US dollars),,,3826.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+188,Costa Rica,2018,Tourism expenditure (millions of US dollars),,,3995.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,2010,Tourist/visitor arrivals (thousands),VF,,252.0000,Arrivals to Félix Houphouët Boigny Airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,2016,Tourist/visitor arrivals (thousands),VF,,1583.0000,Arrivals to Félix Houphouët Boigny Airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,2017,Tourist/visitor arrivals (thousands),VF,,1800.0000,Arrivals to Félix Houphouët Boigny Airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,2018,Tourist/visitor arrivals (thousands),VF,,1965.0000,Arrivals to Félix Houphouët Boigny Airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,1995,Tourism expenditure (millions of US dollars),,,103.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,2005,Tourism expenditure (millions of US dollars),,,93.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,2010,Tourism expenditure (millions of US dollars),,,213.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,2016,Tourism expenditure (millions of US dollars),,,477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+384,Côte d’Ivoire,2017,Tourism expenditure (millions of US dollars),,,508.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,1995,Tourist/visitor arrivals (thousands),TCE,,1485.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2005,Tourist/visitor arrivals (thousands),TCE,,7743.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2010,Tourist/visitor arrivals (thousands),TCE,,9111.0000,Excluding arrivals in ports of nautical tourism.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2016,Tourist/visitor arrivals (thousands),TCE,,13809.0000,Excluding arrivals in ports of nautical tourism.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2017,Tourist/visitor arrivals (thousands),TCE,,15593.0000,Excluding arrivals in ports of nautical tourism.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2018,Tourist/visitor arrivals (thousands),TCE,,16645.0000,Excluding arrivals in ports of nautical tourism.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2005,Tourism expenditure (millions of US dollars),,,7625.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2010,Tourism expenditure (millions of US dollars),,,8299.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2016,Tourism expenditure (millions of US dollars),,,9820.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2017,Tourism expenditure (millions of US dollars),,,11128.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+191,Croatia,2018,Tourism expenditure (millions of US dollars),,,12075.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,1995,Tourist/visitor arrivals (thousands),TF,,742.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2005,Tourist/visitor arrivals (thousands),TF,,2261.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2010,Tourist/visitor arrivals (thousands),TF,,2507.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2016,Tourist/visitor arrivals (thousands),TF,,3975.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2017,Tourist/visitor arrivals (thousands),TF,,4594.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2018,Tourist/visitor arrivals (thousands),TF,,4684.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,1995,Tourism expenditure (millions of US dollars),,,1100.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2005,Tourism expenditure (millions of US dollars),,,2591.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2010,Tourism expenditure (millions of US dollars),,,2396.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2016,Tourism expenditure (millions of US dollars),,,3069.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2017,Tourism expenditure (millions of US dollars),,,3302.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+192,Cuba,2018,Tourism expenditure (millions of US dollars),,,2969.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,1995,Tourist/visitor arrivals (thousands),TF,,224.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2005,Tourist/visitor arrivals (thousands),TF,,222.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2010,Tourist/visitor arrivals (thousands),TF,,342.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2016,Tourist/visitor arrivals (thousands),TF,,441.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2017,Tourist/visitor arrivals (thousands),TF,,399.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2018,Tourist/visitor arrivals (thousands),TF,,432.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,1995,Tourism expenditure (millions of US dollars),,,175.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2005,Tourism expenditure (millions of US dollars),,,244.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2010,Tourism expenditure (millions of US dollars),,,438.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2016,Tourism expenditure (millions of US dollars),,,644.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2017,Tourism expenditure (millions of US dollars),,,572.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+531,Curaçao,2018,Tourism expenditure (millions of US dollars),,,605.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,1995,Tourist/visitor arrivals (thousands),TF,,2100.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2005,Tourist/visitor arrivals (thousands),TF,,2470.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2010,Tourist/visitor arrivals (thousands),TF,,2173.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2016,Tourist/visitor arrivals (thousands),TF,,3187.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2017,Tourist/visitor arrivals (thousands),TF,,3652.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2018,Tourist/visitor arrivals (thousands),TF,,3939.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,1995,Tourism expenditure (millions of US dollars),,,2018.0443,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2005,Tourism expenditure (millions of US dollars),,,2644.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2010,Tourism expenditure (millions of US dollars),,,2137.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2016,Tourism expenditure (millions of US dollars),,,2870.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2017,Tourism expenditure (millions of US dollars),,,3274.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+196,Cyprus,2018,Tourism expenditure (millions of US dollars),,,3449.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2005,Tourist/visitor arrivals (thousands),TF,,9404.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2010,Tourist/visitor arrivals (thousands),TF,,8629.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2016,Tourist/visitor arrivals (thousands),TF,,12808.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2017,Tourist/visitor arrivals (thousands),TF,,13665.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2005,Tourism expenditure (millions of US dollars),,,5772.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2010,Tourism expenditure (millions of US dollars),,,8068.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2016,Tourism expenditure (millions of US dollars),,,7041.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2017,Tourism expenditure (millions of US dollars),,,7695.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+203,Czechia,2018,Tourism expenditure (millions of US dollars),,,8291.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,1995,Tourist/visitor arrivals (thousands),TF,,35.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,2005,Tourist/visitor arrivals (thousands),TF,,61.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,2010,Tourist/visitor arrivals (thousands),TF,,81.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,2016,Tourist/visitor arrivals (thousands),TF,,351.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,2005,Tourism expenditure (millions of US dollars),,,3.2000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,2010,Tourism expenditure (millions of US dollars),,,10.7000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,2016,Tourism expenditure (millions of US dollars),,,4.3000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,2017,Tourism expenditure (millions of US dollars),,,6.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+180,Dem. Rep. of the Congo,2018,Tourism expenditure (millions of US dollars),,,60.5000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2005,Tourist/visitor arrivals (thousands),TCE,,9587.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2010,Tourist/visitor arrivals (thousands),TCE,,9425.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2016,Tourist/visitor arrivals (thousands),TCE,,10781.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2017,Tourist/visitor arrivals (thousands),TCE,,12426.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2018,Tourist/visitor arrivals (thousands),TCE,,12749.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,1995,Tourism expenditure (millions of US dollars),,,3691.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2005,Tourism expenditure (millions of US dollars),,,5293.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2010,Tourism expenditure (millions of US dollars),,,5704.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2016,Tourism expenditure (millions of US dollars),,,7494.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2017,Tourism expenditure (millions of US dollars),,,8508.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+208,Denmark,2018,Tourism expenditure (millions of US dollars),,,9097.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,1995,Tourist/visitor arrivals (thousands),THS,,21.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,2005,Tourist/visitor arrivals (thousands),THS,,30.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,2010,Tourist/visitor arrivals (thousands),THS,,51.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,1995,Tourism expenditure (millions of US dollars),,,5.4000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,2005,Tourism expenditure (millions of US dollars),,,7.1000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,2010,Tourism expenditure (millions of US dollars),,,18.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,2016,Tourism expenditure (millions of US dollars),,,33.5000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,2017,Tourism expenditure (millions of US dollars),,,36.2000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+262,Djibouti,2018,Tourism expenditure (millions of US dollars),,,57.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,1995,Tourist/visitor arrivals (thousands),TF,,60.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2005,Tourist/visitor arrivals (thousands),TF,,79.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2010,Tourist/visitor arrivals (thousands),TF,,77.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2016,Tourist/visitor arrivals (thousands),TF,,78.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2017,Tourist/visitor arrivals (thousands),TF,,72.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2018,Tourist/visitor arrivals (thousands),TF,,63.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,1995,Tourism expenditure (millions of US dollars),,,42.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2005,Tourism expenditure (millions of US dollars),,,57.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2010,Tourism expenditure (millions of US dollars),,,94.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2016,Tourism expenditure (millions of US dollars),,,198.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2017,Tourism expenditure (millions of US dollars),,,161.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+212,Dominica,2018,Tourism expenditure (millions of US dollars),,,111.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,1995,Tourist/visitor arrivals (thousands),TF,,1776.0000,Including nationals residing abroad.;Arrivals by air.;Excluding the passengers at Herrera airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2005,Tourist/visitor arrivals (thousands),TF,,3691.0000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2010,Tourist/visitor arrivals (thousands),TF,,4125.0000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2016,Tourist/visitor arrivals (thousands),TF,,5959.3000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2017,Tourist/visitor arrivals (thousands),TF,,6188.0000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2018,Tourist/visitor arrivals (thousands),TF,,6569.0000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,1995,Tourism expenditure (millions of US dollars),,,1571.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2005,Tourism expenditure (millions of US dollars),,,3518.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2010,Tourism expenditure (millions of US dollars),,,4162.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2016,Tourism expenditure (millions of US dollars),,,6720.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2017,Tourism expenditure (millions of US dollars),,,7184.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+214,Dominican Republic,2018,Tourism expenditure (millions of US dollars),,,7561.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,1995,Tourist/visitor arrivals (thousands),VF,,440.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2005,Tourist/visitor arrivals (thousands),VF,,860.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2010,Tourist/visitor arrivals (thousands),VF,,1047.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2016,Tourist/visitor arrivals (thousands),VF,,1569.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2017,Tourist/visitor arrivals (thousands),VF,,1806.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2018,Tourist/visitor arrivals (thousands),VF,,2535.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,1995,Tourism expenditure (millions of US dollars),,,315.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2005,Tourism expenditure (millions of US dollars),,,488.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2010,Tourism expenditure (millions of US dollars),,,786.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2016,Tourism expenditure (millions of US dollars),,,1450.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2017,Tourism expenditure (millions of US dollars),,,1554.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+218,Ecuador,2018,Tourism expenditure (millions of US dollars),,,1878.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,1995,Tourist/visitor arrivals (thousands),TF,,2871.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2005,Tourist/visitor arrivals (thousands),TF,,8244.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2010,Tourist/visitor arrivals (thousands),TF,,14051.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2016,Tourist/visitor arrivals (thousands),TF,,5258.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2017,Tourist/visitor arrivals (thousands),TF,,8157.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2018,Tourist/visitor arrivals (thousands),TF,,11196.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,1995,Tourism expenditure (millions of US dollars),,,2954.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2005,Tourism expenditure (millions of US dollars),,,7206.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2010,Tourism expenditure (millions of US dollars),,,13633.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2016,Tourism expenditure (millions of US dollars),,,3306.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2017,Tourism expenditure (millions of US dollars),,,8636.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+818,Egypt,2018,Tourism expenditure (millions of US dollars),,,12704.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,1995,Tourist/visitor arrivals (thousands),TF,,235.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2005,Tourist/visitor arrivals (thousands),TF,,1127.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2010,Tourist/visitor arrivals (thousands),TF,,1150.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2016,Tourist/visitor arrivals (thousands),TF,,1434.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2017,Tourist/visitor arrivals (thousands),TF,,1556.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2018,Tourist/visitor arrivals (thousands),TF,,1677.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,1995,Tourism expenditure (millions of US dollars),,,152.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2005,Tourism expenditure (millions of US dollars),,,656.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2010,Tourism expenditure (millions of US dollars),,,646.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2016,Tourism expenditure (millions of US dollars),,,1161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2017,Tourism expenditure (millions of US dollars),,,1227.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+222,El Salvador,2018,Tourism expenditure (millions of US dollars),,,1370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+226,Equatorial Guinea,1995,Tourism expenditure (millions of US dollars),,,1.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+232,Eritrea,1995,Tourist/visitor arrivals (thousands),VF,,315.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+232,Eritrea,2005,Tourist/visitor arrivals (thousands),VF,,83.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+232,Eritrea,2010,Tourist/visitor arrivals (thousands),VF,,84.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+232,Eritrea,2016,Tourist/visitor arrivals (thousands),VF,,142.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+232,Eritrea,1995,Tourism expenditure (millions of US dollars),,,58.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+232,Eritrea,2005,Tourism expenditure (millions of US dollars),,,66.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+232,Eritrea,2016,Tourism expenditure (millions of US dollars),,,48.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,1995,Tourist/visitor arrivals (thousands),TF,,530.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2005,Tourist/visitor arrivals (thousands),TF,,1917.0000,"Border statistics are not collected any more, surveys used instead.;Calculated on the basis of accommodation statistics and “Foreign Visitor Survey” carried out by the Statistical Office of Estonia.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2010,Tourist/visitor arrivals (thousands),TF,,2511.0000,"Border statistics are not collected any more, surveys used instead.;Based on mobile positioning data.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2016,Tourist/visitor arrivals (thousands),TF,,3131.0000,"Border statistics are not collected any more, surveys used instead.;Based on mobile positioning data.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2017,Tourist/visitor arrivals (thousands),TF,,3244.0000,"Border statistics are not collected any more, surveys used instead.;Based on mobile positioning data.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2018,Tourist/visitor arrivals (thousands),TF,,3234.0000,"Border statistics are not collected any more, surveys used instead.;Based on mobile positioning data.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,1995,Tourism expenditure (millions of US dollars),,,452.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2005,Tourism expenditure (millions of US dollars),,,1229.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2016,Tourism expenditure (millions of US dollars),,,1916.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2017,Tourism expenditure (millions of US dollars),,,2126.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+233,Estonia,2018,Tourism expenditure (millions of US dollars),,,2332.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,1995,Tourist/visitor arrivals (thousands),TF,,300.0000,Arrivals in hotels only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2005,Tourist/visitor arrivals (thousands),TF,,837.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2010,Tourist/visitor arrivals (thousands),TF,,868.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2016,Tourist/visitor arrivals (thousands),TF,,947.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2017,Tourist/visitor arrivals (thousands),TF,,921.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2018,Tourist/visitor arrivals (thousands),TF,,782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,1995,Tourism expenditure (millions of US dollars),,,54.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2005,Tourism expenditure (millions of US dollars),,,77.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2010,Tourism expenditure (millions of US dollars),,,51.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2016,Tourism expenditure (millions of US dollars),,,13.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2017,Tourism expenditure (millions of US dollars),,,13.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+748,Eswatini,2018,Tourism expenditure (millions of US dollars),,,16.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,1995,Tourist/visitor arrivals (thousands),TF,,103.0000,Arrivals to Bole airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2005,Tourist/visitor arrivals (thousands),TF,,227.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2010,Tourist/visitor arrivals (thousands),TF,,468.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2016,Tourist/visitor arrivals (thousands),TF,,871.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2017,Tourist/visitor arrivals (thousands),TF,,933.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2018,Tourist/visitor arrivals (thousands),TF,,849.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,1995,Tourism expenditure (millions of US dollars),,,177.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2005,Tourism expenditure (millions of US dollars),,,533.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2010,Tourism expenditure (millions of US dollars),,,1434.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2016,Tourism expenditure (millions of US dollars),,,2138.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2017,Tourism expenditure (millions of US dollars),,,2505.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+231,Ethiopia,2018,Tourism expenditure (millions of US dollars),,,3548.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,1995,Tourist/visitor arrivals (thousands),TF,,318.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2005,Tourist/visitor arrivals (thousands),TF,,545.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2010,Tourist/visitor arrivals (thousands),TF,,632.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2016,Tourist/visitor arrivals (thousands),TF,,792.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2017,Tourist/visitor arrivals (thousands),TF,,843.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2018,Tourist/visitor arrivals (thousands),TF,,870.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,1995,Tourism expenditure (millions of US dollars),,,369.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2005,Tourism expenditure (millions of US dollars),,,722.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2010,Tourism expenditure (millions of US dollars),,,825.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2016,Tourism expenditure (millions of US dollars),,,1149.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2017,Tourism expenditure (millions of US dollars),,,1243.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+242,Fiji,2018,Tourism expenditure (millions of US dollars),,,1370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,1995,Tourist/visitor arrivals (thousands),TCE,,1779.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2005,Tourist/visitor arrivals (thousands),TCE,,2080.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2010,Tourist/visitor arrivals (thousands),TCE,,2319.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2016,Tourist/visitor arrivals (thousands),TCE,,2789.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2017,Tourist/visitor arrivals (thousands),TCE,,3180.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2018,Tourist/visitor arrivals (thousands),TCE,,3224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,1995,Tourism expenditure (millions of US dollars),,,2383.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2005,Tourism expenditure (millions of US dollars),,,3069.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2010,Tourism expenditure (millions of US dollars),,,4497.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2016,Tourism expenditure (millions of US dollars),,,4016.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2017,Tourism expenditure (millions of US dollars),,,5207.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+246,Finland,2018,Tourism expenditure (millions of US dollars),,,5663.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,1995,Tourist/visitor arrivals (thousands),TF,,60033.0000,Estimated based on surveys at national borders.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2005,Tourist/visitor arrivals (thousands),TF,,74988.0000,Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2010,Tourist/visitor arrivals (thousands),TF,,76647.0000,Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2016,Tourist/visitor arrivals (thousands),TF,,82682.0000,Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2017,Tourist/visitor arrivals (thousands),TF,,86758.0000,Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2018,Tourist/visitor arrivals (thousands),TF,,89322.0000,Estimate.;Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,1995,Tourism expenditure (millions of US dollars),,,31295.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2005,Tourism expenditure (millions of US dollars),,,52126.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2010,Tourism expenditure (millions of US dollars),,,56178.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2016,Tourism expenditure (millions of US dollars),,,63557.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2017,Tourism expenditure (millions of US dollars),,,67936.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+250,France,2018,Tourism expenditure (millions of US dollars),,,73125.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+254,French Guiana,2005,Tourist/visitor arrivals (thousands),TF,,95.0000,Survey at Cayenne-Rochambeau airport on departure.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+254,French Guiana,2016,Tourist/visitor arrivals (thousands),TF,,96.0000,Survey at Cayenne-Rochambeau airport on departure.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+254,French Guiana,2017,Tourist/visitor arrivals (thousands),TF,,111.0000,Survey at Cayenne-Rochambeau airport on departure.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+254,French Guiana,2005,Tourism expenditure (millions of US dollars),,,44.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,1995,Tourist/visitor arrivals (thousands),TF,,172.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,2005,Tourist/visitor arrivals (thousands),TF,,208.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,2010,Tourist/visitor arrivals (thousands),TF,,154.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,2016,Tourist/visitor arrivals (thousands),TF,,192.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,2017,Tourist/visitor arrivals (thousands),TF,,199.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,2018,Tourist/visitor arrivals (thousands),TF,,216.3000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,1995,Tourism expenditure (millions of US dollars),,,326.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,2005,Tourism expenditure (millions of US dollars),,,759.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,2010,Tourism expenditure (millions of US dollars),,,630.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+258,French Polynesia,2016,Tourism expenditure (millions of US dollars),,,782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+266,Gabon,1995,Tourist/visitor arrivals (thousands),TF,,125.0000,Arrivals of non-resident tourists at Libreville airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+266,Gabon,2005,Tourist/visitor arrivals (thousands),TF,,269.0000,Arrivals of non-resident tourists at Libreville airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+266,Gabon,1995,Tourism expenditure (millions of US dollars),,,94.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+266,Gabon,2005,Tourism expenditure (millions of US dollars),,,13.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+266,Gabon,2010,Tourism expenditure (millions of US dollars),,,89.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+266,Gabon,2016,Tourism expenditure (millions of US dollars),,,28.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,1995,Tourist/visitor arrivals (thousands),TF,,45.0000,Including nationals residing abroad.;Arrivals by air only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2005,Tourist/visitor arrivals (thousands),TF,,108.0000,Including nationals residing abroad.;Arrivals by air only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2010,Tourist/visitor arrivals (thousands),TF,,91.0000,Including nationals residing abroad.;Arrivals by air only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2016,Tourist/visitor arrivals (thousands),TF,,450.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2017,Tourist/visitor arrivals (thousands),TF,,522.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2018,Tourist/visitor arrivals (thousands),TF,,552.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2005,Tourism expenditure (millions of US dollars),,,59.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2010,Tourism expenditure (millions of US dollars),,,80.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2016,Tourism expenditure (millions of US dollars),,,120.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2017,Tourism expenditure (millions of US dollars),,,116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+270,Gambia,2018,Tourism expenditure (millions of US dollars),,,168.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2010,Tourist/visitor arrivals (thousands),TF,,1067.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2016,Tourist/visitor arrivals (thousands),TF,,3297.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2017,Tourist/visitor arrivals (thousands),TF,,4069.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2018,Tourist/visitor arrivals (thousands),TF,,4757.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2005,Tourism expenditure (millions of US dollars),,,287.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2010,Tourism expenditure (millions of US dollars),,,737.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2016,Tourism expenditure (millions of US dollars),,,2315.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2017,Tourism expenditure (millions of US dollars),,,2971.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+268,Georgia,2018,Tourism expenditure (millions of US dollars),,,3518.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,1995,Tourist/visitor arrivals (thousands),TCE,,14847.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2005,Tourist/visitor arrivals (thousands),TCE,,21500.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2010,Tourist/visitor arrivals (thousands),TCE,,26875.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2016,Tourist/visitor arrivals (thousands),TCE,,35555.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2017,Tourist/visitor arrivals (thousands),TCE,,37452.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2018,Tourist/visitor arrivals (thousands),TCE,,38881.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,1995,Tourism expenditure (millions of US dollars),,,24053.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2005,Tourism expenditure (millions of US dollars),,,40518.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2010,Tourism expenditure (millions of US dollars),,,49116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2016,Tourism expenditure (millions of US dollars),,,52229.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2017,Tourism expenditure (millions of US dollars),,,56330.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+276,Germany,2018,Tourism expenditure (millions of US dollars),,,60260.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,1995,Tourist/visitor arrivals (thousands),TF,,286.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,2005,Tourist/visitor arrivals (thousands),TF,,429.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,2010,Tourist/visitor arrivals (thousands),TF,,931.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,1995,Tourism expenditure (millions of US dollars),,,30.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,2005,Tourism expenditure (millions of US dollars),,,867.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,2010,Tourism expenditure (millions of US dollars),,,706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,2016,Tourism expenditure (millions of US dollars),,,952.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,2017,Tourism expenditure (millions of US dollars),,,919.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+288,Ghana,2018,Tourism expenditure (millions of US dollars),,,996.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,1995,Tourist/visitor arrivals (thousands),TF,,10130.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2005,Tourist/visitor arrivals (thousands),TF,,14765.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2010,Tourist/visitor arrivals (thousands),TF,,15007.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2016,Tourist/visitor arrivals (thousands),TF,,24799.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2017,Tourist/visitor arrivals (thousands),TF,,27194.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2018,Tourist/visitor arrivals (thousands),TF,,30123.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,1995,Tourism expenditure (millions of US dollars),,,4182.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2005,Tourism expenditure (millions of US dollars),,,13455.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2010,Tourism expenditure (millions of US dollars),,,13857.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2016,Tourism expenditure (millions of US dollars),,,16811.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2017,Tourism expenditure (millions of US dollars),,,19139.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+300,Greece,2018,Tourism expenditure (millions of US dollars),,,21594.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,1995,Tourist/visitor arrivals (thousands),TF,,108.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2005,Tourist/visitor arrivals (thousands),TF,,99.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2010,Tourist/visitor arrivals (thousands),TF,,110.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2016,Tourist/visitor arrivals (thousands),TF,,156.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2017,Tourist/visitor arrivals (thousands),TF,,168.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2018,Tourist/visitor arrivals (thousands),TF,,185.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,1995,Tourism expenditure (millions of US dollars),,,76.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2005,Tourism expenditure (millions of US dollars),,,71.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2010,Tourism expenditure (millions of US dollars),,,112.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2016,Tourism expenditure (millions of US dollars),,,437.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2017,Tourism expenditure (millions of US dollars),,,482.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+308,Grenada,2018,Tourism expenditure (millions of US dollars),,,548.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,1995,Tourist/visitor arrivals (thousands),TF,,640.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).;Non-resident tourists staying in all types of accommodation establishments.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,2005,Tourist/visitor arrivals (thousands),TF,,372.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,2010,Tourist/visitor arrivals (thousands),TF,,392.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,2016,Tourist/visitor arrivals (thousands),TF,,581.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,2017,Tourist/visitor arrivals (thousands),TF,,650.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,2018,Tourist/visitor arrivals (thousands),TF,,735.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,1995,Tourism expenditure (millions of US dollars),,,458.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,2005,Tourism expenditure (millions of US dollars),,,306.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,2010,Tourism expenditure (millions of US dollars),,,510.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+312,Guadeloupe,2018,Tourism expenditure (millions of US dollars),,,860.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+316,Guam,1995,Tourist/visitor arrivals (thousands),TF,,1362.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+316,Guam,2005,Tourist/visitor arrivals (thousands),TF,,1228.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+316,Guam,2010,Tourist/visitor arrivals (thousands),TF,,1197.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+316,Guam,2016,Tourist/visitor arrivals (thousands),TF,,1536.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+316,Guam,2017,Tourist/visitor arrivals (thousands),TF,,1545.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+316,Guam,2018,Tourist/visitor arrivals (thousands),TF,,1549.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2010,Tourist/visitor arrivals (thousands),TF,,1119.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2016,Tourist/visitor arrivals (thousands),TF,,1585.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2017,Tourist/visitor arrivals (thousands),TF,,1660.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2018,Tourist/visitor arrivals (thousands),TF,,1781.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,1995,Tourism expenditure (millions of US dollars),,,213.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2005,Tourism expenditure (millions of US dollars),,,791.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2010,Tourism expenditure (millions of US dollars),,,1378.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2016,Tourism expenditure (millions of US dollars),,,1550.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2017,Tourism expenditure (millions of US dollars),,,1566.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+320,Guatemala,2018,Tourism expenditure (millions of US dollars),,,1549.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,2005,Tourist/visitor arrivals (thousands),TF,,45.0000,Arrivals by air at Conakry airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,2010,Tourist/visitor arrivals (thousands),TF,,12.4000,Arrivals by air at Conakry airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,2016,Tourist/visitor arrivals (thousands),TF,,63.0000,Arrivals by air at Conakry airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,2017,Tourist/visitor arrivals (thousands),TF,,99.0000,Arrivals by air at Conakry airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,1995,Tourism expenditure (millions of US dollars),,,0.9110,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,2010,Tourism expenditure (millions of US dollars),,,2.0400,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,2016,Tourism expenditure (millions of US dollars),,,16.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,2017,Tourism expenditure (millions of US dollars),,,16.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+324,Guinea,2018,Tourism expenditure (millions of US dollars),,,7.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+624,Guinea-Bissau,2005,Tourist/visitor arrivals (thousands),TF,,5.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+624,Guinea-Bissau,2010,Tourist/visitor arrivals (thousands),TF,,22.3000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+624,Guinea-Bissau,2016,Tourist/visitor arrivals (thousands),TF,,45.2000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+624,Guinea-Bissau,2005,Tourism expenditure (millions of US dollars),,,1.6000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+624,Guinea-Bissau,2010,Tourism expenditure (millions of US dollars),,,13.3000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+624,Guinea-Bissau,2016,Tourism expenditure (millions of US dollars),,,11.5000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+624,Guinea-Bissau,2017,Tourism expenditure (millions of US dollars),,,16.3000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+624,Guinea-Bissau,2018,Tourism expenditure (millions of US dollars),,,19.8000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,1995,Tourist/visitor arrivals (thousands),TF,,106.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2005,Tourist/visitor arrivals (thousands),TF,,117.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2010,Tourist/visitor arrivals (thousands),TF,,152.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2016,Tourist/visitor arrivals (thousands),TF,,235.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2017,Tourist/visitor arrivals (thousands),TF,,247.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2018,Tourist/visitor arrivals (thousands),TF,,287.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,1995,Tourism expenditure (millions of US dollars),,,33.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2005,Tourism expenditure (millions of US dollars),,,35.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2010,Tourism expenditure (millions of US dollars),,,80.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2016,Tourism expenditure (millions of US dollars),,,104.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2017,Tourism expenditure (millions of US dollars),,,95.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+328,Guyana,2018,Tourism expenditure (millions of US dollars),,,28.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,1995,Tourist/visitor arrivals (thousands),TF,,145.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2005,Tourist/visitor arrivals (thousands),TF,,112.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2010,Tourist/visitor arrivals (thousands),TF,,255.0000,Arrivals by air.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2016,Tourist/visitor arrivals (thousands),TF,,445.0000,Arrivals by air.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2017,Tourist/visitor arrivals (thousands),TF,,467.0000,Arrivals by air.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2018,Tourist/visitor arrivals (thousands),TF,,447.0000,Arrivals by air.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,1995,Tourism expenditure (millions of US dollars),,,90.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2005,Tourism expenditure (millions of US dollars),,,80.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2010,Tourism expenditure (millions of US dollars),,,383.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2016,Tourism expenditure (millions of US dollars),,,511.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2017,Tourism expenditure (millions of US dollars),,,460.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+332,Haiti,2018,Tourism expenditure (millions of US dollars),,,620.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,1995,Tourist/visitor arrivals (thousands),TF,,271.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2005,Tourist/visitor arrivals (thousands),TF,,673.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2010,Tourist/visitor arrivals (thousands),TF,,863.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2016,Tourist/visitor arrivals (thousands),TF,,838.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2017,Tourist/visitor arrivals (thousands),TF,,851.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,1995,Tourism expenditure (millions of US dollars),,,85.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2005,Tourism expenditure (millions of US dollars),,,465.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2010,Tourism expenditure (millions of US dollars),,,626.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2016,Tourism expenditure (millions of US dollars),,,700.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2017,Tourism expenditure (millions of US dollars),,,722.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+340,Honduras,2018,Tourism expenditure (millions of US dollars),,,745.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2005,Tourist/visitor arrivals (thousands),TF,,9979.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2010,Tourist/visitor arrivals (thousands),TF,,9510.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2016,Tourist/visitor arrivals (thousands),TF,,15255.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2017,Tourist/visitor arrivals (thousands),TF,,15785.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2018,Tourist/visitor arrivals (thousands),TF,,17552.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,1995,Tourism expenditure (millions of US dollars),,,2938.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2005,Tourism expenditure (millions of US dollars),,,4761.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2010,Tourism expenditure (millions of US dollars),,,6595.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2016,Tourism expenditure (millions of US dollars),,,7481.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2017,Tourism expenditure (millions of US dollars),,,8448.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+348,Hungary,2018,Tourism expenditure (millions of US dollars),,,9595.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,1995,Tourist/visitor arrivals (thousands),TF,,190.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2005,Tourist/visitor arrivals (thousands),TF,,374.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2010,Tourist/visitor arrivals (thousands),TF,,489.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2016,Tourist/visitor arrivals (thousands),TF,,1792.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2017,Tourist/visitor arrivals (thousands),TF,,2225.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2018,Tourist/visitor arrivals (thousands),TF,,2343.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,1995,Tourism expenditure (millions of US dollars),,,186.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2005,Tourism expenditure (millions of US dollars),,,413.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2010,Tourism expenditure (millions of US dollars),,,562.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2016,Tourism expenditure (millions of US dollars),,,2411.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2017,Tourism expenditure (millions of US dollars),,,3024.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+352,Iceland,2018,Tourism expenditure (millions of US dollars),,,3128.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,1995,Tourist/visitor arrivals (thousands),TF,,2124.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2005,Tourist/visitor arrivals (thousands),TF,,3919.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2010,Tourist/visitor arrivals (thousands),TF,,5776.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2016,Tourist/visitor arrivals (thousands),TF,,14570.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2017,Tourist/visitor arrivals (thousands),TF,,15543.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2018,Tourist/visitor arrivals (thousands),TF,,17423.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2005,Tourism expenditure (millions of US dollars),,,7659.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2016,Tourism expenditure (millions of US dollars),,,23111.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2017,Tourism expenditure (millions of US dollars),,,27878.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+356,India,2018,Tourism expenditure (millions of US dollars),,,29143.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,1995,Tourist/visitor arrivals (thousands),VF,,4324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2005,Tourist/visitor arrivals (thousands),VF,,5002.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2010,Tourist/visitor arrivals (thousands),VF,,7003.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2016,Tourist/visitor arrivals (thousands),VF,,11519.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2017,Tourist/visitor arrivals (thousands),VF,,14040.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2018,Tourist/visitor arrivals (thousands),VF,,15810.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2005,Tourism expenditure (millions of US dollars),,,5094.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2010,Tourism expenditure (millions of US dollars),,,7618.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2016,Tourism expenditure (millions of US dollars),,,12566.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2017,Tourism expenditure (millions of US dollars),,,14691.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+360,Indonesia,2018,Tourism expenditure (millions of US dollars),,,15600.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),1995,Tourist/visitor arrivals (thousands),VF,,568.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),2010,Tourist/visitor arrivals (thousands),VF,,2938.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),2016,Tourist/visitor arrivals (thousands),VF,,4942.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),2017,Tourist/visitor arrivals (thousands),VF,,4867.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),2018,Tourist/visitor arrivals (thousands),VF,,7295.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),1995,Tourism expenditure (millions of US dollars),,,205.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),2005,Tourism expenditure (millions of US dollars),,,1025.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),2010,Tourism expenditure (millions of US dollars),,,2631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),2016,Tourism expenditure (millions of US dollars),,,3914.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+364,Iran (Islamic Republic of),2017,Tourism expenditure (millions of US dollars),,,4632.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+368,Iraq,1995,Tourist/visitor arrivals (thousands),VF,,61.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+368,Iraq,2010,Tourist/visitor arrivals (thousands),VF,,1518.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+368,Iraq,2005,Tourism expenditure (millions of US dollars),,,186.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+368,Iraq,2010,Tourism expenditure (millions of US dollars),,,1736.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+368,Iraq,2016,Tourism expenditure (millions of US dollars),,,3120.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+368,Iraq,2017,Tourism expenditure (millions of US dollars),,,2959.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+368,Iraq,2018,Tourism expenditure (millions of US dollars),,,1986.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,1995,Tourist/visitor arrivals (thousands),TF,,4818.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2005,Tourist/visitor arrivals (thousands),TF,,7333.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2010,Tourist/visitor arrivals (thousands),TF,,7134.0000,Break in the time series.;Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2016,Tourist/visitor arrivals (thousands),TF,,10100.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2017,Tourist/visitor arrivals (thousands),TF,,10338.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2018,Tourist/visitor arrivals (thousands),TF,,10926.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,1995,Tourism expenditure (millions of US dollars),,,2697.7927,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2005,Tourism expenditure (millions of US dollars),,,6779.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2010,Tourism expenditure (millions of US dollars),,,8185.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2016,Tourism expenditure (millions of US dollars),,,11429.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2017,Tourism expenditure (millions of US dollars),,,14294.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+372,Ireland,2018,Tourism expenditure (millions of US dollars),,,14658.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,1995,Tourist/visitor arrivals (thousands),TF,,2215.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2005,Tourist/visitor arrivals (thousands),TF,,1903.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2010,Tourist/visitor arrivals (thousands),TF,,2803.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2016,Tourist/visitor arrivals (thousands),TF,,2900.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2017,Tourist/visitor arrivals (thousands),TF,,3613.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2018,Tourist/visitor arrivals (thousands),TF,,4121.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,1995,Tourism expenditure (millions of US dollars),,,3491.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2005,Tourism expenditure (millions of US dollars),,,2750.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2010,Tourism expenditure (millions of US dollars),,,5621.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2016,Tourism expenditure (millions of US dollars),,,6587.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2017,Tourism expenditure (millions of US dollars),,,7578.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+376,Israel,2018,Tourism expenditure (millions of US dollars),,,8073.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,1995,Tourist/visitor arrivals (thousands),TF,,31052.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2005,Tourist/visitor arrivals (thousands),TF,,36513.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2010,Tourist/visitor arrivals (thousands),TF,,43626.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2016,Tourist/visitor arrivals (thousands),TF,,52372.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2017,Tourist/visitor arrivals (thousands),TF,,58253.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2018,Tourist/visitor arrivals (thousands),TF,,61567.2000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,1995,Tourism expenditure (millions of US dollars),,,30411.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2005,Tourism expenditure (millions of US dollars),,,38364.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2016,Tourism expenditure (millions of US dollars),,,42423.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2017,Tourism expenditure (millions of US dollars),,,46719.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+380,Italy,2018,Tourism expenditure (millions of US dollars),,,51602.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,1995,Tourist/visitor arrivals (thousands),TF,,1147.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2005,Tourist/visitor arrivals (thousands),TF,,1479.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2010,Tourist/visitor arrivals (thousands),TF,,1922.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2016,Tourist/visitor arrivals (thousands),TF,,2182.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2017,Tourist/visitor arrivals (thousands),TF,,2353.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2018,Tourist/visitor arrivals (thousands),TF,,2473.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,1995,Tourism expenditure (millions of US dollars),,,1069.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2005,Tourism expenditure (millions of US dollars),,,1545.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2010,Tourism expenditure (millions of US dollars),,,2001.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2016,Tourism expenditure (millions of US dollars),,,2539.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2017,Tourism expenditure (millions of US dollars),,,2809.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+388,Jamaica,2018,Tourism expenditure (millions of US dollars),,,3099.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,1995,Tourist/visitor arrivals (thousands),VF,,3345.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2005,Tourist/visitor arrivals (thousands),VF,,6728.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2010,Tourist/visitor arrivals (thousands),VF,,8611.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2016,Tourist/visitor arrivals (thousands),VF,,24040.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2017,Tourist/visitor arrivals (thousands),VF,,28691.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2018,Tourist/visitor arrivals (thousands),VF,,31192.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,1995,Tourism expenditure (millions of US dollars),,,4894.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2005,Tourism expenditure (millions of US dollars),,,15554.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2010,Tourism expenditure (millions of US dollars),,,15356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2016,Tourism expenditure (millions of US dollars),,,33456.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2017,Tourism expenditure (millions of US dollars),,,36978.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+392,Japan,2018,Tourism expenditure (millions of US dollars),,,45276.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,1995,Tourist/visitor arrivals (thousands),TF,,1075.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2005,Tourist/visitor arrivals (thousands),TF,,2987.0000,Break in the time series.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2010,Tourist/visitor arrivals (thousands),TF,,4207.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2016,Tourist/visitor arrivals (thousands),TF,,3567.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2017,Tourist/visitor arrivals (thousands),TF,,3843.5000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2018,Tourist/visitor arrivals (thousands),TF,,4150.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,1995,Tourism expenditure (millions of US dollars),,,973.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2005,Tourism expenditure (millions of US dollars),,,1759.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2010,Tourism expenditure (millions of US dollars),,,4390.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2016,Tourism expenditure (millions of US dollars),,,4943.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2017,Tourism expenditure (millions of US dollars),,,5549.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+400,Jordan,2018,Tourism expenditure (millions of US dollars),,,6221.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+398,Kazakhstan,2005,Tourist/visitor arrivals (thousands),TF,,3143.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+398,Kazakhstan,2010,Tourist/visitor arrivals (thousands),TF,,2991.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+398,Kazakhstan,1995,Tourism expenditure (millions of US dollars),,,155.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+398,Kazakhstan,2005,Tourism expenditure (millions of US dollars),,,801.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+398,Kazakhstan,2010,Tourism expenditure (millions of US dollars),,,1236.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+398,Kazakhstan,2016,Tourism expenditure (millions of US dollars),,,2038.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+398,Kazakhstan,2017,Tourism expenditure (millions of US dollars),,,2356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+398,Kazakhstan,2018,Tourism expenditure (millions of US dollars),,,2651.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,1995,Tourist/visitor arrivals (thousands),TF,,918.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,2005,Tourist/visitor arrivals (thousands),TF,,1399.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,2010,Tourist/visitor arrivals (thousands),TF,,1470.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,2016,Tourist/visitor arrivals (thousands),TF,,1268.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,2017,Tourist/visitor arrivals (thousands),TF,,1364.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,1995,Tourism expenditure (millions of US dollars),,,785.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,2005,Tourism expenditure (millions of US dollars),,,969.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,2010,Tourism expenditure (millions of US dollars),,,1620.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,2016,Tourism expenditure (millions of US dollars),,,1471.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+404,Kenya,2017,Tourism expenditure (millions of US dollars),,,1564.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,1995,Tourist/visitor arrivals (thousands),TF,,3.9000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,2005,Tourist/visitor arrivals (thousands),TF,,4.1000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,2010,Tourist/visitor arrivals (thousands),TF,,4.7000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,2016,Tourist/visitor arrivals (thousands),TF,,5.7000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,2017,Tourist/visitor arrivals (thousands),TF,,5.8000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,2018,Tourist/visitor arrivals (thousands),TF,,7.1000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,2010,Tourism expenditure (millions of US dollars),,,4.3000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,2016,Tourism expenditure (millions of US dollars),,,2.8000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+296,Kiribati,2017,Tourism expenditure (millions of US dollars),,,4.1000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,1995,Tourist/visitor arrivals (thousands),VF,,1443.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2005,Tourist/visitor arrivals (thousands),VF,,3474.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2010,Tourist/visitor arrivals (thousands),VF,,5208.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2016,Tourist/visitor arrivals (thousands),VF,,7055.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2017,Tourist/visitor arrivals (thousands),VF,,7407.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2018,Tourist/visitor arrivals (thousands),VF,,8508.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,1995,Tourism expenditure (millions of US dollars),,,307.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2005,Tourism expenditure (millions of US dollars),,,413.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2010,Tourism expenditure (millions of US dollars),,,574.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2016,Tourism expenditure (millions of US dollars),,,831.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2017,Tourism expenditure (millions of US dollars),,,643.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+414,Kuwait,2018,Tourism expenditure (millions of US dollars),,,919.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2005,Tourist/visitor arrivals (thousands),VF,,319.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2010,Tourist/visitor arrivals (thousands),VF,,1224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2016,Tourist/visitor arrivals (thousands),VF,,3853.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2017,Tourist/visitor arrivals (thousands),VF,,4568.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2018,Tourist/visitor arrivals (thousands),VF,,6947.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2005,Tourism expenditure (millions of US dollars),,,94.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2010,Tourism expenditure (millions of US dollars),,,212.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2016,Tourism expenditure (millions of US dollars),,,477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2017,Tourism expenditure (millions of US dollars),,,480.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+417,Kyrgyzstan,2018,Tourism expenditure (millions of US dollars),,,487.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,1995,Tourist/visitor arrivals (thousands),TF,,60.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2005,Tourist/visitor arrivals (thousands),TF,,672.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2010,Tourist/visitor arrivals (thousands),TF,,1670.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2016,Tourist/visitor arrivals (thousands),TF,,3315.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2017,Tourist/visitor arrivals (thousands),TF,,3257.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2018,Tourist/visitor arrivals (thousands),TF,,3770.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,1995,Tourism expenditure (millions of US dollars),,,52.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2005,Tourism expenditure (millions of US dollars),,,143.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2010,Tourism expenditure (millions of US dollars),,,385.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2016,Tourism expenditure (millions of US dollars),,,717.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2017,Tourism expenditure (millions of US dollars),,,655.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+418,Lao People's Dem. Rep.,2018,Tourism expenditure (millions of US dollars),,,757.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+428,Latvia,1995,Tourist/visitor arrivals (thousands),TF,,539.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+428,Latvia,2005,Tourist/visitor arrivals (thousands),TF,,1116.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+428,Latvia,2010,Tourist/visitor arrivals (thousands),TF,,1373.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+428,Latvia,2016,Tourist/visitor arrivals (thousands),TF,,1793.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+428,Latvia,2017,Tourist/visitor arrivals (thousands),TF,,1949.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+428,Latvia,2018,Tourist/visitor arrivals (thousands),TF,,1946.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+428,Latvia,1995,Tourism expenditure (millions of US dollars),,,37.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+428,Latvia,2005,Tourism expenditure (millions of US dollars),,,446.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,1995,Tourist/visitor arrivals (thousands),TF,,450.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2005,Tourist/visitor arrivals (thousands),TF,,1140.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2010,Tourist/visitor arrivals (thousands),TF,,2168.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2016,Tourist/visitor arrivals (thousands),TF,,1688.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2017,Tourist/visitor arrivals (thousands),TF,,1857.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2018,Tourist/visitor arrivals (thousands),TF,,1964.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,1995,Tourism expenditure (millions of US dollars),,,710.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2005,Tourism expenditure (millions of US dollars),,,5969.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2010,Tourism expenditure (millions of US dollars),,,8026.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2016,Tourism expenditure (millions of US dollars),,,7373.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2017,Tourism expenditure (millions of US dollars),,,8086.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+422,Lebanon,2018,Tourism expenditure (millions of US dollars),,,8694.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,1995,Tourist/visitor arrivals (thousands),VF,,209.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2005,Tourist/visitor arrivals (thousands),VF,,304.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2010,Tourist/visitor arrivals (thousands),VF,,426.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2016,Tourist/visitor arrivals (thousands),VF,,1196.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2017,Tourist/visitor arrivals (thousands),VF,,1137.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2018,Tourist/visitor arrivals (thousands),VF,,1173.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,1995,Tourism expenditure (millions of US dollars),,,27.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2005,Tourism expenditure (millions of US dollars),,,27.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2010,Tourism expenditure (millions of US dollars),,,23.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2016,Tourism expenditure (millions of US dollars),,,48.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2017,Tourism expenditure (millions of US dollars),,,23.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+426,Lesotho,2018,Tourism expenditure (millions of US dollars),,,24.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+430,Liberia,2005,Tourism expenditure (millions of US dollars),,,67.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+434,Libya,2005,Tourist/visitor arrivals (thousands),THS,,81.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+434,Libya,1995,Tourism expenditure (millions of US dollars),,,4.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+434,Libya,2005,Tourism expenditure (millions of US dollars),,,301.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+434,Libya,2010,Tourism expenditure (millions of US dollars),,,170.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+438,Liechtenstein,2010,Tourist/visitor arrivals (thousands),TCE,,64.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+438,Liechtenstein,2016,Tourist/visitor arrivals (thousands),TCE,,69.1000,Excluding long term tourists on campgrounds and in holiday flats.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+438,Liechtenstein,2017,Tourist/visitor arrivals (thousands),TCE,,79.3000,Excluding long term tourists on campgrounds and in holiday flats.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+438,Liechtenstein,2018,Tourist/visitor arrivals (thousands),TCE,,85.3000,Excluding long term tourists on campgrounds and in holiday flats.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,1995,Tourist/visitor arrivals (thousands),TF,,650.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2005,Tourist/visitor arrivals (thousands),TF,,2000.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2010,Tourist/visitor arrivals (thousands),TF,,1507.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2016,Tourist/visitor arrivals (thousands),TF,,2296.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2017,Tourist/visitor arrivals (thousands),TF,,2523.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2018,Tourist/visitor arrivals (thousands),TF,,2825.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,1995,Tourism expenditure (millions of US dollars),,,77.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2005,Tourism expenditure (millions of US dollars),,,920.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2010,Tourism expenditure (millions of US dollars),,,958.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2016,Tourism expenditure (millions of US dollars),,,1210.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2017,Tourism expenditure (millions of US dollars),,,1325.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+440,Lithuania,2018,Tourism expenditure (millions of US dollars),,,1419.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,1995,Tourist/visitor arrivals (thousands),TCE,,768.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2005,Tourist/visitor arrivals (thousands),TCE,,913.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2010,Tourist/visitor arrivals (thousands),TCE,,805.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2016,Tourist/visitor arrivals (thousands),TCE,,1054.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2017,Tourist/visitor arrivals (thousands),TCE,,1046.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2018,Tourist/visitor arrivals (thousands),TCE,,1018.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2005,Tourism expenditure (millions of US dollars),,,3770.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2010,Tourism expenditure (millions of US dollars),,,4519.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2016,Tourism expenditure (millions of US dollars),,,4766.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2017,Tourism expenditure (millions of US dollars),,,4993.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+442,Luxembourg,2018,Tourism expenditure (millions of US dollars),,,5537.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,1995,Tourist/visitor arrivals (thousands),TF,,75.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2005,Tourist/visitor arrivals (thousands),TF,,277.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2010,Tourist/visitor arrivals (thousands),TF,,196.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2016,Tourist/visitor arrivals (thousands),TF,,293.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2017,Tourist/visitor arrivals (thousands),TF,,255.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2018,Tourist/visitor arrivals (thousands),TF,,291.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,1995,Tourism expenditure (millions of US dollars),,,106.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2005,Tourism expenditure (millions of US dollars),,,275.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2010,Tourism expenditure (millions of US dollars),,,425.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2016,Tourism expenditure (millions of US dollars),,,913.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2017,Tourism expenditure (millions of US dollars),,,849.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+450,Madagascar,2018,Tourism expenditure (millions of US dollars),,,879.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,1995,Tourist/visitor arrivals (thousands),TF,,192.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2005,Tourist/visitor arrivals (thousands),TF,,438.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2010,Tourist/visitor arrivals (thousands),TF,,746.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2016,Tourist/visitor arrivals (thousands),TF,,849.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2017,Tourist/visitor arrivals (thousands),TF,,837.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2018,Tourist/visitor arrivals (thousands),TF,,871.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,1995,Tourism expenditure (millions of US dollars),,,22.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2005,Tourism expenditure (millions of US dollars),,,48.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2010,Tourism expenditure (millions of US dollars),,,45.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2016,Tourism expenditure (millions of US dollars),,,30.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2017,Tourism expenditure (millions of US dollars),,,35.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+454,Malawi,2018,Tourism expenditure (millions of US dollars),,,43.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,1995,Tourist/visitor arrivals (thousands),TF,,7469.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2005,Tourist/visitor arrivals (thousands),TF,,16431.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2010,Tourist/visitor arrivals (thousands),TF,,24577.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2016,Tourist/visitor arrivals (thousands),TF,,26757.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2017,Tourist/visitor arrivals (thousands),TF,,25948.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2018,Tourist/visitor arrivals (thousands),TF,,25832.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,1995,Tourism expenditure (millions of US dollars),,,5044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2005,Tourism expenditure (millions of US dollars),,,10389.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2010,Tourism expenditure (millions of US dollars),,,19619.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2016,Tourism expenditure (millions of US dollars),,,19682.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2017,Tourism expenditure (millions of US dollars),,,20311.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+458,Malaysia,2018,Tourism expenditure (millions of US dollars),,,21774.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,1995,Tourist/visitor arrivals (thousands),TF,,315.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,2005,Tourist/visitor arrivals (thousands),TF,,395.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,2010,Tourist/visitor arrivals (thousands),TF,,792.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,2016,Tourist/visitor arrivals (thousands),TF,,1286.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,2017,Tourist/visitor arrivals (thousands),TF,,1390.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,2018,Tourist/visitor arrivals (thousands),TF,,1484.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,2016,Tourism expenditure (millions of US dollars),,,2640.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,2017,Tourism expenditure (millions of US dollars),,,2771.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+462,Maldives,2018,Tourism expenditure (millions of US dollars),,,3054.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+466,Mali,2010,Tourist/visitor arrivals (thousands),TF,,169.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+466,Mali,2016,Tourist/visitor arrivals (thousands),TF,,173.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+466,Mali,2017,Tourist/visitor arrivals (thousands),TF,,193.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+466,Mali,1995,Tourism expenditure (millions of US dollars),,,26.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+466,Mali,2005,Tourism expenditure (millions of US dollars),,,149.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+466,Mali,2010,Tourism expenditure (millions of US dollars),,,208.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+466,Mali,2016,Tourism expenditure (millions of US dollars),,,201.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+466,Mali,2017,Tourism expenditure (millions of US dollars),,,206.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,1995,Tourist/visitor arrivals (thousands),TF,,1116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2005,Tourist/visitor arrivals (thousands),TF,,1171.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2010,Tourist/visitor arrivals (thousands),TF,,1339.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2016,Tourist/visitor arrivals (thousands),TF,,1966.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2017,Tourist/visitor arrivals (thousands),TF,,2274.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2018,Tourist/visitor arrivals (thousands),TF,,2599.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,1995,Tourism expenditure (millions of US dollars),,,656.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2005,Tourism expenditure (millions of US dollars),,,755.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2010,Tourism expenditure (millions of US dollars),,,1066.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2016,Tourism expenditure (millions of US dollars),,,1451.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2017,Tourism expenditure (millions of US dollars),,,1746.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+470,Malta,2018,Tourism expenditure (millions of US dollars),,,1845.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,1995,Tourist/visitor arrivals (thousands),TF,,5.5000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2005,Tourist/visitor arrivals (thousands),TF,,9.2000,Air and sea arrivals.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2010,Tourist/visitor arrivals (thousands),TF,,4.6000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2016,Tourist/visitor arrivals (thousands),TF,,5.4000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2017,Tourist/visitor arrivals (thousands),TF,,6.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2018,Tourist/visitor arrivals (thousands),TF,,6.8000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,1995,Tourism expenditure (millions of US dollars),,,2.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2005,Tourism expenditure (millions of US dollars),,,3.6900,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2010,Tourism expenditure (millions of US dollars),,,3.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2016,Tourism expenditure (millions of US dollars),,,30.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2017,Tourism expenditure (millions of US dollars),,,18.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+584,Marshall Islands,2018,Tourism expenditure (millions of US dollars),,,20.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,1995,Tourist/visitor arrivals (thousands),TF,,457.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2005,Tourist/visitor arrivals (thousands),TF,,484.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2010,Tourist/visitor arrivals (thousands),TF,,478.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2016,Tourist/visitor arrivals (thousands),TF,,519.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2017,Tourist/visitor arrivals (thousands),TF,,536.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2018,Tourist/visitor arrivals (thousands),TF,,537.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,1995,Tourism expenditure (millions of US dollars),,,384.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2005,Tourism expenditure (millions of US dollars),,,280.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2010,Tourism expenditure (millions of US dollars),,,472.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2016,Tourism expenditure (millions of US dollars),,,348.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2017,Tourism expenditure (millions of US dollars),,,510.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+474,Martinique,2018,Tourism expenditure (millions of US dollars),,,530.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+478,Mauritania,2016,Tourism expenditure (millions of US dollars),,,33.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+478,Mauritania,2017,Tourism expenditure (millions of US dollars),,,24.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+478,Mauritania,2018,Tourism expenditure (millions of US dollars),,,6.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,1995,Tourist/visitor arrivals (thousands),TF,,422.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2005,Tourist/visitor arrivals (thousands),TF,,761.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2010,Tourist/visitor arrivals (thousands),TF,,935.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2016,Tourist/visitor arrivals (thousands),TF,,1275.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2017,Tourist/visitor arrivals (thousands),TF,,1342.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2018,Tourist/visitor arrivals (thousands),TF,,1399.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,1995,Tourism expenditure (millions of US dollars),,,616.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2005,Tourism expenditure (millions of US dollars),,,1189.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2010,Tourism expenditure (millions of US dollars),,,1585.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2016,Tourism expenditure (millions of US dollars),,,1824.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2017,Tourism expenditure (millions of US dollars),,,2005.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+480,Mauritius,2018,Tourism expenditure (millions of US dollars),,,2161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,1995,Tourist/visitor arrivals (thousands),TF,,20241.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2005,Tourist/visitor arrivals (thousands),TF,,21915.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2010,Tourist/visitor arrivals (thousands),TF,,23290.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2016,Tourist/visitor arrivals (thousands),TF,,35079.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2017,Tourist/visitor arrivals (thousands),TF,,39291.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2018,Tourist/visitor arrivals (thousands),TF,,41313.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,1995,Tourism expenditure (millions of US dollars),,,6847.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2005,Tourism expenditure (millions of US dollars),,,12801.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2010,Tourism expenditure (millions of US dollars),,,12628.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2016,Tourism expenditure (millions of US dollars),,,20619.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2017,Tourism expenditure (millions of US dollars),,,22467.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+484,Mexico,2018,Tourism expenditure (millions of US dollars),,,23802.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+583,Micronesia (Fed. States of),2005,Tourist/visitor arrivals (thousands),TF,,19.0000,"Arrivals in the States of Kosrae, Chuuk, Pohnpei and Yap; excluding FSM citizens.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+583,Micronesia (Fed. States of),2010,Tourist/visitor arrivals (thousands),TF,,44.7000,"Arrivals in the States of Kosrae, Chuuk, Pohnpei and Yap; excluding FSM citizens.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+583,Micronesia (Fed. States of),2016,Tourist/visitor arrivals (thousands),TF,,29.6000,"Arrivals in the States of Kosrae, Chuuk, Pohnpei and Yap; excluding FSM citizens.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+583,Micronesia (Fed. States of),2018,Tourist/visitor arrivals (thousands),TF,,19.2000,"Arrivals in the States of Kosrae, Chuuk, Pohnpei and Yap; excluding FSM citizens.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+583,Micronesia (Fed. States of),2010,Tourism expenditure (millions of US dollars),,,24.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+492,Monaco,1995,Tourist/visitor arrivals (thousands),THS,,233.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+492,Monaco,2005,Tourist/visitor arrivals (thousands),THS,,286.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+492,Monaco,2010,Tourist/visitor arrivals (thousands),THS,,279.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+492,Monaco,2016,Tourist/visitor arrivals (thousands),THS,,336.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+492,Monaco,2017,Tourist/visitor arrivals (thousands),THS,,355.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+492,Monaco,2018,Tourist/visitor arrivals (thousands),THS,,347.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2005,Tourist/visitor arrivals (thousands),TF,,339.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2010,Tourist/visitor arrivals (thousands),TF,,456.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2016,Tourist/visitor arrivals (thousands),TF,,404.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2017,Tourist/visitor arrivals (thousands),TF,,469.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2018,Tourist/visitor arrivals (thousands),TF,,529.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,1995,Tourism expenditure (millions of US dollars),,,33.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2005,Tourism expenditure (millions of US dollars),,,203.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2010,Tourism expenditure (millions of US dollars),,,288.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2016,Tourism expenditure (millions of US dollars),,,379.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2017,Tourism expenditure (millions of US dollars),,,462.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+496,Mongolia,2018,Tourism expenditure (millions of US dollars),,,526.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2005,Tourist/visitor arrivals (thousands),TCE,,272.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2010,Tourist/visitor arrivals (thousands),TCE,,1088.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2016,Tourist/visitor arrivals (thousands),TCE,,1662.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2017,Tourist/visitor arrivals (thousands),TCE,,1877.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2018,Tourist/visitor arrivals (thousands),TCE,,2077.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2010,Tourism expenditure (millions of US dollars),,,765.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2016,Tourism expenditure (millions of US dollars),,,978.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2017,Tourism expenditure (millions of US dollars),,,1110.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+499,Montenegro,2018,Tourism expenditure (millions of US dollars),,,1224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,1995,Tourist/visitor arrivals (thousands),TF,,17.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2005,Tourist/visitor arrivals (thousands),TF,,9.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2010,Tourist/visitor arrivals (thousands),TF,,6.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2016,Tourist/visitor arrivals (thousands),TF,,8.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2017,Tourist/visitor arrivals (thousands),TF,,8.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2018,Tourist/visitor arrivals (thousands),TF,,8.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,1995,Tourism expenditure (millions of US dollars),,,17.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2005,Tourism expenditure (millions of US dollars),,,9.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2010,Tourism expenditure (millions of US dollars),,,5.9000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2016,Tourism expenditure (millions of US dollars),,,8.6000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2017,Tourism expenditure (millions of US dollars),,,8.4000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+500,Montserrat,2018,Tourism expenditure (millions of US dollars),,,11.1000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,1995,Tourist/visitor arrivals (thousands),TF,,2602.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2005,Tourist/visitor arrivals (thousands),TF,,5843.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2010,Tourist/visitor arrivals (thousands),TF,,9288.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2016,Tourist/visitor arrivals (thousands),TF,,10332.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2017,Tourist/visitor arrivals (thousands),TF,,11349.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2018,Tourist/visitor arrivals (thousands),TF,,12289.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,1995,Tourism expenditure (millions of US dollars),,,1469.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2005,Tourism expenditure (millions of US dollars),,,5426.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2010,Tourism expenditure (millions of US dollars),,,8176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2016,Tourism expenditure (millions of US dollars),,,7922.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2017,Tourism expenditure (millions of US dollars),,,9086.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+504,Morocco,2018,Tourism expenditure (millions of US dollars),,,9523.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2005,Tourist/visitor arrivals (thousands),TF,,578.0000,The data correspond only to 12 border posts.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2010,Tourist/visitor arrivals (thousands),TF,,1718.0000,Break in the time series.;The data of all the border posts of the country are used.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2016,Tourist/visitor arrivals (thousands),TF,,1639.0000,The data of all the border posts of the country are used.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2017,Tourist/visitor arrivals (thousands),TF,,1447.0000,The data of all the border posts of the country are used.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2018,Tourist/visitor arrivals (thousands),TF,,2743.0000,The data of all the border posts of the country are used.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2005,Tourism expenditure (millions of US dollars),,,138.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2010,Tourism expenditure (millions of US dollars),,,135.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2016,Tourism expenditure (millions of US dollars),,,114.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2017,Tourism expenditure (millions of US dollars),,,164.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+508,Mozambique,2018,Tourism expenditure (millions of US dollars),,,331.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,1995,Tourist/visitor arrivals (thousands),TF,,194.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2005,Tourist/visitor arrivals (thousands),TF,,660.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2010,Tourist/visitor arrivals (thousands),TF,,792.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2016,Tourist/visitor arrivals (thousands),TF,,2907.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2017,Tourist/visitor arrivals (thousands),TF,,3443.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2018,Tourist/visitor arrivals (thousands),TF,,3551.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,1995,Tourism expenditure (millions of US dollars),,,169.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2005,Tourism expenditure (millions of US dollars),,,83.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2010,Tourism expenditure (millions of US dollars),,,91.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2016,Tourism expenditure (millions of US dollars),,,2289.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2017,Tourism expenditure (millions of US dollars),,,1988.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+104,Myanmar,2018,Tourism expenditure (millions of US dollars),,,1670.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,1995,Tourist/visitor arrivals (thousands),TF,,272.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2005,Tourist/visitor arrivals (thousands),TF,,778.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2010,Tourist/visitor arrivals (thousands),TF,,984.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2016,Tourist/visitor arrivals (thousands),TF,,1469.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2017,Tourist/visitor arrivals (thousands),TF,,1499.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2005,Tourism expenditure (millions of US dollars),,,363.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2010,Tourism expenditure (millions of US dollars),,,473.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2016,Tourism expenditure (millions of US dollars),,,349.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2017,Tourism expenditure (millions of US dollars),,,449.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+516,Namibia,2018,Tourism expenditure (millions of US dollars),,,488.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+520,Nauru,2010,Tourism expenditure (millions of US dollars),,,0.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+520,Nauru,2016,Tourism expenditure (millions of US dollars),,,3.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+520,Nauru,2017,Tourism expenditure (millions of US dollars),,,3.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+520,Nauru,2018,Tourism expenditure (millions of US dollars),,,1.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,1995,Tourist/visitor arrivals (thousands),TF,,363.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2005,Tourist/visitor arrivals (thousands),TF,,375.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2010,Tourist/visitor arrivals (thousands),TF,,603.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2016,Tourist/visitor arrivals (thousands),TF,,753.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2017,Tourist/visitor arrivals (thousands),TF,,940.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2018,Tourist/visitor arrivals (thousands),TF,,1173.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,1995,Tourism expenditure (millions of US dollars),,,232.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2005,Tourism expenditure (millions of US dollars),,,160.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2010,Tourism expenditure (millions of US dollars),,,378.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2016,Tourism expenditure (millions of US dollars),,,498.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2017,Tourism expenditure (millions of US dollars),,,712.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+524,Nepal,2018,Tourism expenditure (millions of US dollars),,,744.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,1995,Tourist/visitor arrivals (thousands),TCE,,6574.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,2005,Tourist/visitor arrivals (thousands),TCE,,10012.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,2010,Tourist/visitor arrivals (thousands),TCE,,10883.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,2016,Tourist/visitor arrivals (thousands),TCE,,15828.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,2017,Tourist/visitor arrivals (thousands),TCE,,17924.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,2018,Tourist/visitor arrivals (thousands),TCE,,18780.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,1995,Tourism expenditure (millions of US dollars),,,10611.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,2016,Tourism expenditure (millions of US dollars),,,21151.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,2017,Tourism expenditure (millions of US dollars),,,23414.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+528,Netherlands,2018,Tourism expenditure (millions of US dollars),,,25850.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,1995,Tourist/visitor arrivals (thousands),TF,,86.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,2005,Tourist/visitor arrivals (thousands),TF,,101.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,2010,Tourist/visitor arrivals (thousands),TF,,99.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,2016,Tourist/visitor arrivals (thousands),TF,,116.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,2017,Tourist/visitor arrivals (thousands),TF,,121.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,2018,Tourist/visitor arrivals (thousands),TF,,120.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,1995,Tourism expenditure (millions of US dollars),,,108.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,2005,Tourism expenditure (millions of US dollars),,,149.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,2010,Tourism expenditure (millions of US dollars),,,129.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+540,New Caledonia,2016,Tourism expenditure (millions of US dollars),,,159.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2005,Tourist/visitor arrivals (thousands),TF,,2353.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2010,Tourist/visitor arrivals (thousands),TF,,2435.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2016,Tourist/visitor arrivals (thousands),TF,,3370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2017,Tourist/visitor arrivals (thousands),TF,,3555.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2018,Tourist/visitor arrivals (thousands),TF,,3686.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,1995,Tourism expenditure (millions of US dollars),,,2318.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2005,Tourism expenditure (millions of US dollars),,,6486.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2010,Tourism expenditure (millions of US dollars),,,6523.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2016,Tourism expenditure (millions of US dollars),,,9773.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2017,Tourism expenditure (millions of US dollars),,,10594.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+554,New Zealand,2018,Tourism expenditure (millions of US dollars),,,10961.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,1995,Tourist/visitor arrivals (thousands),TF,,281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2005,Tourist/visitor arrivals (thousands),TF,,712.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2010,Tourist/visitor arrivals (thousands),TF,,1011.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2016,Tourist/visitor arrivals (thousands),TF,,1504.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2017,Tourist/visitor arrivals (thousands),TF,,1787.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2018,Tourist/visitor arrivals (thousands),TF,,1256.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,1995,Tourism expenditure (millions of US dollars),,,50.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2005,Tourism expenditure (millions of US dollars),,,206.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2010,Tourism expenditure (millions of US dollars),,,314.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2016,Tourism expenditure (millions of US dollars),,,642.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2017,Tourism expenditure (millions of US dollars),,,841.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+558,Nicaragua,2018,Tourism expenditure (millions of US dollars),,,544.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,1995,Tourist/visitor arrivals (thousands),TF,,35.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2005,Tourist/visitor arrivals (thousands),TF,,58.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2010,Tourist/visitor arrivals (thousands),TF,,74.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2016,Tourist/visitor arrivals (thousands),TF,,152.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2017,Tourist/visitor arrivals (thousands),TF,,164.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2018,Tourist/visitor arrivals (thousands),TF,,157.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2005,Tourism expenditure (millions of US dollars),,,43.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2010,Tourism expenditure (millions of US dollars),,,105.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2016,Tourism expenditure (millions of US dollars),,,84.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+562,Niger,2017,Tourism expenditure (millions of US dollars),,,91.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,1995,Tourist/visitor arrivals (thousands),TF,,656.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,2005,Tourist/visitor arrivals (thousands),TF,,1010.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,2010,Tourist/visitor arrivals (thousands),TF,,1555.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,2016,Tourist/visitor arrivals (thousands),TF,,1889.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,1995,Tourism expenditure (millions of US dollars),,,47.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,2005,Tourism expenditure (millions of US dollars),,,139.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,2010,Tourism expenditure (millions of US dollars),,,736.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,2016,Tourism expenditure (millions of US dollars),,,1088.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,2017,Tourism expenditure (millions of US dollars),,,2615.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+566,Nigeria,2018,Tourism expenditure (millions of US dollars),,,1977.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+570,Niue,1995,Tourist/visitor arrivals (thousands),TF,,2.2000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+570,Niue,2005,Tourist/visitor arrivals (thousands),TF,,2.8000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+570,Niue,2010,Tourist/visitor arrivals (thousands),TF,,6.2000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+570,Niue,2016,Tourist/visitor arrivals (thousands),TF,,8.9000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+570,Niue,2017,Tourist/visitor arrivals (thousands),TF,,9.8000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+570,Niue,1995,Tourism expenditure (millions of US dollars),,,2.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+570,Niue,2005,Tourism expenditure (millions of US dollars),,,1.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+570,Niue,2010,Tourism expenditure (millions of US dollars),,,2.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,1995,Tourist/visitor arrivals (thousands),TCE,,147.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2005,Tourist/visitor arrivals (thousands),TCE,,197.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2010,Tourist/visitor arrivals (thousands),TCE,,262.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2016,Tourist/visitor arrivals (thousands),TCE,,510.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2017,Tourist/visitor arrivals (thousands),TCE,,631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2018,Tourist/visitor arrivals (thousands),TCE,,707.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2005,Tourism expenditure (millions of US dollars),,,116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2010,Tourism expenditure (millions of US dollars),,,199.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2016,Tourism expenditure (millions of US dollars),,,283.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2017,Tourism expenditure (millions of US dollars),,,331.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+807,North Macedonia,2018,Tourism expenditure (millions of US dollars),,,387.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+580,Northern Mariana Islands,1995,Tourist/visitor arrivals (thousands),TF,,669.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+580,Northern Mariana Islands,2005,Tourist/visitor arrivals (thousands),TF,,498.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+580,Northern Mariana Islands,2010,Tourist/visitor arrivals (thousands),TF,,375.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+580,Northern Mariana Islands,2016,Tourist/visitor arrivals (thousands),TF,,526.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+580,Northern Mariana Islands,2017,Tourist/visitor arrivals (thousands),TF,,656.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+580,Northern Mariana Islands,2018,Tourist/visitor arrivals (thousands),TF,,517.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+580,Northern Mariana Islands,1995,Tourism expenditure (millions of US dollars),,,655.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,1995,Tourist/visitor arrivals (thousands),TF,,2880.0000,Non-resident tourists staying in registered hotels.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2005,Tourist/visitor arrivals (thousands),TF,,3824.0000,Arrivals of non-resident tourists at national borders.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2010,Tourist/visitor arrivals (thousands),TF,,4767.0000,Arrivals of non-resident tourists at national borders.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2016,Tourist/visitor arrivals (thousands),TF,,5960.0000,Non-resident tourists staying in all types of accommodation establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2017,Tourist/visitor arrivals (thousands),TF,,6252.0000,Non-resident tourists staying in all types of accommodation establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2018,Tourist/visitor arrivals (thousands),TF,,5688.0000,Non-resident tourists staying in all types of accommodation establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,1995,Tourism expenditure (millions of US dollars),,,2730.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2005,Tourism expenditure (millions of US dollars),,,4243.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2010,Tourism expenditure (millions of US dollars),,,5299.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2016,Tourism expenditure (millions of US dollars),,,6285.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2017,Tourism expenditure (millions of US dollars),,,6840.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+578,Norway,2018,Tourism expenditure (millions of US dollars),,,7096.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2005,Tourist/visitor arrivals (thousands),TF,,891.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2010,Tourist/visitor arrivals (thousands),TF,,1441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2016,Tourist/visitor arrivals (thousands),TF,,2335.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2017,Tourist/visitor arrivals (thousands),TF,,2316.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2018,Tourist/visitor arrivals (thousands),TF,,2301.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2005,Tourism expenditure (millions of US dollars),,,627.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2010,Tourism expenditure (millions of US dollars),,,1072.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2016,Tourism expenditure (millions of US dollars),,,2390.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2017,Tourism expenditure (millions of US dollars),,,2717.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+512,Oman,2018,Tourism expenditure (millions of US dollars),,,2975.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,1995,Tourist/visitor arrivals (thousands),VF,,2332.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2005,Tourist/visitor arrivals (thousands),VF,,3378.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2010,Tourist/visitor arrivals (thousands),VF,,5567.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2016,Tourist/visitor arrivals (thousands),VF,,10690.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2017,Tourist/visitor arrivals (thousands),VF,,10740.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2018,Tourist/visitor arrivals (thousands),VF,,11067.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,1995,Tourism expenditure (millions of US dollars),,,3985.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2005,Tourism expenditure (millions of US dollars),,,5740.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2010,Tourism expenditure (millions of US dollars),,,10387.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2016,Tourism expenditure (millions of US dollars),,,15825.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2017,Tourism expenditure (millions of US dollars),,,14847.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+158,Other non-specified areas,2018,Tourism expenditure (millions of US dollars),,,16366.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,1995,Tourist/visitor arrivals (thousands),TF,,378.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,2005,Tourist/visitor arrivals (thousands),TF,,798.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,2010,Tourist/visitor arrivals (thousands),TF,,907.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,1995,Tourism expenditure (millions of US dollars),,,582.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,2005,Tourism expenditure (millions of US dollars),,,828.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,2010,Tourism expenditure (millions of US dollars),,,998.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,2016,Tourism expenditure (millions of US dollars),,,791.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,2017,Tourism expenditure (millions of US dollars),,,866.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+586,Pakistan,2018,Tourism expenditure (millions of US dollars),,,818.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,1995,Tourist/visitor arrivals (thousands),TF,,53.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2005,Tourist/visitor arrivals (thousands),TF,,81.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2010,Tourist/visitor arrivals (thousands),TF,,85.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2016,Tourist/visitor arrivals (thousands),TF,,138.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2017,Tourist/visitor arrivals (thousands),TF,,123.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2018,Tourist/visitor arrivals (thousands),TF,,106.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2005,Tourism expenditure (millions of US dollars),,,63.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2010,Tourism expenditure (millions of US dollars),,,76.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2016,Tourism expenditure (millions of US dollars),,,148.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+585,Palau,2017,Tourism expenditure (millions of US dollars),,,123.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,1995,Tourist/visitor arrivals (thousands),TF,,345.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2005,Tourist/visitor arrivals (thousands),TF,,702.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2010,Tourist/visitor arrivals (thousands),TF,,1324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2016,Tourist/visitor arrivals (thousands),TF,,1921.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2017,Tourist/visitor arrivals (thousands),TF,,1843.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2018,Tourist/visitor arrivals (thousands),TF,,1785.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,1995,Tourism expenditure (millions of US dollars),,,372.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2005,Tourism expenditure (millions of US dollars),,,1108.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2010,Tourism expenditure (millions of US dollars),,,2621.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2016,Tourism expenditure (millions of US dollars),,,6280.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2017,Tourism expenditure (millions of US dollars),,,6824.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+591,Panama,2018,Tourism expenditure (millions of US dollars),,,5615.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,1995,Tourist/visitor arrivals (thousands),TF,,42.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2005,Tourist/visitor arrivals (thousands),TF,,69.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2010,Tourist/visitor arrivals (thousands),TF,,140.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2016,Tourist/visitor arrivals (thousands),TF,,179.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2017,Tourist/visitor arrivals (thousands),TF,,139.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2018,Tourist/visitor arrivals (thousands),TF,,140.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2005,Tourism expenditure (millions of US dollars),,,9.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2010,Tourism expenditure (millions of US dollars),,,2.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2016,Tourism expenditure (millions of US dollars),,,1.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+598,Papua New Guinea,2017,Tourism expenditure (millions of US dollars),,,15.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,1995,Tourist/visitor arrivals (thousands),TF,,438.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2005,Tourist/visitor arrivals (thousands),TF,,341.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2010,Tourist/visitor arrivals (thousands),TF,,465.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2016,Tourist/visitor arrivals (thousands),TF,,1308.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2017,Tourist/visitor arrivals (thousands),TF,,1584.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2018,Tourist/visitor arrivals (thousands),TF,,1181.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,1995,Tourism expenditure (millions of US dollars),,,162.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2005,Tourism expenditure (millions of US dollars),,,96.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2010,Tourism expenditure (millions of US dollars),,,243.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2016,Tourism expenditure (millions of US dollars),,,356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2017,Tourism expenditure (millions of US dollars),,,399.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+600,Paraguay,2018,Tourism expenditure (millions of US dollars),,,393.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,1995,Tourist/visitor arrivals (thousands),TF,,479.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2005,Tourist/visitor arrivals (thousands),TF,,1571.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2010,Tourist/visitor arrivals (thousands),TF,,2299.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2016,Tourist/visitor arrivals (thousands),TF,,3744.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2017,Tourist/visitor arrivals (thousands),TF,,4032.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2018,Tourist/visitor arrivals (thousands),TF,,4419.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,1995,Tourism expenditure (millions of US dollars),,,521.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2005,Tourism expenditure (millions of US dollars),,,1438.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2010,Tourism expenditure (millions of US dollars),,,2475.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2016,Tourism expenditure (millions of US dollars),,,4288.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2017,Tourism expenditure (millions of US dollars),,,4573.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+604,Peru,2018,Tourism expenditure (millions of US dollars),,,4894.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,1995,Tourist/visitor arrivals (thousands),TF,,1760.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2005,Tourist/visitor arrivals (thousands),TF,,2623.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2010,Tourist/visitor arrivals (thousands),TF,,3520.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2016,Tourist/visitor arrivals (thousands),TF,,5967.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2017,Tourist/visitor arrivals (thousands),TF,,6621.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2018,Tourist/visitor arrivals (thousands),TF,,7168.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,1995,Tourism expenditure (millions of US dollars),,,1141.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2005,Tourism expenditure (millions of US dollars),,,2863.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2010,Tourism expenditure (millions of US dollars),,,3441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2016,Tourism expenditure (millions of US dollars),,,6289.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2017,Tourism expenditure (millions of US dollars),,,8349.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+608,Philippines,2018,Tourism expenditure (millions of US dollars),,,9730.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,1995,Tourist/visitor arrivals (thousands),TF,,19215.0000,"Border statistics are not collected any more, surveys used instead.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2005,Tourist/visitor arrivals (thousands),TF,,15200.0000,"Border statistics are not collected any more, surveys used instead.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2010,Tourist/visitor arrivals (thousands),TF,,12470.0000,"Border statistics are not collected any more, surveys used instead.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2016,Tourist/visitor arrivals (thousands),TF,,17471.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2017,Tourist/visitor arrivals (thousands),TF,,18258.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2018,Tourist/visitor arrivals (thousands),TF,,19622.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,1995,Tourism expenditure (millions of US dollars),,,6927.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2005,Tourism expenditure (millions of US dollars),,,7161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2010,Tourism expenditure (millions of US dollars),,,10036.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2016,Tourism expenditure (millions of US dollars),,,12052.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2017,Tourism expenditure (millions of US dollars),,,14083.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+616,Poland,2018,Tourism expenditure (millions of US dollars),,,15748.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,1995,Tourist/visitor arrivals (thousands),TCE,,4572.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2005,Tourist/visitor arrivals (thousands),TCE,,5769.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2010,Tourist/visitor arrivals (thousands),TCE,,6756.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2016,Tourist/visitor arrivals (thousands),TCE,,13359.0000,"Include hotels, apartment hotels, “pousadas”, tourist apartments, tourist villages, camping sites, recreation centres, tourism in rural areas and local accommodation.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2017,Tourist/visitor arrivals (thousands),TCE,,15432.0000,"Include hotels, apartment hotels, “pousadas”, tourist apartments, tourist villages, camping sites, recreation centres, tourism in rural areas and local accommodation.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2018,Tourist/visitor arrivals (thousands),TCE,,16186.0000,"Include hotels, apartment hotels, “pousadas”, tourist apartments, tourist villages, camping sites, recreation centres, tourism in rural areas and local accommodation.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,1995,Tourism expenditure (millions of US dollars),,,5646.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2005,Tourism expenditure (millions of US dollars),,,9038.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2010,Tourism expenditure (millions of US dollars),,,12984.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2016,Tourism expenditure (millions of US dollars),,,17347.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2017,Tourism expenditure (millions of US dollars),,,21586.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+620,Portugal,2018,Tourism expenditure (millions of US dollars),,,24105.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,1995,Tourist/visitor arrivals (thousands),TF,,3131.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2005,Tourist/visitor arrivals (thousands),TF,,3686.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2010,Tourist/visitor arrivals (thousands),TF,,3186.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2016,Tourist/visitor arrivals (thousands),TF,,3736.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2017,Tourist/visitor arrivals (thousands),TF,,3513.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2018,Tourist/visitor arrivals (thousands),TF,,3068.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,1995,Tourism expenditure (millions of US dollars),,,1828.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2005,Tourism expenditure (millions of US dollars),,,3239.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2010,Tourism expenditure (millions of US dollars),,,3211.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2016,Tourism expenditure (millions of US dollars),,,3974.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2017,Tourism expenditure (millions of US dollars),,,3848.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+630,Puerto Rico,2018,Tourism expenditure (millions of US dollars),,,3282.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+634,Qatar,2010,Tourist/visitor arrivals (thousands),TF,,1699.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+634,Qatar,2016,Tourist/visitor arrivals (thousands),TF,,2938.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+634,Qatar,2017,Tourist/visitor arrivals (thousands),TF,,2256.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+634,Qatar,2018,Tourist/visitor arrivals (thousands),TF,,1819.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+634,Qatar,2016,Tourism expenditure (millions of US dollars),,,12593.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+634,Qatar,2017,Tourism expenditure (millions of US dollars),,,15757.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+634,Qatar,2018,Tourism expenditure (millions of US dollars),,,15239.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,1995,Tourist/visitor arrivals (thousands),VF,,3753.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2005,Tourist/visitor arrivals (thousands),VF,,6023.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2010,Tourist/visitor arrivals (thousands),VF,,8798.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2016,Tourist/visitor arrivals (thousands),VF,,17242.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2017,Tourist/visitor arrivals (thousands),VF,,13336.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2018,Tourist/visitor arrivals (thousands),VF,,15347.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,1995,Tourism expenditure (millions of US dollars),,,6670.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2005,Tourism expenditure (millions of US dollars),,,8282.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2010,Tourism expenditure (millions of US dollars),,,14315.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2016,Tourism expenditure (millions of US dollars),,,20924.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2017,Tourism expenditure (millions of US dollars),,,17173.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+410,Republic of Korea,2018,Tourism expenditure (millions of US dollars),,,19856.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2005,Tourist/visitor arrivals (thousands),TCE,,67.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2010,Tourist/visitor arrivals (thousands),TCE,,64.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2016,Tourist/visitor arrivals (thousands),TCE,,121.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2017,Tourist/visitor arrivals (thousands),TCE,,145.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2018,Tourist/visitor arrivals (thousands),TCE,,160.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,1995,Tourism expenditure (millions of US dollars),,,71.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2005,Tourism expenditure (millions of US dollars),,,138.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2010,Tourism expenditure (millions of US dollars),,,222.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2016,Tourism expenditure (millions of US dollars),,,344.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2017,Tourism expenditure (millions of US dollars),,,443.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+498,Republic of Moldova,2018,Tourism expenditure (millions of US dollars),,,500.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,1995,Tourist/visitor arrivals (thousands),TF,,304.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2005,Tourist/visitor arrivals (thousands),TF,,409.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2010,Tourist/visitor arrivals (thousands),TF,,420.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2016,Tourist/visitor arrivals (thousands),TF,,458.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2017,Tourist/visitor arrivals (thousands),TF,,508.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2018,Tourist/visitor arrivals (thousands),TF,,535.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,1995,Tourism expenditure (millions of US dollars),,,216.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2005,Tourism expenditure (millions of US dollars),,,364.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2010,Tourism expenditure (millions of US dollars),,,392.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2016,Tourism expenditure (millions of US dollars),,,343.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2017,Tourism expenditure (millions of US dollars),,,427.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+638,Réunion,2018,Tourism expenditure (millions of US dollars),,,495.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,1995,Tourist/visitor arrivals (thousands),VF,,5445.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2005,Tourist/visitor arrivals (thousands),VF,,5839.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2010,Tourist/visitor arrivals (thousands),VF,,7498.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2016,Tourist/visitor arrivals (thousands),VF,,10223.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2017,Tourist/visitor arrivals (thousands),VF,,10926.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2018,Tourist/visitor arrivals (thousands),VF,,11720.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,1995,Tourism expenditure (millions of US dollars),,,689.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2005,Tourism expenditure (millions of US dollars),,,1324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2010,Tourism expenditure (millions of US dollars),,,1631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2016,Tourism expenditure (millions of US dollars),,,2172.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2017,Tourism expenditure (millions of US dollars),,,3008.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+642,Romania,2018,Tourism expenditure (millions of US dollars),,,3261.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,1995,Tourist/visitor arrivals (thousands),VF,,10290.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2005,Tourist/visitor arrivals (thousands),VF,,22201.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2010,Tourist/visitor arrivals (thousands),VF,,22281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2016,Tourist/visitor arrivals (thousands),VF,,24571.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2017,Tourist/visitor arrivals (thousands),VF,,24390.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2018,Tourist/visitor arrivals (thousands),VF,,24551.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2005,Tourism expenditure (millions of US dollars),,,7805.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2010,Tourism expenditure (millions of US dollars),,,13239.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2016,Tourism expenditure (millions of US dollars),,,12822.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2017,Tourism expenditure (millions of US dollars),,,14983.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+643,Russian Federation,2018,Tourism expenditure (millions of US dollars),,,18670.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+646,Rwanda,2010,Tourist/visitor arrivals (thousands),TF,,504.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+646,Rwanda,2016,Tourist/visitor arrivals (thousands),TF,,932.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+646,Rwanda,1995,Tourism expenditure (millions of US dollars),,,4.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+646,Rwanda,2005,Tourism expenditure (millions of US dollars),,,67.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+646,Rwanda,2010,Tourism expenditure (millions of US dollars),,,224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+646,Rwanda,2016,Tourism expenditure (millions of US dollars),,,443.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+646,Rwanda,2017,Tourism expenditure (millions of US dollars),,,548.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+646,Rwanda,2018,Tourism expenditure (millions of US dollars),,,528.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+667,Saba,1995,Tourist/visitor arrivals (thousands),TF,,10.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+667,Saba,2005,Tourist/visitor arrivals (thousands),TF,,11.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+667,Saba,2010,Tourist/visitor arrivals (thousands),TF,,12.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,1995,Tourist/visitor arrivals (thousands),TF,,79.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2005,Tourist/visitor arrivals (thousands),TF,,141.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2010,Tourist/visitor arrivals (thousands),TF,,98.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2016,Tourist/visitor arrivals (thousands),TF,,116.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2017,Tourist/visitor arrivals (thousands),TF,,115.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2018,Tourist/visitor arrivals (thousands),TF,,125.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,1995,Tourism expenditure (millions of US dollars),,,63.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2005,Tourism expenditure (millions of US dollars),,,121.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2010,Tourism expenditure (millions of US dollars),,,90.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2016,Tourism expenditure (millions of US dollars),,,332.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2017,Tourism expenditure (millions of US dollars),,,355.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+659,Saint Kitts and Nevis,2018,Tourism expenditure (millions of US dollars),,,367.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,1995,Tourist/visitor arrivals (thousands),TF,,231.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2005,Tourist/visitor arrivals (thousands),TF,,318.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2010,Tourist/visitor arrivals (thousands),TF,,306.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2016,Tourist/visitor arrivals (thousands),TF,,348.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2017,Tourist/visitor arrivals (thousands),TF,,386.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2018,Tourist/visitor arrivals (thousands),TF,,395.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,1995,Tourism expenditure (millions of US dollars),,,230.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2005,Tourism expenditure (millions of US dollars),,,382.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2010,Tourism expenditure (millions of US dollars),,,309.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2016,Tourism expenditure (millions of US dollars),,,776.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2017,Tourism expenditure (millions of US dollars),,,875.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+662,Saint Lucia,2018,Tourism expenditure (millions of US dollars),,,989.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,1995,Tourist/visitor arrivals (thousands),TF,,60.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2005,Tourist/visitor arrivals (thousands),TF,,96.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2010,Tourist/visitor arrivals (thousands),TF,,72.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2016,Tourist/visitor arrivals (thousands),TF,,79.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2017,Tourist/visitor arrivals (thousands),TF,,76.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2018,Tourist/visitor arrivals (thousands),TF,,80.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,1995,Tourism expenditure (millions of US dollars),,,53.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2005,Tourism expenditure (millions of US dollars),,,104.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2010,Tourism expenditure (millions of US dollars),,,86.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2016,Tourism expenditure (millions of US dollars),,,216.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2017,Tourism expenditure (millions of US dollars),,,211.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+670,Saint Vincent & Grenadines,2018,Tourism expenditure (millions of US dollars),,,235.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,1995,Tourist/visitor arrivals (thousands),TF,,68.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2005,Tourist/visitor arrivals (thousands),TF,,102.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2010,Tourist/visitor arrivals (thousands),TF,,122.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2016,Tourist/visitor arrivals (thousands),TF,,134.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2017,Tourist/visitor arrivals (thousands),TF,,146.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2018,Tourist/visitor arrivals (thousands),TF,,164.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,1995,Tourism expenditure (millions of US dollars),,,35.6994,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2005,Tourism expenditure (millions of US dollars),,,73.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2010,Tourism expenditure (millions of US dollars),,,123.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2016,Tourism expenditure (millions of US dollars),,,148.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2017,Tourism expenditure (millions of US dollars),,,167.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+882,Samoa,2018,Tourism expenditure (millions of US dollars),,,191.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+674,San Marino,1995,Tourist/visitor arrivals (thousands),THS,,28.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+674,San Marino,2005,Tourist/visitor arrivals (thousands),THS,,50.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+674,San Marino,2010,Tourist/visitor arrivals (thousands),THS,,120.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+674,San Marino,2016,Tourist/visitor arrivals (thousands),THS,,60.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+674,San Marino,2017,Tourist/visitor arrivals (thousands),THS,,78.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+674,San Marino,2018,Tourist/visitor arrivals (thousands),THS,,84.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,1995,Tourist/visitor arrivals (thousands),TF,,6.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,2005,Tourist/visitor arrivals (thousands),TF,,15.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,2010,Tourist/visitor arrivals (thousands),TF,,8.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,2016,Tourist/visitor arrivals (thousands),TF,,28.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,2017,Tourist/visitor arrivals (thousands),TF,,28.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,2018,Tourist/visitor arrivals (thousands),TF,,33.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,2016,Tourism expenditure (millions of US dollars),,,69.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,2017,Tourism expenditure (millions of US dollars),,,65.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+678,Sao Tome and Principe,2018,Tourism expenditure (millions of US dollars),,,71.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,1995,Tourist/visitor arrivals (thousands),TF,,3325.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2005,Tourist/visitor arrivals (thousands),TF,,8037.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2010,Tourist/visitor arrivals (thousands),TF,,10850.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2016,Tourist/visitor arrivals (thousands),TF,,18044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2017,Tourist/visitor arrivals (thousands),TF,,16109.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2018,Tourist/visitor arrivals (thousands),TF,,15334.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2010,Tourism expenditure (millions of US dollars),,,7536.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2016,Tourism expenditure (millions of US dollars),,,13438.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2017,Tourism expenditure (millions of US dollars),,,15020.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+682,Saudi Arabia,2018,Tourism expenditure (millions of US dollars),,,16975.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,2005,Tourist/visitor arrivals (thousands),TF,,769.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,2010,Tourist/visitor arrivals (thousands),TF,,900.0000,Estimate.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,2016,Tourist/visitor arrivals (thousands),TF,,1210.0000,Estimate.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,2017,Tourist/visitor arrivals (thousands),TF,,1365.0000,Estimate.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,1995,Tourism expenditure (millions of US dollars),,,168.1803,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,2005,Tourism expenditure (millions of US dollars),,,334.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,2010,Tourism expenditure (millions of US dollars),,,464.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,2016,Tourism expenditure (millions of US dollars),,,438.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+686,Senegal,2017,Tourism expenditure (millions of US dollars),,,468.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2005,Tourist/visitor arrivals (thousands),TCE,,453.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2010,Tourist/visitor arrivals (thousands),TCE,,683.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2016,Tourist/visitor arrivals (thousands),TCE,,1281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2017,Tourist/visitor arrivals (thousands),TCE,,1497.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2018,Tourist/visitor arrivals (thousands),TCE,,1711.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2005,Tourism expenditure (millions of US dollars),,,308.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2010,Tourism expenditure (millions of US dollars),,,950.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2016,Tourism expenditure (millions of US dollars),,,1461.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2017,Tourism expenditure (millions of US dollars),,,1706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+688,Serbia,2018,Tourism expenditure (millions of US dollars),,,1921.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,1995,Tourist/visitor arrivals (thousands),TF,,121.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2005,Tourist/visitor arrivals (thousands),TF,,129.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2010,Tourist/visitor arrivals (thousands),TF,,175.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2016,Tourist/visitor arrivals (thousands),TF,,303.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2017,Tourist/visitor arrivals (thousands),TF,,350.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2018,Tourist/visitor arrivals (thousands),TF,,362.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,1995,Tourism expenditure (millions of US dollars),,,224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2005,Tourism expenditure (millions of US dollars),,,269.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2010,Tourism expenditure (millions of US dollars),,,352.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2016,Tourism expenditure (millions of US dollars),,,505.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2017,Tourism expenditure (millions of US dollars),,,585.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+690,Seychelles,2018,Tourism expenditure (millions of US dollars),,,611.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,1995,Tourist/visitor arrivals (thousands),TF,,13.8000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2005,Tourist/visitor arrivals (thousands),TF,,40.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2010,Tourist/visitor arrivals (thousands),TF,,39.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2016,Tourist/visitor arrivals (thousands),TF,,55.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2017,Tourist/visitor arrivals (thousands),TF,,51.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2018,Tourist/visitor arrivals (thousands),TF,,57.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,1995,Tourism expenditure (millions of US dollars),,,57.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2005,Tourism expenditure (millions of US dollars),,,64.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2010,Tourism expenditure (millions of US dollars),,,26.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2016,Tourism expenditure (millions of US dollars),,,41.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2017,Tourism expenditure (millions of US dollars),,,39.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+694,Sierra Leone,2018,Tourism expenditure (millions of US dollars),,,39.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,1995,Tourist/visitor arrivals (thousands),TF,,6070.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2005,Tourist/visitor arrivals (thousands),TF,,7079.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2010,Tourist/visitor arrivals (thousands),TF,,9161.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2016,Tourist/visitor arrivals (thousands),TF,,12913.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2017,Tourist/visitor arrivals (thousands),TF,,13903.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2018,Tourist/visitor arrivals (thousands),TF,,14673.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,1995,Tourism expenditure (millions of US dollars),,,7611.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2005,Tourism expenditure (millions of US dollars),,,6209.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2010,Tourism expenditure (millions of US dollars),,,14178.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2016,Tourism expenditure (millions of US dollars),,,18944.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2017,Tourism expenditure (millions of US dollars),,,19891.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+702,Singapore,2018,Tourism expenditure (millions of US dollars),,,20416.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+668,Sint Eustatius,1995,Tourist/visitor arrivals (thousands),TF,,8.8000,Excluding Netherlands Antillean residents.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+668,Sint Eustatius,2005,Tourist/visitor arrivals (thousands),TF,,10.4000,Excluding Netherlands Antillean residents.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+668,Sint Eustatius,2010,Tourist/visitor arrivals (thousands),TF,,11.4000,Excluding Netherlands Antillean residents.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),1995,Tourist/visitor arrivals (thousands),TF,,460.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2005,Tourist/visitor arrivals (thousands),TF,,468.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2010,Tourist/visitor arrivals (thousands),TF,,443.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2016,Tourist/visitor arrivals (thousands),TF,,528.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2017,Tourist/visitor arrivals (thousands),TF,,402.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2018,Tourist/visitor arrivals (thousands),TF,,178.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2010,Tourism expenditure (millions of US dollars),,,681.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2016,Tourism expenditure (millions of US dollars),,,871.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2017,Tourism expenditure (millions of US dollars),,,646.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+534,Sint Maarten (Dutch part),2018,Tourism expenditure (millions of US dollars),,,468.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,1995,Tourist/visitor arrivals (thousands),TCE,,903.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2005,Tourist/visitor arrivals (thousands),TCE,,1515.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2010,Tourist/visitor arrivals (thousands),TCE,,1327.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2016,Tourist/visitor arrivals (thousands),TCE,,2027.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2017,Tourist/visitor arrivals (thousands),TCE,,2162.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2018,Tourist/visitor arrivals (thousands),TCE,,2256.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,1995,Tourism expenditure (millions of US dollars),,,630.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2005,Tourism expenditure (millions of US dollars),,,1282.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2010,Tourism expenditure (millions of US dollars),,,2334.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2016,Tourism expenditure (millions of US dollars),,,2812.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2017,Tourism expenditure (millions of US dollars),,,3024.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+703,Slovakia,2018,Tourism expenditure (millions of US dollars),,,3318.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,1995,Tourist/visitor arrivals (thousands),TCE,,732.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2005,Tourist/visitor arrivals (thousands),TCE,,1555.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2010,Tourist/visitor arrivals (thousands),TCE,,2049.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2016,Tourist/visitor arrivals (thousands),TCE,,3397.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2017,Tourist/visitor arrivals (thousands),TCE,,3991.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2018,Tourist/visitor arrivals (thousands),TCE,,4425.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,1995,Tourism expenditure (millions of US dollars),,,1128.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2005,Tourism expenditure (millions of US dollars),,,1894.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2010,Tourism expenditure (millions of US dollars),,,2808.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2016,Tourism expenditure (millions of US dollars),,,2717.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2017,Tourism expenditure (millions of US dollars),,,3057.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+705,Slovenia,2018,Tourism expenditure (millions of US dollars),,,3378.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,1995,Tourist/visitor arrivals (thousands),TF,,11.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2005,Tourist/visitor arrivals (thousands),TF,,9.4000,Without first quarter.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2010,Tourist/visitor arrivals (thousands),TF,,20.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2016,Tourist/visitor arrivals (thousands),TF,,23.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2017,Tourist/visitor arrivals (thousands),TF,,25.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2018,Tourist/visitor arrivals (thousands),TF,,27.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,1995,Tourism expenditure (millions of US dollars),,,17.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2005,Tourism expenditure (millions of US dollars),,,6.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2010,Tourism expenditure (millions of US dollars),,,50.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2016,Tourism expenditure (millions of US dollars),,,71.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2017,Tourism expenditure (millions of US dollars),,,79.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+90,Solomon Islands,2018,Tourism expenditure (millions of US dollars),,,92.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,1995,Tourist/visitor arrivals (thousands),TF,,4488.0000,Excluding arrivals for work and contract workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2005,Tourist/visitor arrivals (thousands),TF,,7369.0000,Excluding arrivals for work and contract workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2010,Tourist/visitor arrivals (thousands),TF,,8074.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2016,Tourist/visitor arrivals (thousands),TF,,10044.0000,Break in the time series.;Excluding transit.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2017,Tourist/visitor arrivals (thousands),TF,,10285.0000,Excluding transit.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2018,Tourist/visitor arrivals (thousands),TF,,10472.0000,Excluding transit.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,1995,Tourism expenditure (millions of US dollars),,,2654.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2005,Tourism expenditure (millions of US dollars),,,8629.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2010,Tourism expenditure (millions of US dollars),,,10309.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2016,Tourism expenditure (millions of US dollars),,,8807.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2017,Tourism expenditure (millions of US dollars),,,9706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+710,South Africa,2018,Tourism expenditure (millions of US dollars),,,9789.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+728,South Sudan,2016,Tourism expenditure (millions of US dollars),,,23.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+728,South Sudan,2017,Tourism expenditure (millions of US dollars),,,26.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+728,South Sudan,2018,Tourism expenditure (millions of US dollars),,,12.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,1995,Tourist/visitor arrivals (thousands),TF,,32971.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2005,Tourist/visitor arrivals (thousands),TF,,55914.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2010,Tourist/visitor arrivals (thousands),TF,,52677.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2016,Tourist/visitor arrivals (thousands),TF,,75315.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2017,Tourist/visitor arrivals (thousands),TF,,81869.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2018,Tourist/visitor arrivals (thousands),TF,,82773.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,1995,Tourism expenditure (millions of US dollars),,,25368.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2005,Tourism expenditure (millions of US dollars),,,51959.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2010,Tourism expenditure (millions of US dollars),,,58348.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2016,Tourism expenditure (millions of US dollars),,,66982.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2017,Tourism expenditure (millions of US dollars),,,75906.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+724,Spain,2018,Tourism expenditure (millions of US dollars),,,81250.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,1995,Tourist/visitor arrivals (thousands),TF,,403.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2005,Tourist/visitor arrivals (thousands),TF,,549.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2010,Tourist/visitor arrivals (thousands),TF,,654.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2016,Tourist/visitor arrivals (thousands),TF,,2051.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2017,Tourist/visitor arrivals (thousands),TF,,2116.4000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2018,Tourist/visitor arrivals (thousands),TF,,2334.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,1995,Tourism expenditure (millions of US dollars),,,367.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2005,Tourism expenditure (millions of US dollars),,,729.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2010,Tourism expenditure (millions of US dollars),,,1044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2016,Tourism expenditure (millions of US dollars),,,4591.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2017,Tourism expenditure (millions of US dollars),,,5083.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+144,Sri Lanka,2018,Tourism expenditure (millions of US dollars),,,5608.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2005,Tourist/visitor arrivals (thousands),THS,,88.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2010,Tourist/visitor arrivals (thousands),THS,,522.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2016,Tourist/visitor arrivals (thousands),THS,,400.0000,West Bank only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2017,Tourist/visitor arrivals (thousands),THS,,503.0000,West Bank only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2018,Tourist/visitor arrivals (thousands),THS,,606.0000,West Bank only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,1995,Tourism expenditure (millions of US dollars),,,255.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2005,Tourism expenditure (millions of US dollars),,,52.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2010,Tourism expenditure (millions of US dollars),,,409.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2016,Tourism expenditure (millions of US dollars),,,235.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2017,Tourism expenditure (millions of US dollars),,,225.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+275,State of Palestine,2018,Tourism expenditure (millions of US dollars),,,245.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,1995,Tourist/visitor arrivals (thousands),TF,,29.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2005,Tourist/visitor arrivals (thousands),TF,,246.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2010,Tourist/visitor arrivals (thousands),TF,,495.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2016,Tourist/visitor arrivals (thousands),TF,,800.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2017,Tourist/visitor arrivals (thousands),TF,,813.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2018,Tourist/visitor arrivals (thousands),TF,,836.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,1995,Tourism expenditure (millions of US dollars),,,8.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2005,Tourism expenditure (millions of US dollars),,,114.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2010,Tourism expenditure (millions of US dollars),,,82.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2016,Tourism expenditure (millions of US dollars),,,1009.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2017,Tourism expenditure (millions of US dollars),,,1029.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+729,Sudan,2018,Tourism expenditure (millions of US dollars),,,1043.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,1995,Tourist/visitor arrivals (thousands),TF,,43.0000,Arrivals at Zanderij Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2005,Tourist/visitor arrivals (thousands),TF,,161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2010,Tourist/visitor arrivals (thousands),TF,,205.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2016,Tourist/visitor arrivals (thousands),TF,,256.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2017,Tourist/visitor arrivals (thousands),TF,,278.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,1995,Tourism expenditure (millions of US dollars),,,52.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2005,Tourism expenditure (millions of US dollars),,,96.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2010,Tourism expenditure (millions of US dollars),,,69.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2016,Tourism expenditure (millions of US dollars),,,74.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2017,Tourism expenditure (millions of US dollars),,,61.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+740,Suriname,2018,Tourism expenditure (millions of US dollars),,,73.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,1995,Tourist/visitor arrivals (thousands),TCE,,2310.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2005,Tourist/visitor arrivals (thousands),TCE,,4883.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2010,Tourist/visitor arrivals (thousands),TCE,,5183.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2016,Tourist/visitor arrivals (thousands),TCE,,6782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2017,Tourist/visitor arrivals (thousands),TCE,,7054.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2018,Tourist/visitor arrivals (thousands),TCE,,7440.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,1995,Tourism expenditure (millions of US dollars),,,3471.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2005,Tourism expenditure (millions of US dollars),,,6554.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2010,Tourism expenditure (millions of US dollars),,,8336.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2016,Tourism expenditure (millions of US dollars),,,12764.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2017,Tourism expenditure (millions of US dollars),,,14168.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+752,Sweden,2018,Tourism expenditure (millions of US dollars),,,14926.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,1995,Tourist/visitor arrivals (thousands),THS,,6946.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2005,Tourist/visitor arrivals (thousands),THS,,7229.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2010,Tourist/visitor arrivals (thousands),THS,,8628.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2016,Tourist/visitor arrivals (thousands),THS,,9205.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2017,Tourist/visitor arrivals (thousands),THS,,9889.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2018,Tourist/visitor arrivals (thousands),THS,,10362.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,1995,Tourism expenditure (millions of US dollars),,,11354.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2005,Tourism expenditure (millions of US dollars),,,11952.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2010,Tourism expenditure (millions of US dollars),,,17614.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2016,Tourism expenditure (millions of US dollars),,,19042.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2017,Tourism expenditure (millions of US dollars),,,19654.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+756,Switzerland,2018,Tourism expenditure (millions of US dollars),,,20276.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+760,Syrian Arab Republic,1995,Tourist/visitor arrivals (thousands),TCE,,815.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+760,Syrian Arab Republic,2005,Tourist/visitor arrivals (thousands),TCE,,3571.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+760,Syrian Arab Republic,2010,Tourist/visitor arrivals (thousands),TCE,,8546.0000,Including nationals residing abroad.;Including Iraqi nationals.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+760,Syrian Arab Republic,2005,Tourism expenditure (millions of US dollars),,,2035.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+760,Syrian Arab Republic,2010,Tourism expenditure (millions of US dollars),,,6308.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2010,Tourist/visitor arrivals (thousands),VF,,160.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2016,Tourist/visitor arrivals (thousands),VF,,344.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2017,Tourist/visitor arrivals (thousands),VF,,431.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2018,Tourist/visitor arrivals (thousands),VF,,1035.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2005,Tourism expenditure (millions of US dollars),,,9.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2010,Tourism expenditure (millions of US dollars),,,141.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2016,Tourism expenditure (millions of US dollars),,,149.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2017,Tourism expenditure (millions of US dollars),,,171.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+762,Tajikistan,2018,Tourism expenditure (millions of US dollars),,,170.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,1995,Tourist/visitor arrivals (thousands),TF,,6952.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2005,Tourist/visitor arrivals (thousands),TF,,11567.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2010,Tourist/visitor arrivals (thousands),TF,,15936.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2016,Tourist/visitor arrivals (thousands),TF,,32530.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2017,Tourist/visitor arrivals (thousands),TF,,35592.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2018,Tourist/visitor arrivals (thousands),TF,,38178.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,1995,Tourism expenditure (millions of US dollars),,,9257.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2005,Tourism expenditure (millions of US dollars),,,12103.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2010,Tourism expenditure (millions of US dollars),,,23796.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2016,Tourism expenditure (millions of US dollars),,,48459.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2017,Tourism expenditure (millions of US dollars),,,57057.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+764,Thailand,2018,Tourism expenditure (millions of US dollars),,,65242.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+626,Timor-Leste,2010,Tourist/visitor arrivals (thousands),TF,,40.0000,Arrivals by air at Dili Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+626,Timor-Leste,2016,Tourist/visitor arrivals (thousands),TF,,66.0000,Arrivals by air at Dili Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+626,Timor-Leste,2017,Tourist/visitor arrivals (thousands),TF,,74.0000,Arrivals by air at Dili Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+626,Timor-Leste,2018,Tourist/visitor arrivals (thousands),TF,,75.0000,Arrivals by air at Dili Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+626,Timor-Leste,2010,Tourism expenditure (millions of US dollars),,,24.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+626,Timor-Leste,2016,Tourism expenditure (millions of US dollars),,,58.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+626,Timor-Leste,2017,Tourism expenditure (millions of US dollars),,,73.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+626,Timor-Leste,2018,Tourism expenditure (millions of US dollars),,,78.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,1995,Tourist/visitor arrivals (thousands),THS,,53.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2005,Tourist/visitor arrivals (thousands),THS,,81.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2010,Tourist/visitor arrivals (thousands),THS,,202.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2016,Tourist/visitor arrivals (thousands),THS,,338.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2017,Tourist/visitor arrivals (thousands),THS,,514.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2018,Tourist/visitor arrivals (thousands),THS,,573.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2005,Tourism expenditure (millions of US dollars),,,27.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2010,Tourism expenditure (millions of US dollars),,,105.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2016,Tourism expenditure (millions of US dollars),,,223.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+768,Togo,2017,Tourism expenditure (millions of US dollars),,,245.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,1995,Tourist/visitor arrivals (thousands),TF,,29.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2005,Tourist/visitor arrivals (thousands),TF,,42.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2010,Tourist/visitor arrivals (thousands),TF,,47.1000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2016,Tourist/visitor arrivals (thousands),TF,,59.1000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2017,Tourist/visitor arrivals (thousands),TF,,62.5000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2018,Tourist/visitor arrivals (thousands),TF,,54.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2005,Tourism expenditure (millions of US dollars),,,15.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2010,Tourism expenditure (millions of US dollars),,,17.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2016,Tourism expenditure (millions of US dollars),,,52.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2017,Tourism expenditure (millions of US dollars),,,48.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+776,Tonga,2018,Tourism expenditure (millions of US dollars),,,48.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,1995,Tourist/visitor arrivals (thousands),TF,,260.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2005,Tourist/visitor arrivals (thousands),TF,,463.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2010,Tourist/visitor arrivals (thousands),TF,,388.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2016,Tourist/visitor arrivals (thousands),TF,,409.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2017,Tourist/visitor arrivals (thousands),TF,,395.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2018,Tourist/visitor arrivals (thousands),TF,,375.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,1995,Tourism expenditure (millions of US dollars),,,232.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2005,Tourism expenditure (millions of US dollars),,,593.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2010,Tourism expenditure (millions of US dollars),,,630.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2016,Tourism expenditure (millions of US dollars),,,708.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2017,Tourism expenditure (millions of US dollars),,,717.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+780,Trinidad and Tobago,2018,Tourism expenditure (millions of US dollars),,,541.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,1995,Tourist/visitor arrivals (thousands),TF,,4120.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2005,Tourist/visitor arrivals (thousands),TF,,6378.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2010,Tourist/visitor arrivals (thousands),TF,,7828.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2016,Tourist/visitor arrivals (thousands),TF,,5724.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2017,Tourist/visitor arrivals (thousands),TF,,7052.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2018,Tourist/visitor arrivals (thousands),TF,,8299.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,1995,Tourism expenditure (millions of US dollars),,,1838.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2005,Tourism expenditure (millions of US dollars),,,2800.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2010,Tourism expenditure (millions of US dollars),,,3477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2016,Tourism expenditure (millions of US dollars),,,1706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2017,Tourism expenditure (millions of US dollars),,,1782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+788,Tunisia,2018,Tourism expenditure (millions of US dollars),,,2320.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,1995,Tourist/visitor arrivals (thousands),TF,,7083.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2005,Tourist/visitor arrivals (thousands),TF,,20273.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2010,Tourist/visitor arrivals (thousands),TF,,31364.0000,Turkish citizens resident abroad are included.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2016,Tourist/visitor arrivals (thousands),TF,,30289.0000,Turkish citizens resident abroad are included.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2017,Tourist/visitor arrivals (thousands),TF,,37601.0000,Turkish citizens resident abroad are included.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2018,Tourist/visitor arrivals (thousands),TF,,45768.0000,Turkish citizens resident abroad are included.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2005,Tourism expenditure (millions of US dollars),,,20760.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2010,Tourism expenditure (millions of US dollars),,,26318.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2016,Tourism expenditure (millions of US dollars),,,26788.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2017,Tourism expenditure (millions of US dollars),,,31870.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+792,Turkey,2018,Tourism expenditure (millions of US dollars),,,37140.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+795,Turkmenistan,1995,Tourist/visitor arrivals (thousands),TF,,218.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+795,Turkmenistan,2005,Tourist/visitor arrivals (thousands),TF,,11.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+796,Turks and Caicos Islands,1995,Tourist/visitor arrivals (thousands),TF,,79.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+796,Turks and Caicos Islands,2005,Tourist/visitor arrivals (thousands),TF,,176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+796,Turks and Caicos Islands,2010,Tourist/visitor arrivals (thousands),TF,,281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+796,Turks and Caicos Islands,2016,Tourist/visitor arrivals (thousands),TF,,449.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+796,Turks and Caicos Islands,2017,Tourist/visitor arrivals (thousands),TF,,416.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+796,Turks and Caicos Islands,2018,Tourist/visitor arrivals (thousands),TF,,441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+796,Turks and Caicos Islands,1995,Tourism expenditure (millions of US dollars),,,53.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+798,Tuvalu,1995,Tourist/visitor arrivals (thousands),TF,,0.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+798,Tuvalu,2005,Tourist/visitor arrivals (thousands),TF,,1.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+798,Tuvalu,2010,Tourist/visitor arrivals (thousands),TF,,1.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+798,Tuvalu,2016,Tourist/visitor arrivals (thousands),TF,,2.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+798,Tuvalu,2017,Tourist/visitor arrivals (thousands),TF,,2.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+798,Tuvalu,2018,Tourist/visitor arrivals (thousands),TF,,2.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+798,Tuvalu,2005,Tourism expenditure (millions of US dollars),,,1.2000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+798,Tuvalu,2010,Tourism expenditure (millions of US dollars),,,2.4000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,1995,Tourist/visitor arrivals (thousands),TF,,160.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2005,Tourist/visitor arrivals (thousands),TF,,468.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2010,Tourist/visitor arrivals (thousands),TF,,946.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2016,Tourist/visitor arrivals (thousands),TF,,1323.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2017,Tourist/visitor arrivals (thousands),TF,,1402.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2005,Tourism expenditure (millions of US dollars),,,382.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2010,Tourism expenditure (millions of US dollars),,,802.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2016,Tourism expenditure (millions of US dollars),,,1118.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2017,Tourism expenditure (millions of US dollars),,,957.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+800,Uganda,2018,Tourism expenditure (millions of US dollars),,,1044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,1995,Tourist/visitor arrivals (thousands),TF,,3716.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2005,Tourist/visitor arrivals (thousands),TF,,17631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2010,Tourist/visitor arrivals (thousands),TF,,21203.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2016,Tourist/visitor arrivals (thousands),TF,,13333.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2017,Tourist/visitor arrivals (thousands),TF,,14230.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2018,Tourist/visitor arrivals (thousands),TF,,14104.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2005,Tourism expenditure (millions of US dollars),,,3542.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2010,Tourism expenditure (millions of US dollars),,,4696.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2016,Tourism expenditure (millions of US dollars),,,1723.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2017,Tourism expenditure (millions of US dollars),,,2019.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+804,Ukraine,2018,Tourism expenditure (millions of US dollars),,,2269.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,1995,Tourist/visitor arrivals (thousands),THS,,2315.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2005,Tourist/visitor arrivals (thousands),THS,,7126.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2016,Tourist/visitor arrivals (thousands),THS,,18967.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2017,Tourist/visitor arrivals (thousands),THS,,20394.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2018,Tourist/visitor arrivals (thousands),THS,,21286.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,1995,Tourism expenditure (millions of US dollars),,,632.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2005,Tourism expenditure (millions of US dollars),,,3218.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2010,Tourism expenditure (millions of US dollars),,,8577.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2016,Tourism expenditure (millions of US dollars),,,19496.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2017,Tourism expenditure (millions of US dollars),,,21048.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+784,United Arab Emirates,2018,Tourism expenditure (millions of US dollars),,,21390.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,1995,Tourist/visitor arrivals (thousands),TF,,21719.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2005,Tourist/visitor arrivals (thousands),TF,,28039.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2010,Tourist/visitor arrivals (thousands),TF,,28295.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2016,Tourist/visitor arrivals (thousands),TF,,35814.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2017,Tourist/visitor arrivals (thousands),TF,,37651.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2018,Tourist/visitor arrivals (thousands),TF,,36316.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,1995,Tourism expenditure (millions of US dollars),,,27577.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2005,Tourism expenditure (millions of US dollars),,,32948.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2010,Tourism expenditure (millions of US dollars),,,34715.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2016,Tourism expenditure (millions of US dollars),,,47777.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2017,Tourism expenditure (millions of US dollars),,,47719.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+826,United Kingdom,2018,Tourism expenditure (millions of US dollars),,,48515.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,1995,Tourist/visitor arrivals (thousands),TF,,285.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2005,Tourist/visitor arrivals (thousands),TF,,590.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2010,Tourist/visitor arrivals (thousands),TF,,754.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2016,Tourist/visitor arrivals (thousands),TF,,1233.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2017,Tourist/visitor arrivals (thousands),TF,,1275.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2018,Tourist/visitor arrivals (thousands),TF,,1378.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2005,Tourism expenditure (millions of US dollars),,,835.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2010,Tourism expenditure (millions of US dollars),,,1279.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2016,Tourism expenditure (millions of US dollars),,,2149.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2017,Tourism expenditure (millions of US dollars),,,2265.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+834,United Rep. of Tanzania,2018,Tourism expenditure (millions of US dollars),,,2465.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,1995,Tourist/visitor arrivals (thousands),TF,,43318.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2005,Tourist/visitor arrivals (thousands),TF,,49206.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2010,Tourist/visitor arrivals (thousands),TF,,60010.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2016,Tourist/visitor arrivals (thousands),TF,,76407.4880,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2017,Tourist/visitor arrivals (thousands),TF,,77186.7460,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2018,Tourist/visitor arrivals (thousands),TF,,79745.9180,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,1995,Tourism expenditure (millions of US dollars),,,93743.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2005,Tourism expenditure (millions of US dollars),,,122077.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2010,Tourism expenditure (millions of US dollars),,,167996.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2016,Tourism expenditure (millions of US dollars),,,245991.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2017,Tourism expenditure (millions of US dollars),,,251544.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+840,United States of America,2018,Tourism expenditure (millions of US dollars),,,256145.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,1995,Tourist/visitor arrivals (thousands),TF,,454.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2005,Tourist/visitor arrivals (thousands),TF,,594.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2010,Tourist/visitor arrivals (thousands),TF,,572.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2016,Tourist/visitor arrivals (thousands),TF,,667.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2017,Tourist/visitor arrivals (thousands),TF,,535.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2018,Tourist/visitor arrivals (thousands),TF,,381.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,1995,Tourism expenditure (millions of US dollars),,,822.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2005,Tourism expenditure (millions of US dollars),,,1432.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2010,Tourism expenditure (millions of US dollars),,,1223.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2016,Tourism expenditure (millions of US dollars),,,1343.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2017,Tourism expenditure (millions of US dollars),,,1202.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+850,United States Virgin Islands,2018,Tourism expenditure (millions of US dollars),,,1046.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,1995,Tourist/visitor arrivals (thousands),TF,,2022.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2005,Tourist/visitor arrivals (thousands),TF,,1808.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2010,Tourist/visitor arrivals (thousands),TF,,2353.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2016,Tourist/visitor arrivals (thousands),TF,,3037.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2017,Tourist/visitor arrivals (thousands),TF,,3674.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2018,Tourist/visitor arrivals (thousands),TF,,3469.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,1995,Tourism expenditure (millions of US dollars),,,725.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2005,Tourism expenditure (millions of US dollars),,,699.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2010,Tourism expenditure (millions of US dollars),,,1669.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2016,Tourism expenditure (millions of US dollars),,,2182.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2017,Tourism expenditure (millions of US dollars),,,2660.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+858,Uruguay,2018,Tourism expenditure (millions of US dollars),,,2439.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,1995,Tourist/visitor arrivals (thousands),TF,,92.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2005,Tourist/visitor arrivals (thousands),TF,,242.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2010,Tourist/visitor arrivals (thousands),TF,,975.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2016,Tourist/visitor arrivals (thousands),TF,,2027.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2017,Tourist/visitor arrivals (thousands),TF,,2690.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2018,Tourist/visitor arrivals (thousands),TF,,5346.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2005,Tourism expenditure (millions of US dollars),,,28.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2010,Tourism expenditure (millions of US dollars),,,121.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2016,Tourism expenditure (millions of US dollars),,,458.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2017,Tourism expenditure (millions of US dollars),,,689.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+860,Uzbekistan,2018,Tourism expenditure (millions of US dollars),,,1144.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,1995,Tourist/visitor arrivals (thousands),TF,,44.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2005,Tourist/visitor arrivals (thousands),TF,,62.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2010,Tourist/visitor arrivals (thousands),TF,,97.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2016,Tourist/visitor arrivals (thousands),TF,,95.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2017,Tourist/visitor arrivals (thousands),TF,,109.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2018,Tourist/visitor arrivals (thousands),TF,,116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2005,Tourism expenditure (millions of US dollars),,,104.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2010,Tourism expenditure (millions of US dollars),,,242.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2016,Tourism expenditure (millions of US dollars),,,275.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2017,Tourism expenditure (millions of US dollars),,,289.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+548,Vanuatu,2018,Tourism expenditure (millions of US dollars),,,325.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),1995,Tourist/visitor arrivals (thousands),TF,,700.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),2005,Tourist/visitor arrivals (thousands),TF,,706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),2010,Tourist/visitor arrivals (thousands),TF,,526.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),2016,Tourist/visitor arrivals (thousands),TF,,601.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),2017,Tourist/visitor arrivals (thousands),TF,,427.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),1995,Tourism expenditure (millions of US dollars),,,995.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),2005,Tourism expenditure (millions of US dollars),,,722.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),2010,Tourism expenditure (millions of US dollars),,,885.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+862,Venezuela (Boliv. Rep. of),2016,Tourism expenditure (millions of US dollars),,,546.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,1995,Tourist/visitor arrivals (thousands),VF,,1351.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2005,Tourist/visitor arrivals (thousands),VF,,3477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2010,Tourist/visitor arrivals (thousands),VF,,5050.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2016,Tourist/visitor arrivals (thousands),VF,,10013.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2017,Tourist/visitor arrivals (thousands),VF,,12922.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2018,Tourist/visitor arrivals (thousands),VF,,15498.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2005,Tourism expenditure (millions of US dollars),,,2300.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2010,Tourism expenditure (millions of US dollars),,,4450.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2016,Tourism expenditure (millions of US dollars),,,8500.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2017,Tourism expenditure (millions of US dollars),,,8890.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+704,Viet Nam,2018,Tourism expenditure (millions of US dollars),,,10080.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+887,Yemen,1995,Tourist/visitor arrivals (thousands),TF,,61.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+887,Yemen,2005,Tourist/visitor arrivals (thousands),TF,,336.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+887,Yemen,2010,Tourist/visitor arrivals (thousands),TF,,1025.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+887,Yemen,2010,Tourism expenditure (millions of US dollars),,,1291.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+887,Yemen,2016,Tourism expenditure (millions of US dollars),,,116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,1995,Tourist/visitor arrivals (thousands),TF,,163.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2005,Tourist/visitor arrivals (thousands),TF,,669.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2010,Tourist/visitor arrivals (thousands),TF,,815.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2016,Tourist/visitor arrivals (thousands),TF,,956.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2017,Tourist/visitor arrivals (thousands),TF,,1083.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2018,Tourist/visitor arrivals (thousands),TF,,1072.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2005,Tourism expenditure (millions of US dollars),,,447.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2010,Tourism expenditure (millions of US dollars),,,492.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2016,Tourism expenditure (millions of US dollars),,,683.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2017,Tourism expenditure (millions of US dollars),,,653.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+894,Zambia,2018,Tourism expenditure (millions of US dollars),,,742.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,1995,Tourist/visitor arrivals (thousands),VF,,1416.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2005,Tourist/visitor arrivals (thousands),VF,,1559.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2010,Tourist/visitor arrivals (thousands),VF,,2239.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2016,Tourist/visitor arrivals (thousands),VF,,2168.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2017,Tourist/visitor arrivals (thousands),VF,,2423.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2018,Tourist/visitor arrivals (thousands),VF,,2580.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,1995,Tourism expenditure (millions of US dollars),,,145.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2005,Tourism expenditure (millions of US dollars),,,99.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2010,Tourism expenditure (millions of US dollars),,,135.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2016,Tourism expenditure (millions of US dollars),,,194.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
+716,Zimbabwe,2017,Tourism expenditure (millions of US dollars),,,158.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020."
diff --git a/apache-spark/src/main/java/com/baeldung/differences/dataframe/dataset/rdd/TouristData.java b/apache-spark/src/main/java/com/baeldung/differences/dataframe/dataset/rdd/TouristData.java
new file mode 100644
index 0000000000..fbeef4283a
--- /dev/null
+++ b/apache-spark/src/main/java/com/baeldung/differences/dataframe/dataset/rdd/TouristData.java
@@ -0,0 +1,75 @@
+package com.baeldung.differences.dataframe.dataset.rdd;
+
+
+public class TouristData {
+
+ private String region;
+ private String country;
+ private String year;
+ private String series;
+ private Double value;
+ private String footnotes;
+ private String source;
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+ public void setYear(String year) {
+ this.year = year;
+ }
+
+ public String getSeries() {
+ return series;
+ }
+
+ public void setSeries(String series) {
+ this.series = series;
+ }
+
+ public Double getValue() {
+ return value;
+ }
+
+ public void setValue(Double value) {
+ this.value = value;
+ }
+
+ public String getFootnotes() {
+ return footnotes;
+ }
+
+ public void setFootnotes(String footnotes) {
+ this.footnotes = footnotes;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ @Override
+ public String toString() {
+ return "TouristData [region=" + region + ", country=" + country + ", year=" + year + ", series=" + series + ", value=" + value + ", footnotes=" + footnotes + ", source=" + source + "]";
+ }
+
+}
diff --git a/apache-spark/src/test/java/com/baeldung/differences/rdd/ActionsUnitTest.java b/apache-spark/src/test/java/com/baeldung/differences/rdd/ActionsUnitTest.java
new file mode 100644
index 0000000000..a3e1811e6f
--- /dev/null
+++ b/apache-spark/src/test/java/com/baeldung/differences/rdd/ActionsUnitTest.java
@@ -0,0 +1,67 @@
+package com.baeldung.differences.rdd;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.apache.spark.SparkConf;
+import org.apache.spark.api.java.JavaPairRDD;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import scala.Tuple2;
+
+public class ActionsUnitTest {
+ private static JavaRDD tourists;
+ private static JavaSparkContext sc;
+ public static final String COMMA_DELIMITER = ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)";
+
+ @BeforeClass
+ public static void init() {
+ SparkConf conf = new SparkConf().setAppName("reduce")
+ .setMaster("local[*]");
+ sc = new JavaSparkContext(conf);
+ tourists = sc.textFile("data/Tourist.csv").filter(line -> !line.startsWith("Region"));
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ sc.close();
+ }
+
+ @Test
+ public void whenDistinctCount_thenReturnDistinctNumRecords() {
+ JavaRDD countries = tourists.map(line -> {
+ String[] columns = line.split(COMMA_DELIMITER);
+ return columns[1];
+ })
+ .distinct();
+ Long numberOfCountries = countries.count();
+ System.out.println("Count: " + numberOfCountries);
+
+ assertEquals(Long.valueOf(220), numberOfCountries);
+ }
+
+ @Test
+ public void whenReduceByKeySum_thenTotalValuePerKey() {
+ JavaRDD touristsExpenditure = tourists.filter(line -> line.split(COMMA_DELIMITER)[3].contains("expenditure"));
+
+ JavaPairRDD expenditurePairRdd = touristsExpenditure.mapToPair(line -> {
+ String[] columns = line.split(COMMA_DELIMITER);
+ return new Tuple2<>(columns[1], Double.valueOf(columns[6]));
+ });
+ List> totalByCountry = expenditurePairRdd.reduceByKey((x, y) -> x + y)
+ .collect();
+ System.out.println("Total per Country: " + totalByCountry);
+
+ for(Tuple2 tuple : totalByCountry) {
+ if (tuple._1.equals("Mexico")) {
+ assertEquals(Double.valueOf(99164), tuple._2);
+ }
+ }
+ }
+
+}
diff --git a/apache-spark/src/test/java/com/baeldung/differences/rdd/DataFrameUnitTest.java b/apache-spark/src/test/java/com/baeldung/differences/rdd/DataFrameUnitTest.java
new file mode 100644
index 0000000000..f294e5bc66
--- /dev/null
+++ b/apache-spark/src/test/java/com/baeldung/differences/rdd/DataFrameUnitTest.java
@@ -0,0 +1,74 @@
+package com.baeldung.differences.rdd;
+
+import static org.apache.spark.sql.functions.col;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.spark.sql.DataFrameReader;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.SparkSession;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class DataFrameUnitTest {
+ private static SparkSession session;
+ private static Dataset data;
+
+ @BeforeClass
+ public static void init() {
+ session = SparkSession.builder()
+ .appName("TouristDataFrameExample")
+ .master("local[*]")
+ .getOrCreate();
+ DataFrameReader dataFrameReader = session.read();
+ data = dataFrameReader.option("header", "true")
+ .csv("data/Tourist.csv");
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ session.stop();
+ }
+
+ @Test
+ public void whenSelectSpecificColumns_thenColumnsFiltered() {
+ Dataset selectedData = data.select(col("country"), col("year"), col("value"));
+ selectedData.show();
+
+ List resultList = Arrays.asList(selectedData.columns());
+ assertTrue(resultList.contains("country"));
+ assertTrue(resultList.contains("year"));
+ assertTrue(resultList.contains("value"));
+ assertFalse(resultList.contains("Series"));
+
+ }
+
+ @Test
+ public void whenFilteringByCountry_thenCountryRecordsSelected() {
+ Dataset filteredData = data.filter(col("country").equalTo("Mexico"));
+ filteredData.show();
+
+ filteredData.foreach(record -> {
+ assertEquals("Mexico", record.get(1));
+ });
+
+ }
+
+ @Test
+ public void whenGroupCountByCountry_thenContryTotalRecords() {
+ Dataset recordsPerCountry = data.groupBy(col("country"))
+ .count();
+ recordsPerCountry.show();
+
+ Dataset filteredData = recordsPerCountry.filter(col("country").equalTo("Sweden"));
+ assertEquals(new Long(12), filteredData.first()
+ .get(1));
+ }
+
+}
diff --git a/apache-spark/src/test/java/com/baeldung/differences/rdd/DatasetUnitTest.java b/apache-spark/src/test/java/com/baeldung/differences/rdd/DatasetUnitTest.java
new file mode 100644
index 0000000000..1d83505812
--- /dev/null
+++ b/apache-spark/src/test/java/com/baeldung/differences/rdd/DatasetUnitTest.java
@@ -0,0 +1,83 @@
+package com.baeldung.differences.rdd;
+
+import static org.apache.spark.sql.functions.col;
+import static org.apache.spark.sql.functions.sum;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.spark.api.java.function.FilterFunction;
+import org.apache.spark.sql.DataFrameReader;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Encoders;
+import org.apache.spark.sql.Row;
+import org.apache.spark.sql.SparkSession;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.baeldung.differences.dataframe.dataset.rdd.TouristData;
+
+public class DatasetUnitTest {
+ private static SparkSession session;
+ private static Dataset typedDataset;
+
+ @BeforeClass
+ public static void init() {
+ session = SparkSession.builder()
+ .appName("TouristDatasetExample")
+ .master("local[*]")
+ .getOrCreate();
+ DataFrameReader dataFrameReader = session.read();
+ Dataset data = dataFrameReader.option("header", "true")
+ .csv("data/Tourist.csv");
+ Dataset responseWithSelectedColumns = data.select(col("region"),
+ col("country"), col("year"), col("series"), col("value").cast("double"),
+ col("footnotes"), col("source"));
+ typedDataset = responseWithSelectedColumns.as(Encoders.bean(TouristData.class));
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ session.stop();
+ }
+
+ @Test
+ public void whenFilteringByCountry_thenCountryRecordsSelected() {
+ Dataset selectedData = typedDataset
+ .filter((FilterFunction) record -> record.getCountry()
+ .equals("Norway"));
+ selectedData.show();
+
+ selectedData.foreach(record -> {
+ assertEquals("Norway", record.getCountry());
+ });
+ }
+
+ @Test
+ public void whenGroupCountByCountry_thenContryTotalRecords() {
+ Dataset countriesCount = typedDataset.groupBy(typedDataset.col("country"))
+ .count();
+ countriesCount.show();
+
+ assertEquals(Long.valueOf(220), Long.valueOf(countriesCount.count()));
+ }
+
+ @Test
+ public void whenFilteredByPropertyRange_thenRetreiveValidRecords() {
+ // Filter records with existing data for years between 2010 and 2017
+ typedDataset.filter((FilterFunction) record -> record.getYear() != null
+ && (Long.valueOf(record.getYear()) > 2010 && Long.valueOf(record.getYear()) < 2017))
+ .show();
+ }
+
+ @Test
+ public void whenSumValue_thenRetreiveTotalValue() {
+ // Total tourist expenditure by country
+ typedDataset.filter((FilterFunction) record -> record.getValue() != null
+ && record.getSeries()
+ .contains("expenditure"))
+ .groupBy("country")
+ .agg(sum("value"))
+ .show();
+ }
+
+}
diff --git a/apache-spark/src/test/java/com/baeldung/differences/rdd/TransformationsUnitTest.java b/apache-spark/src/test/java/com/baeldung/differences/rdd/TransformationsUnitTest.java
new file mode 100644
index 0000000000..4b2d9e1127
--- /dev/null
+++ b/apache-spark/src/test/java/com/baeldung/differences/rdd/TransformationsUnitTest.java
@@ -0,0 +1,63 @@
+package com.baeldung.differences.rdd;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.spark.SparkConf;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TransformationsUnitTest {
+
+ public static final String COMMA_DELIMITER = ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)";
+ private static JavaSparkContext sc;
+ private static JavaRDD tourists;
+
+ @BeforeClass
+ public static void init() {
+ SparkConf conf = new SparkConf().setAppName("uppercaseCountries")
+ .setMaster("local[*]");
+ sc = new JavaSparkContext(conf);
+ tourists = sc.textFile("data/Tourist.csv")
+ .filter(line -> !line.startsWith("Region")); //filter header row
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ sc.close();
+ }
+
+ @Test
+ public void whenMapUpperCase_thenCountryNameUppercased() {
+ JavaRDD upperCaseCountries = tourists.map(line -> {
+ String[] columns = line.split(COMMA_DELIMITER);
+ return columns[1].toUpperCase();
+ })
+ .distinct();
+
+ upperCaseCountries.saveAsTextFile("data/output/uppercase.txt");
+
+ upperCaseCountries.foreach(country -> {
+ //replace non alphanumerical characters
+ country = country.replaceAll("[^a-zA-Z]", "");
+ assertTrue(StringUtils.isAllUpperCase(country));
+ });
+ }
+
+ @Test
+ public void whenFilterByCountry_thenShowRequestedCountryRecords() {
+ JavaRDD touristsInMexico = tourists.filter(line -> line.split(COMMA_DELIMITER)[1].equals("Mexico"));
+
+ touristsInMexico.saveAsTextFile("data/output/touristInMexico.txt");
+
+ touristsInMexico.foreach(record -> {
+ assertEquals("Mexico", record.split(COMMA_DELIMITER)[1]);
+ });
+ }
+
+}
diff --git a/core-java-modules/core-java-10/README.md b/core-java-modules/core-java-10/README.md
index 23f598b902..38b1db1c05 100644
--- a/core-java-modules/core-java-10/README.md
+++ b/core-java-modules/core-java-10/README.md
@@ -10,3 +10,4 @@ This module contains articles about Java 10 core features
- [Deep Dive Into the New Java JIT Compiler – Graal](https://www.baeldung.com/graal-java-jit-compiler)
- [Copying Sets in Java](https://www.baeldung.com/java-copy-sets)
- [Converting between a List and a Set in Java](https://www.baeldung.com/convert-list-to-set-and-set-to-list)
+- [Java IndexOutOfBoundsException “Source Does Not Fit in Dest”](https://www.baeldung.com/java-indexoutofboundsexception)
diff --git a/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/character/IsLetterOrAlphabetUnitTest.java b/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/character/IsLetterOrAlphabetUnitTest.java
new file mode 100644
index 0000000000..44c712a17f
--- /dev/null
+++ b/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/character/IsLetterOrAlphabetUnitTest.java
@@ -0,0 +1,30 @@
+package com.baeldung.java14.character;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+public class IsLetterOrAlphabetUnitTest {
+
+ @Test
+ public void givenACharacter_whenLetter_thenAssertIsLetterTrue() {
+ assertTrue(Character.isLetter(65));
+ }
+
+ @Test
+ public void givenACharacter_whenLetter_thenAssertIsAlphabeticTrue() {
+ assertTrue(Character.isAlphabetic(65));
+ }
+
+ @Test
+ public void givenACharacter_whenAlphabeticAndNotLetter_thenAssertIsLetterFalse() {
+ assertFalse(Character.isLetter(837));
+ }
+
+ @Test
+ public void givenACharacter_whenAlphabeticAndNotLetter_thenAssertIsAlphabeticTrue() {
+ assertTrue(Character.isAlphabetic(837));
+ }
+
+}
\ No newline at end of file
diff --git a/core-java-modules/core-java-15/.mvn/jvm.config b/core-java-modules/core-java-15/.mvn/jvm.config
new file mode 100644
index 0000000000..50f549be0a
--- /dev/null
+++ b/core-java-modules/core-java-15/.mvn/jvm.config
@@ -0,0 +1 @@
+--enable-preview
\ No newline at end of file
diff --git a/core-java-modules/core-java-15/README.md b/core-java-modules/core-java-15/README.md
new file mode 100644
index 0000000000..53989f5cbb
--- /dev/null
+++ b/core-java-modules/core-java-15/README.md
@@ -0,0 +1,7 @@
+## Core Java 15
+
+This module contains articles about Java 15.
+
+### Relevant articles
+
+- TODO: add article links here
diff --git a/core-java-modules/core-java-15/pom.xml b/core-java-modules/core-java-15/pom.xml
new file mode 100644
index 0000000000..c6f1454078
--- /dev/null
+++ b/core-java-modules/core-java-15/pom.xml
@@ -0,0 +1,77 @@
+
+
+ 4.0.0
+ core-java-15
+ core-java-15
+ jar
+ http://maven.apache.org
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+ ../../pom.xml
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${apache-commons-lang3.version}
+
+
+ org.assertj
+ assertj-core
+ ${assertj.version}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit-jupiter.version}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit-jupiter.version}
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ ${maven.compiler.release}
+ --enable-preview
+ 15
+ 15
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${surefire.plugin.version}
+
+ --enable-preview
+
+
+
+
+
+
+ 15
+ 3.11
+ 3.17.2
+ 3.8.1
+ 3.0.0-M3
+
+
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/alternative/Vehicles.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/alternative/Vehicles.java
new file mode 100644
index 0000000000..091c5841bf
--- /dev/null
+++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/alternative/Vehicles.java
@@ -0,0 +1,49 @@
+package com.baeldung.sealed.alternative;
+
+public class Vehicles {
+
+ abstract static class Vehicle {
+
+ private final String registrationNumber;
+
+ public Vehicle(String registrationNumber) {
+ this.registrationNumber = registrationNumber;
+ }
+
+ public String getRegistrationNumber() {
+ return registrationNumber;
+ }
+
+ }
+
+ public static final class Car extends Vehicle {
+
+ private final int numberOfSeats;
+
+ public Car(int numberOfSeats, String registrationNumber) {
+ super(registrationNumber);
+ this.numberOfSeats = numberOfSeats;
+ }
+
+ public int getNumberOfSeats() {
+ return numberOfSeats;
+ }
+
+ }
+
+ public static final class Truck extends Vehicle {
+
+ private final int loadCapacity;
+
+ public Truck(int loadCapacity, String registrationNumber) {
+ super(registrationNumber);
+ this.loadCapacity = loadCapacity;
+ }
+
+ public int getLoadCapacity() {
+ return loadCapacity;
+ }
+
+ }
+
+}
diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Car.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Car.java
new file mode 100644
index 0000000000..7dce266da7
--- /dev/null
+++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Car.java
@@ -0,0 +1,21 @@
+package com.baeldung.sealed.classes;
+
+public non-sealed class Car extends Vehicle implements Service {
+
+ private final int numberOfSeats;
+
+ public Car(int numberOfSeats, String registrationNumber) {
+ super(registrationNumber);
+ this.numberOfSeats = numberOfSeats;
+ }
+
+ public int getNumberOfSeats() {
+ return numberOfSeats;
+ }
+
+ @Override
+ public int getMaxServiceIntervalInMonths() {
+ return 12;
+ }
+
+}
diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Service.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Service.java
new file mode 100644
index 0000000000..9486b302f1
--- /dev/null
+++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Service.java
@@ -0,0 +1,11 @@
+package com.baeldung.sealed.classes;
+
+public sealed interface Service permits Car, Truck {
+
+ int getMaxServiceIntervalInMonths();
+
+ default int getMaxDistanceBetweenServicesInKilometers() {
+ return 100000;
+ }
+
+}
diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Truck.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Truck.java
new file mode 100644
index 0000000000..8d5234342b
--- /dev/null
+++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Truck.java
@@ -0,0 +1,21 @@
+package com.baeldung.sealed.classes;
+
+public final class Truck extends Vehicle implements Service {
+
+ private final int loadCapacity;
+
+ public Truck(int loadCapacity, String registrationNumber) {
+ super(registrationNumber);
+ this.loadCapacity = loadCapacity;
+ }
+
+ public int getLoadCapacity() {
+ return loadCapacity;
+ }
+
+ @Override
+ public int getMaxServiceIntervalInMonths() {
+ return 18;
+ }
+
+}
diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Vehicle.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Vehicle.java
new file mode 100644
index 0000000000..79eda0c790
--- /dev/null
+++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/classes/Vehicle.java
@@ -0,0 +1,15 @@
+package com.baeldung.sealed.classes;
+
+public abstract sealed class Vehicle permits Car, Truck {
+
+ protected final String registrationNumber;
+
+ public Vehicle(String registrationNumber) {
+ this.registrationNumber = registrationNumber;
+ }
+
+ public String getRegistrationNumber() {
+ return registrationNumber;
+ }
+
+}
diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Car.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Car.java
new file mode 100644
index 0000000000..74b6ed1405
--- /dev/null
+++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Car.java
@@ -0,0 +1,14 @@
+package com.baeldung.sealed.records;
+
+public record Car(int numberOfSeats, String registrationNumber) implements Vehicle {
+
+ @Override
+ public String getRegistrationNumber() {
+ return registrationNumber;
+ }
+
+ public int getNumberOfSeats() {
+ return numberOfSeats;
+ }
+
+}
diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Truck.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Truck.java
new file mode 100644
index 0000000000..1b887ae014
--- /dev/null
+++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Truck.java
@@ -0,0 +1,14 @@
+package com.baeldung.sealed.records;
+
+public record Truck(int loadCapacity, String registrationNumber) implements Vehicle {
+
+ @Override
+ public String getRegistrationNumber() {
+ return registrationNumber;
+ }
+
+ public int getLoadCapacity() {
+ return loadCapacity;
+ }
+
+}
diff --git a/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Vehicle.java b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Vehicle.java
new file mode 100644
index 0000000000..c51f8e97c6
--- /dev/null
+++ b/core-java-modules/core-java-15/src/main/java/com/baeldung/sealed/records/Vehicle.java
@@ -0,0 +1,7 @@
+package com.baeldung.sealed.records;
+
+public sealed interface Vehicle permits Car, Truck {
+
+ String getRegistrationNumber();
+
+}
diff --git a/core-java-modules/core-java-15/src/test/java/com/baeldung/sealed/classes/VehicleUnitTest.java b/core-java-modules/core-java-15/src/test/java/com/baeldung/sealed/classes/VehicleUnitTest.java
new file mode 100644
index 0000000000..b614981a43
--- /dev/null
+++ b/core-java-modules/core-java-15/src/test/java/com/baeldung/sealed/classes/VehicleUnitTest.java
@@ -0,0 +1,76 @@
+package com.baeldung.sealed.classes;
+
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.lang.constant.ClassDesc;
+
+public class VehicleUnitTest {
+
+ private static Vehicle car;
+ private static Vehicle truck;
+
+ @BeforeAll
+ public static void createInstances() {
+ car = new Car(5, "VZ500DA");
+ truck = new Truck(19000, "VZ600TA");
+ }
+
+ @Test
+ public void givenCar_whenUsingReflectionAPI_thenSuperClassIsSealed() {
+ Assertions.assertThat(car.getClass().isSealed()).isEqualTo(false);
+ Assertions.assertThat(car.getClass().getSuperclass().isSealed()).isEqualTo(true);
+ Assertions.assertThat(car.getClass().getSuperclass().permittedSubclasses())
+ .contains(ClassDesc.of(car.getClass().getCanonicalName()));
+ }
+
+ @Test
+ public void givenTruck_whenUsingReflectionAPI_thenSuperClassIsSealed() {
+ Assertions.assertThat(truck.getClass().isSealed()).isEqualTo(false);
+ Assertions.assertThat(truck.getClass().getSuperclass().isSealed()).isEqualTo(true);
+ Assertions.assertThat(truck.getClass().getSuperclass().permittedSubclasses())
+ .contains(ClassDesc.of(truck.getClass().getCanonicalName()));
+ }
+
+ @Test
+ public void givenCar_whenGettingPropertyTraditionalWay_thenNumberOfSeatsPropertyIsReturned() {
+ Assertions.assertThat(getPropertyTraditionalWay(car)).isEqualTo(5);
+ }
+
+ @Test
+ public void givenCar_whenGettingPropertyViaPatternMatching_thenNumberOfSeatsPropertyIsReturned() {
+ Assertions.assertThat(getPropertyViaPatternMatching(car)).isEqualTo(5);
+ }
+
+ @Test
+ public void givenTruck_whenGettingPropertyTraditionalWay_thenLoadCapacityIsReturned() {
+ Assertions.assertThat(getPropertyTraditionalWay(truck)).isEqualTo(19000);
+ }
+
+ @Test
+ public void givenTruck_whenGettingPropertyViaPatternMatching_thenLoadCapacityIsReturned() {
+ Assertions.assertThat(getPropertyViaPatternMatching(truck)).isEqualTo(19000);
+ }
+
+ private int getPropertyTraditionalWay(Vehicle vehicle) {
+ if (vehicle instanceof Car) {
+ return ((Car) vehicle).getNumberOfSeats();
+ } else if (vehicle instanceof Truck) {
+ return ((Truck) vehicle).getLoadCapacity();
+ } else {
+ throw new RuntimeException("Unknown instance of Vehicle");
+ }
+ }
+
+ private int getPropertyViaPatternMatching(Vehicle vehicle) {
+ if (vehicle instanceof Car car) {
+ return car.getNumberOfSeats();
+ } else if (vehicle instanceof Truck truck) {
+ return truck.getLoadCapacity();
+ } else {
+ throw new RuntimeException("Unknown instance of Vehicle");
+ }
+ }
+
+}
diff --git a/core-java-modules/core-java-15/src/test/java/com/baeldung/sealed/records/VehicleUnitTest.java b/core-java-modules/core-java-15/src/test/java/com/baeldung/sealed/records/VehicleUnitTest.java
new file mode 100644
index 0000000000..ac8a8c953c
--- /dev/null
+++ b/core-java-modules/core-java-15/src/test/java/com/baeldung/sealed/records/VehicleUnitTest.java
@@ -0,0 +1,76 @@
+package com.baeldung.sealed.records;
+
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.lang.constant.ClassDesc;
+
+public class VehicleUnitTest {
+
+ private static Vehicle car;
+ private static Vehicle truck;
+
+ @BeforeAll
+ public static void createInstances() {
+ car = new Car(4, "VZ500DA");
+ truck = new Truck(16000, "VZ600TA");
+ }
+
+ @Test
+ public void givenCar_whenUsingReflectionAPI_thenInterfaceIsSealed() {
+ Assertions.assertThat(car.getClass().isSealed()).isEqualTo(false);
+ Assertions.assertThat(car.getClass().getInterfaces()[0].isSealed()).isEqualTo(true);
+ Assertions.assertThat(car.getClass().getInterfaces()[0].permittedSubclasses())
+ .contains(ClassDesc.of(car.getClass().getCanonicalName()));
+ }
+
+ @Test
+ public void givenTruck_whenUsingReflectionAPI_thenInterfaceIsSealed() {
+ Assertions.assertThat(truck.getClass().isSealed()).isEqualTo(false);
+ Assertions.assertThat(truck.getClass().getInterfaces()[0].isSealed()).isEqualTo(true);
+ Assertions.assertThat(truck.getClass().getInterfaces()[0].permittedSubclasses())
+ .contains(ClassDesc.of(truck.getClass().getCanonicalName()));
+ }
+
+ @Test
+ public void givenCar_whenGettingPropertyTraditionalWay_thenNumberOfSeatsPropertyIsReturned() {
+ Assertions.assertThat(getPropertyTraditionalWay(car)).isEqualTo(4);
+ }
+
+ @Test
+ public void givenCar_whenGettingPropertyViaPatternMatching_thenNumberOfSeatsPropertyIsReturned() {
+ Assertions.assertThat(getPropertyViaPatternMatching(car)).isEqualTo(4);
+ }
+
+ @Test
+ public void givenTruck_whenGettingPropertyTraditionalWay_thenLoadCapacityIsReturned() {
+ Assertions.assertThat(getPropertyTraditionalWay(truck)).isEqualTo(16000);
+ }
+
+ @Test
+ public void givenTruck_whenGettingPropertyViaPatternMatching_thenLoadCapacityIsReturned() {
+ Assertions.assertThat(getPropertyViaPatternMatching(truck)).isEqualTo(16000);
+ }
+
+ private int getPropertyTraditionalWay(Vehicle vehicle) {
+ if (vehicle instanceof Car) {
+ return ((Car) vehicle).getNumberOfSeats();
+ } else if (vehicle instanceof Truck) {
+ return ((Truck) vehicle).getLoadCapacity();
+ } else {
+ throw new RuntimeException("Unknown instance of Vehicle");
+ }
+ }
+
+ private int getPropertyViaPatternMatching(Vehicle vehicle) {
+ if (vehicle instanceof Car car) {
+ return car.getNumberOfSeats();
+ } else if (vehicle instanceof Truck truck) {
+ return truck.getLoadCapacity();
+ } else {
+ throw new RuntimeException("Unknown instance of Vehicle");
+ }
+ }
+
+}
diff --git a/core-java-modules/core-java-9-jigsaw/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java b/core-java-modules/core-java-9-jigsaw/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java
index 2519da085b..617a0a7e70 100644
--- a/core-java-modules/core-java-9-jigsaw/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java
+++ b/core-java-modules/core-java-9-jigsaw/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java
@@ -19,12 +19,12 @@ public class StudentDbService implements StudentService {
}
public Student update(Student student) {
- logger.log(Level.INFO, "Updating sutdent in DB...");
+ logger.log(Level.INFO, "Updating student in DB...");
return student;
}
public String delete(String registrationId) {
- logger.log(Level.INFO, "Deleteing sutdent in DB...");
+ logger.log(Level.INFO, "Deleting student in DB...");
return registrationId;
}
}
\ No newline at end of file
diff --git a/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/genericarrays/MyStack.java b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/genericarrays/MyStack.java
new file mode 100644
index 0000000000..02659f13bc
--- /dev/null
+++ b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/genericarrays/MyStack.java
@@ -0,0 +1,30 @@
+package com.baeldung.genericarrays;
+
+import java.lang.reflect.Array;
+
+public class MyStack {
+ private E[] elements;
+ private int size = 0;
+
+ public MyStack(Class clazz, int capacity) {
+ elements = (E[]) Array.newInstance(clazz, capacity);
+ }
+
+ public void push(E item) {
+ if (size == elements.length) {
+ throw new RuntimeException();
+ }
+ elements[size++] = item;
+ }
+
+ public E pop() {
+ if (size == 0) {
+ throw new RuntimeException();
+ }
+ return elements[--size];
+ }
+
+ public E[] getAllElements() {
+ return elements;
+ }
+}
diff --git a/core-java-modules/core-java-arrays-guides/src/test/java/com/baeldung/genericarrays/ListToArrayUnitTest.java b/core-java-modules/core-java-arrays-guides/src/test/java/com/baeldung/genericarrays/ListToArrayUnitTest.java
new file mode 100644
index 0000000000..5fd0385181
--- /dev/null
+++ b/core-java-modules/core-java-arrays-guides/src/test/java/com/baeldung/genericarrays/ListToArrayUnitTest.java
@@ -0,0 +1,24 @@
+package com.baeldung.genericarrays;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class ListToArrayUnitTest {
+
+ @Test
+ public void givenListOfItems_whenToArray_thenReturnArrayOfItems() {
+ List items = new LinkedList<>();
+ items.add("first item");
+ items.add("second item");
+
+ String[] itemsAsArray = items.toArray(new String[0]);
+
+ assertEquals("first item", itemsAsArray[0]);
+ assertEquals("second item", itemsAsArray[1]);
+ }
+}
diff --git a/core-java-modules/core-java-arrays-guides/src/test/java/com/baeldung/genericarrays/MyStackUnitTest.java b/core-java-modules/core-java-arrays-guides/src/test/java/com/baeldung/genericarrays/MyStackUnitTest.java
new file mode 100644
index 0000000000..e36c5169a5
--- /dev/null
+++ b/core-java-modules/core-java-arrays-guides/src/test/java/com/baeldung/genericarrays/MyStackUnitTest.java
@@ -0,0 +1,44 @@
+package com.baeldung.genericarrays;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class MyStackUnitTest {
+
+ @Test
+ public void givenStackWithTwoItems_whenPop_thenReturnLastAdded() {
+ MyStack myStack = new MyStack<>(String.class, 2);
+ myStack.push("hello");
+ myStack.push("example");
+
+ assertEquals("example", myStack.pop());
+ }
+
+ @Test (expected = RuntimeException.class)
+ public void givenStackWithFixedCapacity_whenExceedCapacity_thenThrowException() {
+ MyStack myStack = new MyStack<>(Integer.class, 2);
+ myStack.push(100);
+ myStack.push(200);
+ myStack.push(300);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void givenStack_whenPopOnEmptyStack_thenThrowException() {
+ MyStack myStack = new MyStack<>(Integer.class, 1);
+ myStack.push(100);
+ myStack.pop();
+ myStack.pop();
+ }
+
+ @Test
+ public void givenStackWithItems_whenGetAllElements_thenSizeShouldEqualTotal() {
+ MyStack myStack = new MyStack<>(String.class, 2);
+ myStack.push("hello");
+ myStack.push("example");
+
+ String[] items = myStack.getAllElements();
+
+ assertEquals(2, items.length);
+ }
+}
diff --git a/core-java-modules/core-java-collections-3/README.md b/core-java-modules/core-java-collections-3/README.md
index c80e493767..6bc9139856 100644
--- a/core-java-modules/core-java-collections-3/README.md
+++ b/core-java-modules/core-java-collections-3/README.md
@@ -13,3 +13,5 @@
- [Quick Guide to the Java Stack](https://www.baeldung.com/java-stack)
- [Convert an Array of Primitives to a List](https://www.baeldung.com/java-primitive-array-to-list)
- [A Guide to BitSet in Java](https://www.baeldung.com/java-bitset)
+- [Get the First Key and Value From a HashMap](https://www.baeldung.com/java-hashmap-get-first-entry)
+- [Performance of removeAll() in a HashSet](https://www.baeldung.com/java-hashset-removeall-performance)
diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java
index 8ce58c865e..8f784de26d 100644
--- a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java
+++ b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java
@@ -33,11 +33,15 @@ public class HashSetBenchmark {
private List employeeList1 = new ArrayList<>();
private Set employeeSet2 = new HashSet<>();
private List employeeList2 = new ArrayList<>();
+ private Set employeeSet3 = new HashSet<>();
+ private Set employeeSet4 = new HashSet<>();
private long set1Size = 60000;
private long list1Size = 50000;
private long set2Size = 50000;
private long list2Size = 60000;
+ private long set3Size = 50000;
+ private long set4Size = 60000;
@Setup(Level.Trial)
public void setUp() {
@@ -57,6 +61,14 @@ public class HashSetBenchmark {
for (long i = 0; i < list2Size; i++) {
employeeList2.add(new Employee(i, RandomStringUtils.random(7, true, false)));
}
+
+ for (long i = 0; i < set3Size; i++) {
+ employeeSet3.add(new Employee(i, RandomStringUtils.random(7, true, false)));
+ }
+
+ for (long i = 0; i < set4Size; i++) {
+ employeeSet4.add(new Employee(i, RandomStringUtils.random(7, true, false)));
+ }
}
@@ -71,6 +83,11 @@ public class HashSetBenchmark {
public boolean given_SizeOfHashsetSmallerThanSizeOfCollection_When_RemoveAllFromHashSet_Then_BadPerformance(MyState state) {
return state.employeeSet2.removeAll(state.employeeList2);
}
+
+ @Benchmark
+ public boolean given_SizeOfHashsetSmallerThanSizeOfAnotherHashSet_When_RemoveAllFromHashSet_Then_GoodPerformance(MyState state) {
+ return state.employeeSet3.removeAll(state.employeeSet4);
+ }
public static void main(String[] args) throws Exception {
Options options = new OptionsBuilder().include(HashSetBenchmark.class.getSimpleName())
diff --git a/core-java-modules/core-java-concurrency-advanced-3/README.md b/core-java-modules/core-java-concurrency-advanced-3/README.md
index 7d98e462d7..9495d5f479 100644
--- a/core-java-modules/core-java-concurrency-advanced-3/README.md
+++ b/core-java-modules/core-java-concurrency-advanced-3/README.md
@@ -13,7 +13,7 @@ This module contains articles about advanced topics about multithreading with co
- [Java Thread Deadlock and Livelock](https://www.baeldung.com/java-deadlock-livelock)
- [Guide to AtomicStampedReference in Java](https://www.baeldung.com/java-atomicstampedreference)
- [The ABA Problem in Concurrency](https://www.baeldung.com/cs/aba-concurrency)
-- [Introduction to Lock-Free Data Structures](https://www.baeldung.com/lock-free-programming)
+- [Introduction to Lock-Free Data Structures with Java Examples](https://www.baeldung.com/lock-free-programming)
- [Introduction to Exchanger in Java](https://www.baeldung.com/java-exchanger)
- [Why Not To Start A Thread In The Constructor?](https://www.baeldung.com/java-thread-constructor)
- [[<-- previous]](/core-java-modules/core-java-concurrency-advanced-2)
diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/deadlockAndLivelock/LivelockExample.java b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/deadlockAndLivelock/LivelockExample.java
index b0d66a92c2..7c3ea6f94e 100644
--- a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/deadlockAndLivelock/LivelockExample.java
+++ b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/deadlockAndLivelock/LivelockExample.java
@@ -73,7 +73,7 @@ public class LivelockExample {
public void tryLock(Lock lock, long millis) {
try {
- lock.tryLock(10, TimeUnit.MILLISECONDS);
+ lock.tryLock(millis, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
diff --git a/core-java-modules/core-java-concurrency-basic-2/README.md b/core-java-modules/core-java-concurrency-basic-2/README.md
index a8daf14ea9..bf973f7036 100644
--- a/core-java-modules/core-java-concurrency-basic-2/README.md
+++ b/core-java-modules/core-java-concurrency-basic-2/README.md
@@ -11,4 +11,5 @@ This module contains articles about basic Java concurrency
- [Life Cycle of a Thread in Java](https://www.baeldung.com/java-thread-lifecycle)
- [Guide to AtomicMarkableReference](https://www.baeldung.com/java-atomicmarkablereference)
- [Why are Local Variables Thread-Safe in Java](https://www.baeldung.com/java-local-variables-thread-safe)
+- [How to Stop Execution After a Certain Time in Java](https://www.baeldung.com/java-stop-execution-after-certain-time)
- [[<-- Prev]](/core-java-modules/core-java-concurrency-basic)
diff --git a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java
new file mode 100644
index 0000000000..20f66da5da
--- /dev/null
+++ b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java
@@ -0,0 +1,263 @@
+package com.baeldung.concurrent.stopexecution;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+public class StopExecution {
+ private static final Logger LOG = LoggerFactory.getLogger(StopExecution.class);
+
+ public static void main(String[] args) {
+ StopExecution stopExecution = new StopExecution();
+ //stopExecution.testUsingLoop();
+ //stopExecution.testTimer();
+ stopExecution.testScheduledExecutor();
+ LOG.info("done");
+ }
+
+ public void testUsingLoop() {
+ long start = System.currentTimeMillis();
+ long end = start + 5000;
+ List items = new ArrayList<>();
+ int counter = 0;
+
+ // Let this loop run only upto 5 seconds
+ while (System.currentTimeMillis() < end && counter < items.size()) {
+ // Fetch the item from the list.
+ // Some expensive operation on the item.
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ counter++;
+ }
+ }
+
+ public static void testThreads() {
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ LOG.info("inside run");
+
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ LOG.info("exit run");
+ }
+ });
+ thread.start();
+ while (thread.getState() != Thread.State.TERMINATED) {
+ LOG.info(thread.getState().name());
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void testExecutor() {
+ final ExecutorService service = Executors.newSingleThreadExecutor();
+ Future f = null;
+ try {
+ f = service.submit(() -> {
+ // Do you long running calculation here
+ try {
+ Thread.sleep(2737); // Simulate some delay
+ } catch (InterruptedException e) {
+ LOG.info("Interrupted");
+ return "interrupted";
+ }
+ LOG.info("Sleep finished");
+ return "42";
+ });
+
+ LOG.info(f.get(2, TimeUnit.SECONDS));
+ } catch (TimeoutException e) {
+ f.cancel(true);
+ LOG.error("Calculation took to long");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ service.shutdown();
+ }
+ }
+
+ public void testExecutor2() {
+ final ExecutorService service = Executors.newSingleThreadExecutor();
+ Future f = null;
+ try {
+ f = service.submit(new LongRunningTask());
+ LOG.info("testExecutor2");
+ f.get(1, TimeUnit.SECONDS);
+ } catch (final TimeoutException e) {
+ f.cancel(true);
+ LOG.error("Calculation took to long");
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ service.shutdownNow();
+ }
+ }
+
+ public void testScheduledExecutor() {
+ LOG.info("testScheduledExecutor");
+ ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
+ Future future = executor.submit(new LongRunningTask());
+ executor.schedule(new Runnable() {
+ public void run() {
+ future.cancel(true);
+ }
+ }, 1000, TimeUnit.MILLISECONDS);
+ executor.shutdown();
+ }
+
+ public void testThreadAndInterrupt() {
+
+ Thread t;
+ try {
+ t = new Thread(new LongRunningTask());
+
+ LOG.info("testExecutor3");
+ long end = System.currentTimeMillis() + 2000;
+ t.start();
+ while (t.isAlive() && System.currentTimeMillis() < end) {
+ Thread.sleep(50);
+ }
+ t.interrupt();
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void testTimer() {
+ LOG.info("Timer test");
+ Thread t = new Thread(new LongRunningTask());
+ Timer timeoutTimer = new Timer();
+ timeoutTimer.schedule(new TimeOutTask(t, timeoutTimer), 1000);
+ t.start();
+ }
+
+ class MyRunnableTask implements Runnable {
+ public void run() {
+ try {
+ LOG.info("MyRunnable...");
+ Thread.sleep(10000);
+ } catch (InterruptedException ie) {
+ LOG.info("MyRunnable interrupted...");
+ }
+ }
+ }
+
+ class TimeOutTask extends TimerTask {
+ private Thread t;
+ private Timer timer;
+
+ TimeOutTask(Thread t, Timer timer) {
+ this.t = t;
+ this.timer = timer;
+ }
+
+ public void run() {
+ if (t != null && t.isAlive()) {
+ t.interrupt();
+ timer.cancel();
+ }
+ }
+ }
+
+ class LongRunningTask implements Runnable {
+ @Override
+ public void run() {
+ longRunningSort();
+ }
+
+ private void longRunningOperation() {
+ LOG.info("long Running operation started");
+
+ try {
+ //Thread.sleep(500);
+ longFileRead();
+ LOG.info("long running operation finished");
+ } catch (InterruptedException e) {
+ LOG.info("long Running operation interrupted");
+ }
+ }
+
+ private void longRunningSort() {
+ LOG.info("long Running task started");
+ // Do you long running calculation here
+ int len = 100000;
+ List numbers = new ArrayList<>();
+ try {
+ for (int i = len; i > 0; i--) {
+ //Thread.sleep(5)
+ numbers.add(i);
+ }
+
+ int i = 0;
+ for (i = 0; i < len; i++) {
+ int minIndex = i;
+ for (int j = i + 1; j < len; j++) {
+ if (numbers.get(minIndex) > numbers.get(j))
+ minIndex = j;
+ }
+ if (minIndex != i) {
+ int temp = numbers.get(i);
+ numbers.set(i, numbers.get(minIndex));
+ numbers.set(minIndex, temp);
+ }
+ throwExceptionOnThreadInterrupt();
+ }
+ LOG.info("Index position: " + i);
+ LOG.info("Long running task finished");
+ } catch (InterruptedException e) {
+ LOG.info("long Running operation interrupted");
+ }
+ }
+
+ private void longFileRead() throws InterruptedException {
+ String file = "input.txt";
+ ClassLoader classloader = getClass().getClassLoader();
+
+ try (InputStream inputStream = classloader.getResourceAsStream(file)) {
+ Reader inputStreamReader = new InputStreamReader(inputStream);
+
+ int data = inputStreamReader.read();
+ while (data != -1) {
+ char theChar = (char) data;
+ data = inputStreamReader.read();
+ throwExceptionOnThreadInterrupt();
+ }
+ } catch (IOException e) {
+ LOG.error("Exception: ", e);
+ }
+ }
+
+ private void throwExceptionOnThreadInterrupt() throws InterruptedException {
+ if (Thread.currentThread().interrupted()) {
+ throw new InterruptedException();
+ }
+ }
+ }
+
+}
+
+
diff --git a/core-java-modules/core-java-exceptions-3/README.md b/core-java-modules/core-java-exceptions-3/README.md
index 4e3dd22bb8..f93e1a9943 100644
--- a/core-java-modules/core-java-exceptions-3/README.md
+++ b/core-java-modules/core-java-exceptions-3/README.md
@@ -3,3 +3,6 @@
- [NoSuchMethodError in Java](https://www.baeldung.com/java-nosuchmethod-error)
- [IllegalArgumentException or NullPointerException for a Null Parameter?](https://www.baeldung.com/java-illegalargumentexception-or-nullpointerexception)
- [IllegalMonitorStateException in Java](https://www.baeldung.com/java-illegalmonitorstateexception)
+- [AbstractMethodError in Java](https://www.baeldung.com/java-abstractmethoderror)
+- [Java IndexOutOfBoundsException “Source Does Not Fit in Dest”](https://www.baeldung.com/java-indexoutofboundsexception)
+- [Localizing Exception Messages in Java](https://www.baeldung.com/java-localize-exception-messages)
diff --git a/core-java-modules/core-java-exceptions-3/pom.xml b/core-java-modules/core-java-exceptions-3/pom.xml
index b909572afe..8c36fd0af1 100644
--- a/core-java-modules/core-java-exceptions-3/pom.xml
+++ b/core-java-modules/core-java-exceptions-3/pom.xml
@@ -17,6 +17,14 @@
+
+
+ com.h2database
+ h2
+ 1.4.191
+ test
+
+
org.assertj
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingAddAllMethodDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingAddAllMethodDemo.java
new file mode 100644
index 0000000000..34e6f1c998
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingAddAllMethodDemo.java
@@ -0,0 +1,14 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CopyListUsingAddAllMethodDemo {
+ static List copyList(List source) {
+ List destination = new ArrayList<>();
+
+ destination.addAll(source);
+
+ return destination;
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingCollectionsCopyMethodDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingCollectionsCopyMethodDemo.java
new file mode 100644
index 0000000000..664e2152d8
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingCollectionsCopyMethodDemo.java
@@ -0,0 +1,10 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import java.util.Collections;
+import java.util.List;
+
+public class CopyListUsingCollectionsCopyMethodDemo {
+ static void copyList(List source, List destination) {
+ Collections.copy(destination, source);
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingConstructorDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingConstructorDemo.java
new file mode 100644
index 0000000000..493031ba0a
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingConstructorDemo.java
@@ -0,0 +1,10 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CopyListUsingConstructorDemo {
+ static List copyList(List source) {
+ return new ArrayList<>(source);
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingJava8StreamDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingJava8StreamDemo.java
new file mode 100644
index 0000000000..d9d0247d2f
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/CopyListUsingJava8StreamDemo.java
@@ -0,0 +1,12 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class CopyListUsingJava8StreamDemo {
+ static List copyList(List source) {
+ return source
+ .stream()
+ .collect(Collectors.toList());
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/IndexOutOfBoundsExceptionDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/IndexOutOfBoundsExceptionDemo.java
new file mode 100644
index 0000000000..78b7b03bc1
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/indexoutofbounds/IndexOutOfBoundsExceptionDemo.java
@@ -0,0 +1,13 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class IndexOutOfBoundsExceptionDemo {
+ static List copyList(List source) {
+ List destination = new ArrayList<>(source.size());
+ Collections.copy(destination, source);
+ return destination;
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Animal.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Animal.java
new file mode 100644
index 0000000000..b57f68f053
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Animal.java
@@ -0,0 +1,6 @@
+package com.baeldung.exceptions.classcastexception;
+
+public interface Animal {
+
+ String getName();
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Box.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Box.java
new file mode 100644
index 0000000000..bb67407218
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Box.java
@@ -0,0 +1,14 @@
+package com.baeldung.exceptions.classcastexception;
+
+public class Box {
+
+ private T content;
+
+ public T getContent() {
+ return content;
+ }
+
+ public void setContent(T content) {
+ this.content = content;
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java
new file mode 100644
index 0000000000..0a0b2d1f63
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java
@@ -0,0 +1,9 @@
+package com.baeldung.exceptions.classcastexception;
+
+public class Frog extends Reptile {
+
+ @Override
+ public String getName() {
+ return super.getName() + ": Frog";
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Mammal.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Mammal.java
new file mode 100644
index 0000000000..2723cc5b7b
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Mammal.java
@@ -0,0 +1,9 @@
+package com.baeldung.exceptions.classcastexception;
+
+public class Mammal implements Animal {
+
+ @Override
+ public String getName() {
+ return "Mammal";
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java
new file mode 100644
index 0000000000..ed4b0273e5
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java
@@ -0,0 +1,9 @@
+package com.baeldung.exceptions.classcastexception;
+
+public class Reptile implements Animal {
+
+ @Override
+ public String getName() {
+ return "Reptile";
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/localization/LocalizedException.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/localization/LocalizedException.java
new file mode 100644
index 0000000000..c3f9980b99
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/localization/LocalizedException.java
@@ -0,0 +1,47 @@
+package com.baeldung.exceptions.localization;
+
+import java.util.Locale;
+
+public class LocalizedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String messageKey;
+ private final Locale locale;
+
+ public LocalizedException(String messageKey) {
+ this(messageKey, Locale.getDefault());
+ }
+
+ public LocalizedException(String messageKey, Locale locale) {
+ this.messageKey = messageKey;
+ this.locale = locale;
+ }
+
+ /**
+ * @return a localized message based on the messageKey provided at instantiation.
+ */
+ public String getMessage() {
+
+ /*
+ * This is a deliberate role reversal of the default implementation of getLocalizedMessage.
+ * some logging frameworks like Log4J 1 & 2 and Logback will use getMessage instead of
+ * getLocalizedMessage when logging Throwables. If we want to use these frameworks in client
+ * applications to log localized messages, then we'll need to override getMessage in a
+ * similar fashion to return the appropriate content. Or, you can call getLocalizedMessage
+ * on your own to create the log content.
+ */
+ return getLocalizedMessage();
+ }
+
+ /**
+ * @return a localized message based on the messageKey provided at instantiation.
+ */
+ public String getLocalizedMessage() {
+
+ /*
+ * java.util.logging uses getLocalizedMessage when logging Throwables.
+ */
+ return Messages.getMessageForLocale(messageKey, locale);
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/localization/Messages.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/localization/Messages.java
new file mode 100644
index 0000000000..1079bedd1a
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/localization/Messages.java
@@ -0,0 +1,27 @@
+package com.baeldung.exceptions.localization;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class Messages {
+
+ /**
+ * Retrieves the value for the messageKey from the locale-specific messages.properties, or from
+ * the base messages.properties for unsupported locales.
+ *
+ * @param messageKey The key for the message in the messages.properties ResourceBundle.
+ * @param locale The locale to search the message key.
+ * @return The value defined for the messageKey in the provided locale.
+ */
+ public static String getMessageForLocale(String messageKey, Locale locale) {
+
+ /*
+ * For more complex implementations, you will want a var-args parameter for MessageFormat
+ * substitutions. Then we can read the value from the bundle and pass the value with the
+ * substitutions to MessageFormat to create the final message value.
+ */
+ return ResourceBundle.getBundle("messages", locale)
+ .getString(messageKey);
+ }
+
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/main/resources/messages.properties b/core-java-modules/core-java-exceptions-3/src/main/resources/messages.properties
new file mode 100644
index 0000000000..b6122d7f21
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/resources/messages.properties
@@ -0,0 +1 @@
+message.exception = I am an exception.
\ No newline at end of file
diff --git a/core-java-modules/core-java-exceptions-3/src/main/resources/messages_fr.properties b/core-java-modules/core-java-exceptions-3/src/main/resources/messages_fr.properties
new file mode 100644
index 0000000000..f28e0d54ff
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/main/resources/messages_fr.properties
@@ -0,0 +1 @@
+message.exception = Je suis une exception.
\ No newline at end of file
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingAddAllMethodDemoUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingAddAllMethodDemoUnitTest.java
new file mode 100644
index 0000000000..204bbff696
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingAddAllMethodDemoUnitTest.java
@@ -0,0 +1,18 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CopyListUsingAddAllMethodDemoUnitTest {
+
+ @Test
+ void whenPassValidArrayList_thenCopyListUsingAddAllMethod() {
+ List source = Arrays.asList(11, 22, 33);
+
+ assertEquals(source, CopyListUsingAddAllMethodDemo.copyList(source));
+ }
+}
\ No newline at end of file
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingCollectionsCopyMethodDemoUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingCollectionsCopyMethodDemoUnitTest.java
new file mode 100644
index 0000000000..7ebf7461a6
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingCollectionsCopyMethodDemoUnitTest.java
@@ -0,0 +1,31 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class CopyListUsingCollectionsCopyMethodDemoUnitTest {
+ @Test
+ void whenCopyListUsingCollectionsCopy_thenOverrideAllDestinationListValues() {
+ List source = Arrays.asList(11, 22, 33);
+ List destination = Arrays.asList(1, 2, 3);
+
+ CopyListUsingCollectionsCopyMethodDemo.copyList(source, destination);
+
+ assertEquals(source, destination);
+ }
+
+ @Test
+ void whenCopyListUsingCollectionsCopy_thenOverrideInitialDestinationValuesAndOthersShouldBeUnchanged(){
+ List source = Arrays.asList(11, 22, 33);
+ List destination = Arrays.asList(1, 2, 3, 4, 5);
+ List expectedList = Arrays.asList(11, 22, 33, 4, 5);
+
+ CopyListUsingCollectionsCopyMethodDemo.copyList(source, destination);
+
+ assertEquals(expectedList, destination);
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingConstructorDemoUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingConstructorDemoUnitTest.java
new file mode 100644
index 0000000000..cd15c5055c
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingConstructorDemoUnitTest.java
@@ -0,0 +1,18 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CopyListUsingConstructorDemoUnitTest {
+
+ @Test
+ void whenCopyListUsingConstructor_thenMakeACopyOfList() {
+ List source = Arrays.asList(11, 22, 33);
+
+ assertEquals(source, CopyListUsingConstructorDemo.copyList(source));
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingJava8StreamDemoUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingJava8StreamDemoUnitTest.java
new file mode 100644
index 0000000000..9fb8e16b2a
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/CopyListUsingJava8StreamDemoUnitTest.java
@@ -0,0 +1,18 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CopyListUsingJava8StreamDemoUnitTest {
+
+ @Test
+ void whenCopyListUsingStream_thenMakeACopyOfArrayList() {
+ List source = Arrays.asList(11, 22, 33);
+
+ assertEquals(source, CopyListUsingJava8StreamDemo.copyList(source));
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/IndexOutOfBoundsExceptionDemoUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/IndexOutOfBoundsExceptionDemoUnitTest.java
new file mode 100644
index 0000000000..9929fa78d3
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exception/indexoutofbounds/IndexOutOfBoundsExceptionDemoUnitTest.java
@@ -0,0 +1,28 @@
+package com.baeldung.exception.indexoutofbounds;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+
+class IndexOutOfBoundsExceptionDemoUnitTest {
+
+ @Test
+ void givenDestinationArrayListSizeIsZero_whenCopySourceArrayListToDestination_thenShouldThrowIndexOutOfBoundsException() {
+ List source = Arrays.asList(1, 2, 3, 4, 5);
+
+ assertThrows(IndexOutOfBoundsException.class, () -> IndexOutOfBoundsExceptionDemo.copyList(source));
+ }
+
+ @Test
+ void givenSourceAndDestinationListSizeIsEqual_whenCopySourceArrayListToDestination_thenShouldNotThrowIndexOutOfBoundsException() {
+ List source = Collections.emptyList();
+
+ assertEquals(source, IndexOutOfBoundsExceptionDemo.copyList(source));
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/abstractmethoderror/AbstractMethodErrorUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/abstractmethoderror/AbstractMethodErrorUnitTest.java
new file mode 100644
index 0000000000..cadc884487
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/abstractmethoderror/AbstractMethodErrorUnitTest.java
@@ -0,0 +1,23 @@
+package com.baeldung.exceptions.abstractmethoderror;
+
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+class AbstractMethodErrorUnitTest {
+ private static final String url = "jdbc:h2:mem:A-DATABASE;INIT=CREATE SCHEMA IF NOT EXISTS myschema";
+ private static final String username = "sa";
+
+ @Test
+ void givenOldH2Database_whenCallgetSchemaMethod_thenThrowAbstractMethodError() throws SQLException {
+ Connection conn = DriverManager.getConnection(url, username, "");
+ assertNotNull(conn);
+ Assertions.assertThrows(AbstractMethodError.class, () -> conn.getSchema());
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java
new file mode 100644
index 0000000000..7fac000fa8
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java
@@ -0,0 +1,40 @@
+package com.baeldung.exceptions.classcastexception;
+
+import org.junit.Test;
+
+import java.io.Serializable;
+
+public class CheckedCastsUnitTest {
+
+ @Test(expected = ClassCastException.class)
+ public void givenBaseTypeVariableReferencingChildInstance_whenCastToIncompatibleSubtype_thenClassCastException() {
+ Animal animal = new Frog();
+
+ //A checked downcast to Mammal is incompatible from Frog because Frog is not a subtype of Mammal.
+ Mammal mammal = (Mammal) animal;
+ }
+
+ @Test(expected = ClassCastException.class)
+ public void givenBaseTypeVariableReferencingChildInstance_whenCastToIncompatibleInterface_thenClassCastException() {
+ Animal animal = new Frog();
+
+ //A checked cast to Serializable is incompatible from Frog because Frog is not a subtype of Serializable.
+ Serializable serial = (Serializable) animal;
+ }
+
+ @Test(expected = ClassCastException.class)
+ public void givenObjectVariableReferencingPrimitiveArray_whenCastToBoxedTypeArray_thenClassCastException() {
+ Object primitives = new int[1];
+
+ //A checked cast to Integer[] is incompatible from primitive arrays. Auto-boxing does not work for arrays.
+ Integer[] integers = (Integer[]) primitives;
+ }
+
+ @Test(expected = ClassCastException.class)
+ public void givenObjectVariableReferencingPrimitiveArray_whenCastToPromotedTypeArray_thenClassCastException() {
+ Object primitives = new int[1];
+
+ //A checked cast to long[] is incompatible from int[]. Type promotion does not work for arrays.
+ long[] longs = (long[]) primitives;
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/GenericConversionUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/GenericConversionUnitTest.java
new file mode 100644
index 0000000000..027ece2db7
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/GenericConversionUnitTest.java
@@ -0,0 +1,21 @@
+package com.baeldung.exceptions.classcastexception;
+
+import org.junit.Test;
+
+public class GenericConversionUnitTest {
+
+ @Test(expected = ClassCastException.class)
+ public void givenIncompatibleType_whenConvertInstanceOfObject_thenClassCastException() {
+ // Should have been null, but due to type erasure, inside convertInstanceOfObject,
+ // it will attempt to cast to Object instead of String, so it casts to Object, which is always possible.
+ String shouldBeNull = convertInstanceOfObject(123);
+ }
+
+ public static T convertInstanceOfObject(Object o) {
+ try {
+ return (T) o; // Casts to Object due to type erasure
+ } catch (ClassCastException e) {
+ return null; // Will never reach this
+ }
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/UncheckedConversionUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/UncheckedConversionUnitTest.java
new file mode 100644
index 0000000000..60e7d5a147
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/UncheckedConversionUnitTest.java
@@ -0,0 +1,17 @@
+package com.baeldung.exceptions.classcastexception;
+
+import org.junit.Test;
+
+public class UncheckedConversionUnitTest {
+
+ @Test(expected = ClassCastException.class)
+ public void givenPollutedGenericType_whenGetProperty_thenClassCastException() {
+ Box originalBox = new Box<>();
+ Box raw = originalBox;
+ raw.setContent(2.5);
+ Box bound = (Box) raw;
+
+ //An incompatible element was found in the raw box.
+ Long content = bound.getContent();
+ }
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/localization/LocalizedExceptionUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/localization/LocalizedExceptionUnitTest.java
new file mode 100644
index 0000000000..a46ca05d23
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/localization/LocalizedExceptionUnitTest.java
@@ -0,0 +1,61 @@
+package com.baeldung.exceptions.localization;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Locale;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class LocalizedExceptionUnitTest {
+
+ private Locale originalDefaultLocale;
+
+ @Before
+ public void saveOriginalDefaultLocale() {
+ originalDefaultLocale = Locale.getDefault();
+ }
+
+ @After
+ public void restoreOriginalDefaultLocale() {
+ Locale.setDefault(originalDefaultLocale);
+ }
+
+ @Test
+ public void givenUsEnglishDefaultLocale_whenLocalizingMessage_thenMessageComesFromDefaultMessages() {
+ Locale.setDefault(Locale.US);
+
+ LocalizedException localizedException = new LocalizedException("message.exception");
+ String usEnglishLocalizedExceptionMessage = localizedException.getLocalizedMessage();
+
+ assertThat(usEnglishLocalizedExceptionMessage).isEqualTo("I am an exception.");
+ }
+
+ @Test
+ public void givenFranceFrenchDefaultLocale_whenLocalizingMessage_thenMessageComesFromFrenchTranslationMessages() {
+ Locale.setDefault(Locale.FRANCE);
+
+ LocalizedException localizedException = new LocalizedException("message.exception");
+ String franceFrenchLocalizedExceptionMessage = localizedException.getLocalizedMessage();
+
+ assertThat(franceFrenchLocalizedExceptionMessage).isEqualTo("Je suis une exception.");
+ }
+
+ @Test
+ public void givenUsEnglishProvidedLocale_whenLocalizingMessage_thenMessageComesFromDefaultMessage() {
+ LocalizedException localizedException = new LocalizedException("message.exception", Locale.US);
+ String usEnglishLocalizedExceptionMessage = localizedException.getLocalizedMessage();
+
+ assertThat(usEnglishLocalizedExceptionMessage).isEqualTo("I am an exception.");
+ }
+
+ @Test
+ public void givenFranceFrenchProvidedLocale_whenLocalizingMessage_thenMessageComesFromFrenchTranslationMessages() {
+ LocalizedException localizedException = new LocalizedException("message.exception", Locale.FRANCE);
+ String franceFrenchLocalizedExceptionMessage = localizedException.getLocalizedMessage();
+
+ assertThat(franceFrenchLocalizedExceptionMessage).isEqualTo("Je suis une exception.");
+ }
+
+}
diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/localization/MessagesUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/localization/MessagesUnitTest.java
new file mode 100644
index 0000000000..7a6cb8ed32
--- /dev/null
+++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/localization/MessagesUnitTest.java
@@ -0,0 +1,25 @@
+package com.baeldung.exceptions.localization;
+
+import org.junit.Test;
+
+import java.util.Locale;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class MessagesUnitTest {
+
+ @Test
+ public void givenUsEnglishLocale_whenRetrievingMessage_thenEnglishTranslationIsReturned() {
+ String translatedMessage = Messages.getMessageForLocale("message.exception", Locale.US);
+
+ assertThat(translatedMessage).isEqualTo("I am an exception.");
+ }
+
+ @Test
+ public void givenFranceFrenchLocale_whenRetrievingMessage_thenFrenchTranslationIsReturned() {
+ String translatedMessage = Messages.getMessageForLocale("message.exception", Locale.FRANCE);
+
+ assertThat(translatedMessage).isEqualTo("Je suis une exception.");
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/README.md b/core-java-modules/core-java-functional/README.md
new file mode 100644
index 0000000000..5891b4a943
--- /dev/null
+++ b/core-java-modules/core-java-functional/README.md
@@ -0,0 +1,3 @@
+## Relevant articles:
+
+- [Functional Programming in Java](https://www.baeldung.com/java-functional-programming)
diff --git a/core-java-modules/core-java-functional/pom.xml b/core-java-modules/core-java-functional/pom.xml
new file mode 100644
index 0000000000..f00600c794
--- /dev/null
+++ b/core-java-modules/core-java-functional/pom.xml
@@ -0,0 +1,18 @@
+
+
+ 4.0.0
+ core-java-functional
+ 0.1.0-SNAPSHOT
+ core-java-functional
+ jar
+
+ com.baeldung.core-java-modules
+ core-java-modules
+ 0.0.1-SNAPSHOT
+ ../
+
+
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Currying.java b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Currying.java
new file mode 100644
index 0000000000..594fea4b8c
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Currying.java
@@ -0,0 +1,26 @@
+package com.baeldung.functional;
+
+import java.util.function.Function;
+
+public class Currying {
+
+ private static Function> weight = mass -> gravity -> mass * gravity;
+
+ private static Function weightOnEarth = weight.apply(9.81);
+
+ private static Function weightOnMars = weight.apply(3.75);
+
+ public static Double weightOnEarth(Double mass) {
+ return weightOnEarth.apply(mass);
+ }
+
+ public static Double weightOnMars(Double mass) {
+ return weightOnMars.apply(mass);
+ }
+
+ public static Function weightOnEarth() {
+ final double gravity = 9.81;
+ return mass -> mass * gravity;
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/FirstClassFunctions.java b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/FirstClassFunctions.java
new file mode 100644
index 0000000000..13b408ab27
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/FirstClassFunctions.java
@@ -0,0 +1,24 @@
+package com.baeldung.functional;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+public class FirstClassFunctions {
+
+ public static List sortWithoutLambda(List numbers) {
+ Collections.sort(numbers, new Comparator() {
+ @Override
+ public int compare(Integer n1, Integer n2) {
+ return n1.compareTo(n2);
+ }
+ });
+ return numbers;
+ }
+
+ public static List sortWithLambda(List numbers) {
+ Collections.sort(numbers, (n1, n2) -> n1.compareTo(n2));
+ return numbers;
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/FunctionComposition.java b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/FunctionComposition.java
new file mode 100644
index 0000000000..57103be98a
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/FunctionComposition.java
@@ -0,0 +1,20 @@
+package com.baeldung.functional;
+
+import java.util.function.Function;
+
+public class FunctionComposition {
+
+ private static Function log = (value) -> Math.log(value);
+ private static Function sqrt = (value) -> Math.sqrt(value);
+
+ public static Double logThenSqrt(Double number) {
+ Function logThenSqrt = sqrt.compose(log);
+ return (logThenSqrt.apply(3.14));
+ }
+
+ public static Double sqrtThenLog(Double number) {
+ Function sqrtThenLog = sqrt.andThen(log);
+ return (sqrtThenLog.apply(3.14));
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/ImmutableData.java b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/ImmutableData.java
new file mode 100644
index 0000000000..738680f743
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/ImmutableData.java
@@ -0,0 +1,36 @@
+package com.baeldung.functional;
+
+public class ImmutableData {
+
+ private final String someData;
+
+ private final AnotherImmutableData anotherImmutableData;
+
+ public ImmutableData(final String someData, final AnotherImmutableData anotherImmutableData) {
+ this.someData = someData;
+ this.anotherImmutableData = anotherImmutableData;
+ }
+
+ public String getSomeData() {
+ return someData;
+ }
+
+ public AnotherImmutableData getAnotherImmutableData() {
+ return anotherImmutableData;
+ }
+
+ public class AnotherImmutableData {
+
+ private final Integer someOtherData;
+
+ public AnotherImmutableData(final Integer someData) {
+ this.someOtherData = someData;
+ }
+
+ public Integer getSomeOtherData() {
+ return someOtherData;
+ }
+
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Monads.java b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Monads.java
new file mode 100644
index 0000000000..c1223c73c7
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Monads.java
@@ -0,0 +1,11 @@
+package com.baeldung.functional;
+
+import java.util.Optional;
+
+public class Monads {
+
+ public static Optional add(Optional val1, Optional val2) {
+ return val1.flatMap(first -> val2.flatMap(second -> Optional.of(first + second)));
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/PureFunctions.java b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/PureFunctions.java
new file mode 100644
index 0000000000..522b9de9eb
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/PureFunctions.java
@@ -0,0 +1,13 @@
+package com.baeldung.functional;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class PureFunctions {
+
+ public static Integer sum(List numbers) {
+ return numbers.stream()
+ .collect(Collectors.summingInt(Integer::intValue));
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Recursion.java b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Recursion.java
new file mode 100644
index 0000000000..d5492df69d
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/Recursion.java
@@ -0,0 +1,17 @@
+package com.baeldung.functional;
+
+public class Recursion {
+
+ public static Integer headRecursion(Integer number) {
+
+ return (number == 1) ? 1 : number * headRecursion(number - 1);
+
+ }
+
+ public static Integer tailRecursion(Integer number, Integer result) {
+
+ return (number == 1) ? result : tailRecursion(number - 1, result * number);
+
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/ReferentialTransparency.java b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/ReferentialTransparency.java
new file mode 100644
index 0000000000..1392cdd00a
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/main/java/com/baeldung/functional/ReferentialTransparency.java
@@ -0,0 +1,39 @@
+package com.baeldung.functional;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class ReferentialTransparency {
+
+ private static Logger logger = Logger.getGlobal();
+
+ public void main() {
+
+ String data = new SimpleData().setData("Baeldung")
+ .getData();
+ logger.log(Level.INFO, new SimpleData().setData("Baeldung")
+ .getData());
+ logger.log(Level.INFO, data);
+ logger.log(Level.INFO, "Baeldung");
+ }
+
+ public class SimpleData {
+
+ private Logger logger = Logger.getGlobal();
+
+ private String data;
+
+ public String getData() {
+ logger.log(Level.INFO, "Get data called for SimpleData");
+ return data;
+ }
+
+ public SimpleData setData(String data) {
+ logger.log(Level.INFO, "Set data called for SimpleData");
+ this.data = data;
+ return this;
+ }
+
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/CurryingUnitTest.java b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/CurryingUnitTest.java
new file mode 100644
index 0000000000..0cf96ed566
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/CurryingUnitTest.java
@@ -0,0 +1,22 @@
+package com.baeldung.functional;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.Test;
+
+public class CurryingUnitTest {
+
+ @Test
+ public void testWeightOnEarth() {
+
+ assertEquals(588.6, Currying.weightOnEarth(60.0), 0.1);
+
+ }
+
+ @Test
+ public void testWeightOnMars() {
+
+ assertEquals(225.0, Currying.weightOnMars(60.0), 0.1);
+
+ }
+}
diff --git a/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/FirstClassFunctionsUnitTest.java b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/FirstClassFunctionsUnitTest.java
new file mode 100644
index 0000000000..8056b44f21
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/FirstClassFunctionsUnitTest.java
@@ -0,0 +1,27 @@
+package com.baeldung.functional;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.Arrays;
+
+import org.junit.Test;
+
+public class FirstClassFunctionsUnitTest {
+
+ @Test
+ public void testSortingWithoutLambda() {
+
+ assertEquals(new Integer(8), FirstClassFunctions.sortWithoutLambda(Arrays.asList(new Integer(10), new Integer(8)))
+ .get(0));
+
+ }
+
+ @Test
+ public void testSortingWithLambda() {
+
+ assertEquals(new Integer(8), FirstClassFunctions.sortWithLambda(Arrays.asList(new Integer(10), new Integer(8)))
+ .get(0));
+
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/FunctionCompositionUnitTest.java b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/FunctionCompositionUnitTest.java
new file mode 100644
index 0000000000..48d8fb695c
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/FunctionCompositionUnitTest.java
@@ -0,0 +1,23 @@
+package com.baeldung.functional;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.Test;
+
+public class FunctionCompositionUnitTest {
+
+ @Test
+ public void testLogThenSqrt() {
+
+ assertEquals(1.07, FunctionComposition.logThenSqrt(3.14), 0.01);
+
+ }
+
+ @Test
+ public void testSqrtThenLog() {
+
+ assertEquals(0.57, FunctionComposition.sqrtThenLog(3.14), 0.01);
+
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/MonadsUnitTest.java b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/MonadsUnitTest.java
new file mode 100644
index 0000000000..8258eef59e
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/MonadsUnitTest.java
@@ -0,0 +1,19 @@
+package com.baeldung.functional;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.Optional;
+
+import org.junit.Test;
+
+public class MonadsUnitTest {
+
+ @Test
+ public void testOptionalAdd() {
+
+ assertEquals(5, Monads.add(Optional.of(new Integer(2)), Optional.of(new Integer(3)))
+ .get());
+
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/PureFunctionsUnitTets.java b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/PureFunctionsUnitTets.java
new file mode 100644
index 0000000000..23cca8bf8d
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/PureFunctionsUnitTets.java
@@ -0,0 +1,18 @@
+package com.baeldung.functional;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.Arrays;
+
+import org.junit.Test;
+
+public class PureFunctionsUnitTets {
+
+ @Test
+ public void testSortingWithoutLambda() {
+
+ assertEquals(new Integer(18), PureFunctions.sum(Arrays.asList(new Integer(10), new Integer(8))));
+
+ }
+
+}
diff --git a/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/RecursionUnitTest.java b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/RecursionUnitTest.java
new file mode 100644
index 0000000000..aa406dc7ab
--- /dev/null
+++ b/core-java-modules/core-java-functional/src/test/java/com/baeldung/functional/RecursionUnitTest.java
@@ -0,0 +1,23 @@
+package com.baeldung.functional;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.Test;
+
+public class RecursionUnitTest {
+
+ @Test
+ public void testHeadRecursion() {
+
+ assertEquals(120, Recursion.headRecursion(5));
+
+ }
+
+ @Test
+ public void testTailRecursion() {
+
+ assertEquals(120, Recursion.tailRecursion(5, 1));
+
+ }
+
+}
diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md
index 4b1a14ab3e..18caabc784 100644
--- a/core-java-modules/core-java-io-3/README.md
+++ b/core-java-modules/core-java-io-3/README.md
@@ -11,4 +11,5 @@ This module contains articles about core Java input and output (IO)
- [Java Files Open Options](https://www.baeldung.com/java-file-options)
- [Creating Temporary Directories in Java](https://www.baeldung.com/java-temp-directories)
- [Reading a Line at a Given Line Number From a File in Java](https://www.baeldung.com/java-read-line-at-number)
+- [Find the Last Modified File in a Directory with Java](https://www.baeldung.com/java-last-modified-file)
- [[<-- Prev]](/core-java-modules/core-java-io-2)
diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java
index f3cdb22f4d..f26a1ab3ad 100644
--- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java
+++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java
@@ -6,6 +6,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -37,6 +38,12 @@ public class CreateFileUnitTest {
assertTrue(success);
}
+ @Test
+ void givenUsingFileOutputStream_whenCreatingFile_thenCorrect() throws IOException {
+ try(FileOutputStream fileOutputStream = new FileOutputStream(FILE_NAME)){
+ }
+ }
+
@Test
public void givenUsingGuava_whenCreatingFile_thenCorrect() throws IOException {
com.google.common.io.Files.touch(new File(FILE_NAME));
diff --git a/core-java-modules/core-java-jar/.gitignore b/core-java-modules/core-java-jar/.gitignore
new file mode 100644
index 0000000000..ba516c02b5
--- /dev/null
+++ b/core-java-modules/core-java-jar/.gitignore
@@ -0,0 +1 @@
+!src/test/resources/example-jar/stripe-0.0.1-SNAPSHOT.jar
diff --git a/core-java-modules/core-java-jar/README.md b/core-java-modules/core-java-jar/README.md
index f6bb7677d4..f83ea496ab 100644
--- a/core-java-modules/core-java-jar/README.md
+++ b/core-java-modules/core-java-jar/README.md
@@ -7,3 +7,4 @@ This module contains articles about JAR files
- [How to Create an Executable JAR with Maven](http://www.baeldung.com/executable-jar-with-maven)
- [Importance of Main Manifest Attribute in a Self-Executing JAR](http://www.baeldung.com/java-jar-executable-manifest-main-class)
- [Guide to Creating and Running a Jar File in Java](https://www.baeldung.com/java-create-jar)
+- [Get Names of Classes Inside a JAR File](https://www.baeldung.com/jar-file-get-class-names)
diff --git a/core-java-modules/core-java-jar/src/main/java/com/baeldung/jar/GetClassNamesFromJar.java b/core-java-modules/core-java-jar/src/main/java/com/baeldung/jar/GetClassNamesFromJar.java
new file mode 100644
index 0000000000..0d8a67dbd6
--- /dev/null
+++ b/core-java-modules/core-java-jar/src/main/java/com/baeldung/jar/GetClassNamesFromJar.java
@@ -0,0 +1,43 @@
+package com.baeldung.jar;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class GetClassNamesFromJar {
+
+ public static Set getClassNamesFromJarFile(File givenFile) throws IOException {
+ Set classNames = new HashSet<>();
+ try (JarFile jarFile = new JarFile(givenFile)) {
+ Enumeration e = jarFile.entries();
+ while (e.hasMoreElements()) {
+ JarEntry jarEntry = e.nextElement();
+ if (jarEntry.getName().endsWith(".class")) {
+ String className = jarEntry.getName()
+ .replace("/", ".")
+ .replace(".class", "");
+ classNames.add(className);
+ }
+ }
+ return classNames;
+ }
+ }
+
+ public static Set getClassesFromJarFile(File jarFile) throws IOException, ClassNotFoundException {
+ Set classNames = getClassNamesFromJarFile(jarFile);
+ Set classes = new HashSet<>(classNames.size());
+ try (URLClassLoader cl = URLClassLoader.newInstance(new URL[] { new URL("jar:file:" + jarFile + "!/") })) {
+ for (String name : classNames) {
+ Class clazz = cl.loadClass(name); // Loading the class by its name
+ classes.add(clazz);
+ }
+ }
+ return classes;
+ }
+}
diff --git a/core-java-modules/core-java-jar/src/test/java/com/baeldung/jar/GetClassNamesFromJarUnitTest.java b/core-java-modules/core-java-jar/src/test/java/com/baeldung/jar/GetClassNamesFromJarUnitTest.java
new file mode 100644
index 0000000000..7af3ff59fd
--- /dev/null
+++ b/core-java-modules/core-java-jar/src/test/java/com/baeldung/jar/GetClassNamesFromJarUnitTest.java
@@ -0,0 +1,39 @@
+package com.baeldung.jar;
+
+import com.google.common.collect.Sets;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class GetClassNamesFromJarUnitTest {
+ private static final String JAR_PATH = "example-jar/stripe-0.0.1-SNAPSHOT.jar";
+ private static final Set EXPECTED_CLASS_NAMES = Sets.newHashSet(
+ "com.baeldung.stripe.StripeApplication",
+ "com.baeldung.stripe.ChargeRequest",
+ "com.baeldung.stripe.StripeService",
+ "com.baeldung.stripe.ChargeRequest$Currency",
+ "com.baeldung.stripe.ChargeController",
+ "com.baeldung.stripe.CheckoutController");
+
+ @Test
+ public void givenJarFilePath_whenLoadClassNames_thenGetClassNames() throws IOException, URISyntaxException {
+ File jarFile = new File(Objects.requireNonNull(getClass().getClassLoader().getResource(JAR_PATH)).toURI());
+ Set classNames = GetClassNamesFromJar.getClassNamesFromJarFile(jarFile);
+ Assert.assertEquals(EXPECTED_CLASS_NAMES, classNames);
+ }
+
+ @Test
+ public void givenJarFilePath_whenLoadClass_thenGetClassObjects() throws IOException, ClassNotFoundException, URISyntaxException {
+ File jarFile = new File(Objects.requireNonNull(getClass().getClassLoader().getResource(JAR_PATH)).toURI());
+ Set classes = GetClassNamesFromJar.getClassesFromJarFile(jarFile);
+ Set names = classes.stream().map(Class::getName).collect(Collectors.toSet());
+ Assert.assertEquals(EXPECTED_CLASS_NAMES, names);
+ }
+}
diff --git a/core-java-modules/core-java-jar/src/test/resources/example-jar/stripe-0.0.1-SNAPSHOT.jar b/core-java-modules/core-java-jar/src/test/resources/example-jar/stripe-0.0.1-SNAPSHOT.jar
new file mode 100644
index 0000000000..213d7f9400
Binary files /dev/null and b/core-java-modules/core-java-jar/src/test/resources/example-jar/stripe-0.0.1-SNAPSHOT.jar differ
diff --git a/core-java-modules/core-java-lang-3/README.md b/core-java-modules/core-java-lang-3/README.md
index 121d30f20f..78491e5bfa 100644
--- a/core-java-modules/core-java-lang-3/README.md
+++ b/core-java-modules/core-java-lang-3/README.md
@@ -6,4 +6,7 @@ This module contains articles about core features in the Java language
- [Converting a Java String Into a Boolean](https://www.baeldung.com/java-string-to-boolean)
- [When are Static Variables Initialized in Java?](https://www.baeldung.com/java-static-variables-initialization)
- [Checking if a Class Exists in Java](https://www.baeldung.com/java-check-class-exists)
+- [The Difference Between a.getClass() and A.class in Java](https://www.baeldung.com/java-getclass-vs-class)
+- [Constants in Java: Patterns and Anti-Patterns](https://www.baeldung.com/java-constants-good-practices)
+- [The transient Keyword in Java](https://www.baeldung.com/java-transient-keyword)
- [[<-- Prev]](/core-java-modules/core-java-lang-2)
diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/Calculator.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/Calculator.java
new file mode 100644
index 0000000000..78b51c1c93
--- /dev/null
+++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/Calculator.java
@@ -0,0 +1,37 @@
+package com.baeldung.constantspatterns;
+
+public class Calculator {
+ public static final double PI = 3.14159265359;
+ private static final double UPPER_LIMIT = 0x1.fffffffffffffP+1023;
+
+ public enum Operation {
+ ADD, SUBTRACT, DIVIDE, MULTIPLY
+ }
+
+ public double operateOnTwoNumbers(double numberOne, double numberTwo, Operation operation) {
+ if (numberOne > UPPER_LIMIT) {
+ throw new IllegalArgumentException("'numberOne' is too large");
+ }
+ if (numberTwo > UPPER_LIMIT) {
+ throw new IllegalArgumentException("'numberTwo' is too large");
+ }
+ double answer = 0;
+
+ switch (operation) {
+ case ADD:
+ answer = numberOne + numberTwo;
+ break;
+ case SUBTRACT:
+ answer = numberOne - numberTwo;
+ break;
+ case DIVIDE:
+ answer = numberOne / numberTwo;
+ break;
+ case MULTIPLY:
+ answer = numberOne * numberTwo;
+ break;
+ }
+
+ return answer;
+ }
+}
diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/CalculatorConstants.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/CalculatorConstants.java
new file mode 100644
index 0000000000..2237782b00
--- /dev/null
+++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/CalculatorConstants.java
@@ -0,0 +1,10 @@
+package com.baeldung.constantspatterns;
+
+public interface CalculatorConstants {
+ double PI = 3.14159265359;
+ double UPPER_LIMIT = 0x1.fffffffffffffP+1023;
+
+ enum Operation {
+ ADD, SUBTRACT, MULTIPLY, DIVIDE
+ };
+}
diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/GeometryCalculator.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/GeometryCalculator.java
new file mode 100644
index 0000000000..47a0dc5233
--- /dev/null
+++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/GeometryCalculator.java
@@ -0,0 +1,32 @@
+package com.baeldung.constantspatterns;
+
+public class GeometryCalculator implements CalculatorConstants {
+ public static final double UPPER_LIMIT = 100000000000000000000.0;
+
+ public double operateOnTwoNumbers(double numberOne, double numberTwo, Operation operation) {
+ if (numberOne > UPPER_LIMIT) {
+ throw new IllegalArgumentException("'numberOne' is too large");
+ }
+ if (numberTwo > UPPER_LIMIT) {
+ throw new IllegalArgumentException("'numberTwo' is too large");
+ }
+ double answer = 0;
+
+ switch (operation) {
+ case ADD:
+ answer = numberOne + numberTwo;
+ break;
+ case SUBTRACT:
+ answer = numberOne - numberTwo;
+ break;
+ case DIVIDE:
+ answer = numberOne / numberTwo;
+ break;
+ case MULTIPLY:
+ answer = numberOne * numberTwo;
+ break;
+ }
+
+ return answer;
+ }
+}
diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java
new file mode 100644
index 0000000000..1c9c4172ca
--- /dev/null
+++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java
@@ -0,0 +1,16 @@
+package com.baeldung.constantspatterns.calculations;
+
+public final class MathConstants {
+ public static final double PI = 3.14159265359;
+ static final double GOLDEN_RATIO = 1.6180;
+ static final double GRAVITATIONAL_ACCELERATION = 9.8;
+ static final double EULERS_NUMBER = 2.7182818284590452353602874713527;
+
+ public enum Operation {
+ ADD, SUBTRACT, DIVIDE, MULTIPLY
+ }
+
+ private MathConstants() {
+
+ }
+}
diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/transientkw/Book.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/transientkw/Book.java
new file mode 100644
index 0000000000..5822d83841
--- /dev/null
+++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/transientkw/Book.java
@@ -0,0 +1,42 @@
+package com.baeldung.transientkw;
+
+import java.io.Serializable;
+
+public class Book implements Serializable {
+
+ private static final long serialVersionUID = -2936687026040726549L;
+
+ private String bookName;
+ private transient String description;
+ private transient int copies;
+ private final transient String bookCategory = "Fiction";
+
+ public String getBookName() {
+ return bookName;
+ }
+
+ public void setBookName(String bookName) {
+ this.bookName = bookName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getCopies() {
+ return copies;
+ }
+
+ public void setCopies(int copies) {
+ this.copies = copies;
+ }
+
+ public String getBookCategory() {
+ return bookCategory;
+ }
+
+}
diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/transientkw/BookSerDe.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/transientkw/BookSerDe.java
new file mode 100644
index 0000000000..38e018baa3
--- /dev/null
+++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/transientkw/BookSerDe.java
@@ -0,0 +1,44 @@
+package com.baeldung.transientkw;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+public class BookSerDe {
+ static String fileName = "book.ser";
+
+ /**
+ * Method to serialize Book objects to the file
+ * @throws FileNotFoundException
+ */
+ public static void serialize(Book book) throws Exception {
+ FileOutputStream file = new FileOutputStream(fileName);
+ ObjectOutputStream out = new ObjectOutputStream(file);
+
+ out.writeObject(book);
+
+ out.close();
+ file.close();
+ }
+
+ /**
+ * Method to deserialize the person object
+ * @return book
+ * @throws IOException, ClassNotFoundException
+ */
+ public static Book deserialize() throws Exception {
+ FileInputStream file = new FileInputStream(fileName);
+ ObjectInputStream in = new ObjectInputStream(file);
+
+ Book book = (Book) in.readObject();
+
+ in.close();
+ file.close();
+
+ return book;
+ }
+
+}
diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java
new file mode 100644
index 0000000000..ba8f237fd3
--- /dev/null
+++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java
@@ -0,0 +1,23 @@
+package com.baeldung.constantspatterns;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.Test;
+
+public class ConstantPatternUnitTest {
+ @Test
+ public void givenTwoNumbersAndAdd_whenCallingCalculatorOperatOneTwoNumbers_thenCorrectAnswerReturned() {
+ Calculator calculator = new Calculator();
+ double expected = 4;
+ double answer = calculator.operateOnTwoNumbers(2, 2, Calculator.Operation.ADD);
+ assertEquals(expected, answer);
+ }
+
+ @Test
+ public void givenTwoNumbersAndAdd_whenCallingGeometryCalculatorOperatOneTwoNumbers_thenCorrectAnswerReturned() {
+ GeometryCalculator calculator = new GeometryCalculator();
+ double expected = 4;
+ double answer = calculator.operateOnTwoNumbers(2, 2, GeometryCalculator.Operation.ADD);
+ assertEquals(expected, answer);
+ }
+}
diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/transientkw/TransientUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/transientkw/TransientUnitTest.java
new file mode 100644
index 0000000000..cf63a0ddda
--- /dev/null
+++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/transientkw/TransientUnitTest.java
@@ -0,0 +1,35 @@
+package com.baeldung.transientkw;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import org.junit.jupiter.api.Test;
+
+class TransientUnitTest {
+
+ @Test
+ void givenTransient_whenSerDe_thenVerifyValues() throws Exception {
+ Book book = new Book();
+ book.setBookName("Java Reference");
+ book.setDescription("will not be saved");
+ book.setCopies(25);
+
+ BookSerDe.serialize(book);
+ Book book2 = BookSerDe.deserialize();
+
+ assertEquals("Java Reference", book2.getBookName());
+ assertNull(book2.getDescription());
+ assertEquals(0, book2.getCopies());
+ }
+
+ @Test
+ void givenFinalTransient_whenSerDe_thenValuePersisted() throws Exception {
+ Book book = new Book();
+
+ BookSerDe.serialize(book);
+ Book book2 = BookSerDe.deserialize();
+
+ assertEquals("Fiction", book2.getBookCategory());
+ }
+
+}
diff --git a/core-java-modules/core-java-lang-math-2/README.md b/core-java-modules/core-java-lang-math-2/README.md
index 69ee00b5a5..a98ff863ac 100644
--- a/core-java-modules/core-java-lang-math-2/README.md
+++ b/core-java-modules/core-java-lang-math-2/README.md
@@ -9,9 +9,9 @@
- [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap)
- [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points)
- [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines)
-- [Round Up to the Nearest Hundred](https://www.baeldung.com/java-round-up-nearest-hundred)
+- [Round Up to the Nearest Hundred in Java](https://www.baeldung.com/java-round-up-nearest-hundred)
- [Convert Latitude and Longitude to a 2D Point in Java](https://www.baeldung.com/java-convert-latitude-longitude)
- [Debugging with Eclipse](https://www.baeldung.com/eclipse-debugging)
- [Matrix Multiplication in Java](https://www.baeldung.com/java-matrix-multiplication)
-- [Largest Power of 2 That Is Less Than the Given Number](https://www.baeldung.com/java-largest-power-of-2-less-than-number)
+- [Largest Power of 2 That Is Less Than the Given Number with Java](https://www.baeldung.com/java-largest-power-of-2-less-than-number)
- More articles: [[<-- Prev]](/core-java-modules/core-java-lang-math)
diff --git a/core-java-modules/core-java-lang-oop-types/README.md b/core-java-modules/core-java-lang-oop-types/README.md
index 459352c490..6c649877b3 100644
--- a/core-java-modules/core-java-lang-oop-types/README.md
+++ b/core-java-modules/core-java-lang-oop-types/README.md
@@ -12,3 +12,4 @@ This module contains articles about types in Java
- [Attaching Values to Java Enum](https://www.baeldung.com/java-enum-values)
- [A Guide to Java Enums](https://www.baeldung.com/a-guide-to-java-enums)
- [Determine if an Object is of Primitive Type](https://www.baeldung.com/java-object-primitive-type)
+- [Extending Enums in Java](https://www.baeldung.com/java-extending-enums)
diff --git a/core-java-modules/core-java-lang-oop-types/pom.xml b/core-java-modules/core-java-lang-oop-types/pom.xml
index ee167bbae2..c4efd9b8d2 100644
--- a/core-java-modules/core-java-lang-oop-types/pom.xml
+++ b/core-java-modules/core-java-lang-oop-types/pom.xml
@@ -12,12 +12,20 @@
core-java-lang-oop-types
core-java-lang-oop-types
jar
-
+
org.apache.commons
commons-lang3
${commons-lang3.version}
+
+ commons-codec
+ commons-codec
+ ${commons-codec.version}
+
+
+ 1.15
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/Application.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/Application.java
new file mode 100644
index 0000000000..ad3d861d6a
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/Application.java
@@ -0,0 +1,35 @@
+package com.baeldung.enums.extendenum;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.Map;
+
+public class Application {
+ private static final Map OPERATION_MAP;
+
+ static {
+ OPERATION_MAP = new EnumMap<>(ImmutableOperation.class);
+ OPERATION_MAP.put(ImmutableOperation.TO_LOWER, String::toLowerCase);
+ OPERATION_MAP.put(ImmutableOperation.INVERT_CASE, StringUtils::swapCase);
+ OPERATION_MAP.put(ImmutableOperation.REMOVE_WHITESPACES, input -> input.replaceAll("\\s", ""));
+
+ if (Arrays.stream(ImmutableOperation.values()).anyMatch(it -> !OPERATION_MAP.containsKey(it))) {
+ throw new IllegalStateException("Unmapped enum constant found!");
+ }
+ }
+
+ public String applyImmutableOperation(ImmutableOperation operation, String input) {
+ return OPERATION_MAP.get(operation).apply(input);
+ }
+
+ public String getDescription(StringOperation stringOperation) {
+ return stringOperation.getDescription();
+ }
+
+ public String applyOperation(StringOperation operation, String input) {
+ return operation.apply(input);
+ }
+
+}
diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ApplicationWithEx.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ApplicationWithEx.java
new file mode 100644
index 0000000000..e9cbad6b7c
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ApplicationWithEx.java
@@ -0,0 +1,26 @@
+package com.baeldung.enums.extendenum;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.Map;
+
+public class ApplicationWithEx {
+ private static final Map OPERATION_MAP;
+
+ static {
+ OPERATION_MAP = new EnumMap<>(ImmutableOperation.class);
+ OPERATION_MAP.put(ImmutableOperation.TO_LOWER, String::toLowerCase);
+ OPERATION_MAP.put(ImmutableOperation.INVERT_CASE, StringUtils::swapCase);
+ // ImmutableOperation.REMOVE_WHITESPACES is not mapped
+
+ if (Arrays.stream(ImmutableOperation.values()).anyMatch(it -> !OPERATION_MAP.containsKey(it))) {
+ throw new IllegalStateException("Unmapped enum constant found!");
+ }
+ }
+
+ public String applyImmutableOperation(ImmutableOperation operation, String input) {
+ return OPERATION_MAP.get(operation).apply(input);
+ }
+}
diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/BasicStringOperation.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/BasicStringOperation.java
new file mode 100644
index 0000000000..267b02daf4
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/BasicStringOperation.java
@@ -0,0 +1,33 @@
+package com.baeldung.enums.extendenum;
+
+public enum BasicStringOperation implements StringOperation {
+ TRIM("Removing leading and trailing spaces.") {
+ @Override
+ public String apply(String input) {
+ return input.trim();
+ }
+ },
+ TO_UPPER("Changing all characters into upper case.") {
+ @Override
+ public String apply(String input) {
+ return input.toUpperCase();
+ }
+ },
+ REVERSE("Reversing the given string.") {
+ @Override
+ public String apply(String input) {
+ return new StringBuilder(input).reverse().toString();
+ }
+ };
+
+ private String description;
+
+ public String getDescription() {
+ return description;
+ }
+
+ BasicStringOperation(String description) {
+ this.description = description;
+ }
+}
+
diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ExtendedStringOperation.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ExtendedStringOperation.java
new file mode 100644
index 0000000000..6184837b26
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ExtendedStringOperation.java
@@ -0,0 +1,31 @@
+package com.baeldung.enums.extendenum;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.digest.DigestUtils;
+
+public enum ExtendedStringOperation implements StringOperation {
+ MD5_ENCODE("Encoding the given string using the MD5 algorithm.") {
+ @Override
+ public String apply(String input) {
+ return DigestUtils.md5Hex(input);
+ }
+ },
+ BASE64_ENCODE("Encoding the given string using the BASE64 algorithm.") {
+ @Override
+ public String apply(String input) {
+ return new String(new Base64().encode(input.getBytes()));
+ }
+ };
+
+ private String description;
+
+ ExtendedStringOperation(String description) {
+ this.description = description;
+ }
+
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+}
\ No newline at end of file
diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ImmutableOperation.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ImmutableOperation.java
new file mode 100644
index 0000000000..66f26a4806
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/ImmutableOperation.java
@@ -0,0 +1,6 @@
+package com.baeldung.enums.extendenum;
+
+public enum ImmutableOperation {
+ REMOVE_WHITESPACES, TO_LOWER, INVERT_CASE
+}
+
diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/Operator.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/Operator.java
new file mode 100644
index 0000000000..a65fea4f92
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/Operator.java
@@ -0,0 +1,5 @@
+package com.baeldung.enums.extendenum;
+
+public interface Operator {
+ String apply(String input);
+}
diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/StringOperation.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/StringOperation.java
new file mode 100644
index 0000000000..faf4f38274
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/enums/extendenum/StringOperation.java
@@ -0,0 +1,7 @@
+package com.baeldung.enums.extendenum;
+
+public interface StringOperation {
+ String getDescription();
+
+ String apply(String input);
+}
diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/enums/extendenum/ExtendEnumUnitTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/enums/extendenum/ExtendEnumUnitTest.java
new file mode 100644
index 0000000000..0b5ed1e826
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/enums/extendenum/ExtendEnumUnitTest.java
@@ -0,0 +1,43 @@
+package com.baeldung.enums.extendenum;
+
+import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class ExtendEnumUnitTest {
+ private Application app = new Application();
+
+ @Test
+ public void givenAStringAndOperation_whenApplyOperation_thenGetExpectedResult() {
+ String input = " hello";
+ String expectedToUpper = " HELLO";
+ String expectedReverse = "olleh ";
+ String expectedTrim = "hello";
+ String expectedBase64 = "IGhlbGxv";
+ String expectedMd5 = "292a5af68d31c10e31ad449bd8f51263";
+ assertEquals(expectedTrim, app.applyOperation(BasicStringOperation.TRIM, input));
+ assertEquals(expectedToUpper, app.applyOperation(BasicStringOperation.TO_UPPER, input));
+ assertEquals(expectedReverse, app.applyOperation(BasicStringOperation.REVERSE, input));
+ assertEquals(expectedBase64, app.applyOperation(ExtendedStringOperation.BASE64_ENCODE, input));
+ assertEquals(expectedMd5, app.applyOperation(ExtendedStringOperation.MD5_ENCODE, input));
+ }
+
+ @Test
+ public void givenAStringAndImmutableOperation_whenApplyOperation_thenGetExpectedResult() {
+ String input = " He ll O ";
+ String expectedToLower = " he ll o ";
+ String expectedRmWhitespace = "HellO";
+ String expectedInvertCase = " hE LL o ";
+ assertEquals(expectedToLower, app.applyImmutableOperation(ImmutableOperation.TO_LOWER, input));
+ assertEquals(expectedRmWhitespace, app.applyImmutableOperation(ImmutableOperation.REMOVE_WHITESPACES, input));
+ assertEquals(expectedInvertCase, app.applyImmutableOperation(ImmutableOperation.INVERT_CASE, input));
+ }
+
+ @Test
+ public void givenUnmappedImmutableOperationValue_whenAppStarts_thenGetException() {
+ Throwable throwable = assertThrows(ExceptionInInitializerError.class, () -> {
+ ApplicationWithEx appEx = new ApplicationWithEx();
+ });
+ assertTrue(throwable.getCause() instanceof IllegalStateException);
+ }
+}
\ No newline at end of file
diff --git a/core-java-modules/core-java-lang/src/main/java/com/baeldung/finalize/CrashedFinalizable.java b/core-java-modules/core-java-lang/src/main/java/com/baeldung/finalize/CrashedFinalizable.java
new file mode 100644
index 0000000000..d5ee27591b
--- /dev/null
+++ b/core-java-modules/core-java-lang/src/main/java/com/baeldung/finalize/CrashedFinalizable.java
@@ -0,0 +1,28 @@
+package com.baeldung.finalize;
+
+import java.lang.ref.ReferenceQueue;
+import java.lang.reflect.Field;
+
+public class CrashedFinalizable {
+ public static void main(String[] args) throws ReflectiveOperationException {
+ for (int i = 0; ; i++) {
+ new CrashedFinalizable();
+ if ((i % 1_000_000) == 0) {
+ Class> finalizerClass = Class.forName("java.lang.ref.Finalizer");
+ Field queueStaticField = finalizerClass.getDeclaredField("queue");
+ queueStaticField.setAccessible(true);
+ ReferenceQueue
-
\ No newline at end of file
+
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib-jdk8
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib-jdk7
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib-common
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-reflect
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-test-junit
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-test
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-test-common
+ ${kotlin.version}
+
+
+ org.jetbrains.kotlin
+ kotlin-test-annotations-common
+ ${kotlin.version}
+
+
+
+
+
+ 1.4.10
+
+
diff --git a/core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/kotlin/delegates/DelegateProviderTest.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/kotlin/delegates/DelegateProviderTest.kt
new file mode 100644
index 0000000000..2959ea0e3c
--- /dev/null
+++ b/core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/kotlin/delegates/DelegateProviderTest.kt
@@ -0,0 +1,42 @@
+package com.baeldung.kotlin.delegates
+
+import org.junit.Test
+import kotlin.properties.PropertyDelegateProvider
+import kotlin.reflect.KProperty
+import kotlin.test.assertEquals
+
+class DelegateProvider(private val field: String, private val id: Int)
+ : PropertyDelegateProvider> {
+ override operator fun provideDelegate(thisRef: T, prop: KProperty<*>): DatabaseDelegate {
+ println("Providing delegate for field $field and ID $id")
+ prop.returnType.isMarkedNullable
+ return DatabaseDelegate(field, id)
+ }
+}
+
+class DelegateProvidingUser(val id: Int) {
+ var name: String by DelegateProvider("name", id)
+ var age: Int by DelegateProvider("age", id)
+}
+
+class DelegateProviderTest {
+ @Test
+ fun testGetKnownFields() {
+ val user = DelegateProvidingUser(1)
+ assertEquals("George", user.name)
+ assertEquals(4, user.age)
+ }
+
+ @Test
+ fun testSetKnownFields() {
+ val user = DelegateProvidingUser(2)
+ user.age = 3
+ assertEquals(3, user.age)
+ }
+
+ @Test(expected = NoRecordFoundException::class)
+ fun testGetKnownField() {
+ val user = DelegateProvidingUser(3)
+ user.name
+ }
+}
diff --git a/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt
index aaa6616ed1..3b179642ba 100644
--- a/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt
+++ b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt
@@ -22,30 +22,6 @@ fun main() {
numbers.each { println(random * it) } // capturing the random variable
}
-fun namedFunction(): Int {
- return 42
-}
-
-fun anonymous(): () -> Int {
- return fun(): Int {
- return 42
- }
-}
-
-inline fun List.eachIndexed(f: (Int, T) -> Unit) {
- for (i in indices) {
- f(i, this[i])
- }
-}
-
-fun List.indexOf(x: T): Int {
- eachIndexed { index, value ->
- if (value == x) return index
- }
-
- return -1
-}
-
/**
* Generates a random number.
*/
diff --git a/core-kotlin-modules/core-kotlin/README.md b/core-kotlin-modules/core-kotlin/README.md
index 33f8745937..a890658e95 100644
--- a/core-kotlin-modules/core-kotlin/README.md
+++ b/core-kotlin-modules/core-kotlin/README.md
@@ -12,3 +12,4 @@ This module contains articles about Kotlin core features.
- [Sequences in Kotlin](https://www.baeldung.com/kotlin/sequences)
- [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class)
- [Exception Handling in Kotlin](https://www.baeldung.com/kotlin/exception-handling)
+- [Quick Guide to Kotlin Default and Named Arguments](https://www.baeldung.com/kotlin/default-named-arguments)
diff --git a/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/DefaultArguments.kt b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/DefaultArguments.kt
new file mode 100644
index 0000000000..691b3475b4
--- /dev/null
+++ b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/DefaultArguments.kt
@@ -0,0 +1,37 @@
+package com.baeldung.arguments
+
+fun main() {
+
+ // Skip both the connectTimeout and enableRetry arguments
+ connect("http://www.baeldung.com")
+
+ // Skip only the enableRetry argument:
+ connect("http://www.baeldung.com", 5000)
+
+ // Skip only the middle argument connectTimeout
+ // connect("http://www.baeldung.com", false) // This results in a compiler error
+
+ // Because we skipped the connectTimeout argument, we must pass the enableRetry as a named argument
+ connect("http://www.baeldung.com", enableRetry = false)
+
+ // Overriding Functions and Default Arguments
+ val realConnector = RealConnector()
+ realConnector.connect("www.baeldung.com")
+ realConnector.connect()
+}
+
+fun connect(url: String, connectTimeout: Int = 1000, enableRetry: Boolean = true) {
+ println("The parameters are url = $url, connectTimeout = $connectTimeout, enableRetry = $enableRetry")
+}
+
+open class AbstractConnector {
+ open fun connect(url: String = "localhost") {
+ // function implementation
+ }
+}
+
+class RealConnector : AbstractConnector() {
+ override fun connect(url: String) {
+ println("The parameter is url = $url")
+ }
+}
\ No newline at end of file
diff --git a/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/NamedArguments.kt b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/NamedArguments.kt
new file mode 100644
index 0000000000..0cbf6f158a
--- /dev/null
+++ b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/NamedArguments.kt
@@ -0,0 +1,28 @@
+package com.baeldung.arguments
+
+fun main() {
+ resizePane(newSize = 10, forceResize = true, noAnimation = false)
+
+ // Swap the order of last two named arguments
+ resizePane(newSize = 11, noAnimation = false, forceResize = true)
+
+ // Named arguments can be passed in any order
+ resizePane(forceResize = true, newSize = 12, noAnimation = false)
+
+ // Mixing Named and Positional Arguments
+ // Kotlin 1.3 would allow us to name only the arguments after the positional ones
+ resizePane(20, true, noAnimation = false)
+
+ // Using a positional argument in the middle of named arguments (supported from Kotlin 1.4.0)
+ // resizePane(newSize = 20, true, noAnimation = false)
+
+ // Only the last argument as a positional argument (supported from Kotlin 1.4.0)
+ // resizePane(newSize = 30, forceResize = true, false)
+
+ // Use a named argument in the middle of positional arguments (supported from Kotlin 1.4.0)
+ // resizePane(40, forceResize = true, false)
+}
+
+fun resizePane(newSize: Int, forceResize: Boolean, noAnimation: Boolean) {
+ println("The parameters are newSize = $newSize, forceResize = $forceResize, noAnimation = $noAnimation")
+}
\ No newline at end of file
diff --git a/ddd/pom.xml b/ddd/pom.xml
index a67719f8a6..7d03208802 100644
--- a/ddd/pom.xml
+++ b/ddd/pom.xml
@@ -104,16 +104,12 @@
org.apache.maven.plugins
maven-surefire-plugin
- ${maven-surefire-plugin.version}
- 2.22.2
-
1.0.1
- 5.6.2
diff --git a/discord4j/.gitignore b/discord4j/.gitignore
new file mode 100644
index 0000000000..7ed0d6b679
--- /dev/null
+++ b/discord4j/.gitignore
@@ -0,0 +1,32 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/discord4j/README.md b/discord4j/README.md
new file mode 100644
index 0000000000..58a9924666
--- /dev/null
+++ b/discord4j/README.md
@@ -0,0 +1,7 @@
+## DISCORD4J
+
+This module contains articles about Discord4J
+
+### Relevant Articles:
+
+- [Creating a Discord Bot with Discord4J + Spring Boot](https://www.baeldung.com/spring-discord4j-bot)
\ No newline at end of file
diff --git a/discord4j/pom.xml b/discord4j/pom.xml
new file mode 100644
index 0000000000..664692f60a
--- /dev/null
+++ b/discord4j/pom.xml
@@ -0,0 +1,71 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.3.5.RELEASE
+
+
+ com.baeldung
+ discord4j-bot
+ 0.0.1-SNAPSHOT
+ discord4j-bot
+ Demo Discord bot using Discord4J + Spring Boot
+
+
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+
+
+
+
+
+ com.discord4j
+ discord4j-core
+ 3.1.1
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+
+
+
+
+
diff --git a/discord4j/src/main/java/com/baeldung/discordbot/BotConfiguration.java b/discord4j/src/main/java/com/baeldung/discordbot/BotConfiguration.java
new file mode 100644
index 0000000000..901308605b
--- /dev/null
+++ b/discord4j/src/main/java/com/baeldung/discordbot/BotConfiguration.java
@@ -0,0 +1,46 @@
+package com.baeldung.discordbot;
+
+import com.baeldung.discordbot.events.EventListener;
+import discord4j.core.DiscordClientBuilder;
+import discord4j.core.GatewayDiscordClient;
+import discord4j.core.event.domain.Event;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+
+@Configuration
+public class BotConfiguration {
+
+ private static final Logger log = LoggerFactory.getLogger( BotConfiguration.class );
+
+ @Value("${token}")
+ private String token;
+
+ @Bean
+ public GatewayDiscordClient gatewayDiscordClient(List> eventListeners) {
+ GatewayDiscordClient client = null;
+
+ try {
+ client = DiscordClientBuilder.create(token)
+ .build()
+ .login()
+ .block();
+
+ for(EventListener listener : eventListeners) {
+ client.on(listener.getEventType())
+ .flatMap(listener::execute)
+ .onErrorResume(listener::handleError)
+ .subscribe();
+ }
+ }
+ catch ( Exception exception ) {
+ log.error( "Be sure to use a valid bot token!", exception );
+ }
+
+ return client;
+ }
+}
diff --git a/discord4j/src/main/java/com/baeldung/discordbot/DiscordBotApplication.java b/discord4j/src/main/java/com/baeldung/discordbot/DiscordBotApplication.java
new file mode 100644
index 0000000000..069a36635c
--- /dev/null
+++ b/discord4j/src/main/java/com/baeldung/discordbot/DiscordBotApplication.java
@@ -0,0 +1,12 @@
+package com.baeldung.discordbot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class DiscordBotApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DiscordBotApplication.class, args);
+ }
+}
diff --git a/discord4j/src/main/java/com/baeldung/discordbot/events/EventListener.java b/discord4j/src/main/java/com/baeldung/discordbot/events/EventListener.java
new file mode 100644
index 0000000000..ca4c79de0d
--- /dev/null
+++ b/discord4j/src/main/java/com/baeldung/discordbot/events/EventListener.java
@@ -0,0 +1,19 @@
+package com.baeldung.discordbot.events;
+
+import discord4j.core.event.domain.Event;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import reactor.core.publisher.Mono;
+
+public interface EventListener {
+
+ Logger LOG = LoggerFactory.getLogger(EventListener.class);
+
+ Class getEventType();
+ Mono execute(T event);
+
+ default Mono handleError(Throwable error) {
+ LOG.error("Unable to process " + getEventType().getSimpleName(), error);
+ return Mono.empty();
+ }
+}
diff --git a/discord4j/src/main/java/com/baeldung/discordbot/events/MessageCreateListener.java b/discord4j/src/main/java/com/baeldung/discordbot/events/MessageCreateListener.java
new file mode 100644
index 0000000000..f545489804
--- /dev/null
+++ b/discord4j/src/main/java/com/baeldung/discordbot/events/MessageCreateListener.java
@@ -0,0 +1,19 @@
+package com.baeldung.discordbot.events;
+
+import discord4j.core.event.domain.message.MessageCreateEvent;
+import org.springframework.stereotype.Service;
+import reactor.core.publisher.Mono;
+
+@Service
+public class MessageCreateListener extends MessageListener implements EventListener {
+
+ @Override
+ public Class getEventType() {
+ return MessageCreateEvent.class;
+ }
+
+ @Override
+ public Mono execute(MessageCreateEvent event) {
+ return processCommand(event.getMessage());
+ }
+}
diff --git a/discord4j/src/main/java/com/baeldung/discordbot/events/MessageListener.java b/discord4j/src/main/java/com/baeldung/discordbot/events/MessageListener.java
new file mode 100644
index 0000000000..e1f48468be
--- /dev/null
+++ b/discord4j/src/main/java/com/baeldung/discordbot/events/MessageListener.java
@@ -0,0 +1,19 @@
+package com.baeldung.discordbot.events;
+
+import discord4j.core.object.entity.Message;
+import reactor.core.publisher.Mono;
+
+public abstract class MessageListener {
+
+ public Mono processCommand(Message eventMessage) {
+ return Mono.just(eventMessage)
+ .filter(message -> message.getAuthor().map(user -> !user.isBot()).orElse(false))
+ .filter(message -> message.getContent().equalsIgnoreCase("!todo"))
+ .flatMap(Message::getChannel)
+ .flatMap(channel -> channel.createMessage("Things to do today:\n" +
+ " - write a bot\n" +
+ " - eat lunch\n" +
+ " - play a game"))
+ .then();
+ }
+}
diff --git a/discord4j/src/main/java/com/baeldung/discordbot/events/MessageUpdateListener.java b/discord4j/src/main/java/com/baeldung/discordbot/events/MessageUpdateListener.java
new file mode 100644
index 0000000000..62802d4903
--- /dev/null
+++ b/discord4j/src/main/java/com/baeldung/discordbot/events/MessageUpdateListener.java
@@ -0,0 +1,22 @@
+package com.baeldung.discordbot.events;
+
+import discord4j.core.event.domain.message.MessageUpdateEvent;
+import org.springframework.stereotype.Service;
+import reactor.core.publisher.Mono;
+
+@Service
+public class MessageUpdateListener extends MessageListener implements EventListener {
+
+ @Override
+ public Class getEventType() {
+ return MessageUpdateEvent.class;
+ }
+
+ @Override
+ public Mono execute(MessageUpdateEvent event) {
+ return Mono.just(event)
+ .filter(MessageUpdateEvent::isContentChanged)
+ .flatMap(MessageUpdateEvent::getMessage)
+ .flatMap(super::processCommand);
+ }
+}
diff --git a/discord4j/src/main/resources/application.yml b/discord4j/src/main/resources/application.yml
new file mode 100644
index 0000000000..e2079e33b4
--- /dev/null
+++ b/discord4j/src/main/resources/application.yml
@@ -0,0 +1 @@
+token: 'our-token-here'
diff --git a/discord4j/src/test/java/com/baeldung/discordbot/DiscordBotLiveTest.java b/discord4j/src/test/java/com/baeldung/discordbot/DiscordBotLiveTest.java
new file mode 100644
index 0000000000..8d9a285748
--- /dev/null
+++ b/discord4j/src/test/java/com/baeldung/discordbot/DiscordBotLiveTest.java
@@ -0,0 +1,12 @@
+package com.baeldung.discordbot;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class DiscordBotLiveTest {
+
+ @Test
+ public void contextTest() {
+ }
+}
diff --git a/docker/README.md b/docker/README.md
index 8e5cc2b621..7948b3d663 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,4 +1,3 @@
## Relevant Articles:
- [Introduction to Docker Compose](https://www.baeldung.com/docker-compose)
-- [Creating Docker Images with Spring Boot](https://www.baeldung.com/spring-boot-docker-images)
diff --git a/docker/docker-internal-dto/pom.xml b/docker/docker-internal-dto/pom.xml
new file mode 100644
index 0000000000..55cef257fe
--- /dev/null
+++ b/docker/docker-internal-dto/pom.xml
@@ -0,0 +1,15 @@
+
+
+ 4.0.0
+
+ com.baeldung.docker
+ docker
+ 0.0.1
+
+
+ docker-internal-dto
+ docker-internal-dto
+
+
diff --git a/docker/docker-internal-dto/src/main/java/com/baeldung/docker/dto/VariableDto.java b/docker/docker-internal-dto/src/main/java/com/baeldung/docker/dto/VariableDto.java
new file mode 100644
index 0000000000..2de3b734ea
--- /dev/null
+++ b/docker/docker-internal-dto/src/main/java/com/baeldung/docker/dto/VariableDto.java
@@ -0,0 +1,14 @@
+package com.baeldung.docker.dto;
+
+public class VariableDto {
+
+ private final String value;
+
+ public VariableDto(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/docker/docker-spring-boot/README.md b/docker/docker-spring-boot/README.md
new file mode 100644
index 0000000000..4af9378290
--- /dev/null
+++ b/docker/docker-spring-boot/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+
+- [Creating Docker Images with Spring Boot](https://www.baeldung.com/spring-boot-docker-images)
diff --git a/docker/docker-spring-boot/pom.xml b/docker/docker-spring-boot/pom.xml
index b9c80bc43a..74bd1561cf 100644
--- a/docker/docker-spring-boot/pom.xml
+++ b/docker/docker-spring-boot/pom.xml
@@ -1,21 +1,21 @@
-
+
4.0.0
- org.springframework.boot
- spring-boot-starter-parent
- 2.3.1.RELEASE
-
+ com.baeldung.docker
+ docker
+ 0.0.1
- com.baeldung.docker
- spring-boot-docker
- 0.0.1-SNAPSHOT
- spring-boot-docker
+
+ docker-spring-boot
+
+ docker-spring-boot
Demo project showing Spring Boot and Docker
- 8
+ 11
@@ -24,6 +24,12 @@
spring-boot-starter-web
+
+ com.baeldung.docker
+ docker-internal-dto
+ 0.0.1
+
+
org.springframework.boot
spring-boot-starter-test
@@ -45,6 +51,7 @@
true
+ ${project.basedir}/src/layers.xml
diff --git a/docker/docker-spring-boot/src/layers.xml b/docker/docker-spring-boot/src/layers.xml
new file mode 100644
index 0000000000..61c9bd9c39
--- /dev/null
+++ b/docker/docker-spring-boot/src/layers.xml
@@ -0,0 +1,27 @@
+
+
+
+ org/springframework/boot/loader/**
+
+
+
+
+
+ *:*:*SNAPSHOT
+
+
+ com.baeldung.docker:*:*
+
+
+
+
+ dependencies
+ spring-boot-loader
+ internal-dependencies
+ snapshot-dependencies
+ application
+
+
\ No newline at end of file
diff --git a/docker/docker-spring-boot/src/main/docker/Dockerfile b/docker/docker-spring-boot/src/main/docker/Dockerfile
index fa147dd69b..c0fd9c9cdb 100644
--- a/docker/docker-spring-boot/src/main/docker/Dockerfile
+++ b/docker/docker-spring-boot/src/main/docker/Dockerfile
@@ -9,7 +9,8 @@ RUN java -Djarmode=layertools -jar application.jar extract
FROM adoptopenjdk:11-jre-hotspot
COPY --from=builder dependencies/ ./
-COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
+COPY --from=builder internal-dependencies/ ./
+COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder application/ ./
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
\ No newline at end of file
diff --git a/docker/docker-spring-boot/src/main/java/com/baeldung/docker/DemoApplication.java b/docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/DemoApplication.java
similarity index 88%
rename from docker/docker-spring-boot/src/main/java/com/baeldung/docker/DemoApplication.java
rename to docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/DemoApplication.java
index e0c1d57e89..9210cabbb3 100644
--- a/docker/docker-spring-boot/src/main/java/com/baeldung/docker/DemoApplication.java
+++ b/docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/DemoApplication.java
@@ -1,4 +1,4 @@
-package com.baeldung.docker;
+package com.baeldung.docker.spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/docker/docker-spring-boot/src/main/java/com/baeldung/docker/HelloController.java b/docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/HelloController.java
similarity index 90%
rename from docker/docker-spring-boot/src/main/java/com/baeldung/docker/HelloController.java
rename to docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/HelloController.java
index b463bb557f..430a158011 100644
--- a/docker/docker-spring-boot/src/main/java/com/baeldung/docker/HelloController.java
+++ b/docker/docker-spring-boot/src/main/java/com/baeldung/docker/spring/HelloController.java
@@ -1,4 +1,4 @@
-package com.baeldung.docker;
+package com.baeldung.docker.spring;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/docker/pom.xml b/docker/pom.xml
new file mode 100644
index 0000000000..f05c303938
--- /dev/null
+++ b/docker/pom.xml
@@ -0,0 +1,30 @@
+
+
+ 4.0.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.3.1.RELEASE
+
+
+
+ com.baeldung.docker
+ docker
+ 0.0.1
+ docker
+ Demo project showing Spring Boot and Docker
+ pom
+
+
+ 11
+
+
+
+ docker-internal-dto
+ docker-spring-boot
+
+
+
diff --git a/feign/pom.xml b/feign/pom.xml
index 4b994be1f2..da3cbcb0fd 100644
--- a/feign/pom.xml
+++ b/feign/pom.xml
@@ -16,11 +16,6 @@
-
- io.github.openfeign
- feign-core
- ${feign.version}
-
io.github.openfeign
feign-okhttp
@@ -44,21 +39,8 @@
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- ${spring-boot-maven-plugin.version}
-
-
-
-
-
- 9.4.0
- 1.4.2.RELEASE
+ 10.11
diff --git a/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java b/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java
index bee440bd9e..6f6666de32 100644
--- a/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java
+++ b/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java
@@ -6,8 +6,6 @@ import com.baeldung.feign.models.BookResource;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import java.util.List;
import java.util.UUID;
@@ -22,7 +20,6 @@ import static org.junit.Assert.assertTrue;
* Consumes https://github.com/Baeldung/spring-hypermedia-api
*/
@Slf4j
-@RunWith(JUnit4.class)
public class BookClientLiveTest {
private BookClient bookClient;
diff --git a/gradle/README.md b/gradle/README.md
index 84a8508e2c..cf002a7114 100644
--- a/gradle/README.md
+++ b/gradle/README.md
@@ -8,3 +8,4 @@ This module contains articles about Gradle
- [Creating a Fat Jar in Gradle](https://www.baeldung.com/gradle-fat-jar)
- [A Custom Task in Gradle](https://www.baeldung.com/gradle-custom-task)
- [Using JUnit 5 with Gradle](https://www.baeldung.com/junit-5-gradle)
+- [Dependency Management in Gradle](https://www.baeldung.com/gradle-dependency-management)
diff --git a/gradle/gradle-dependency-management/build.gradle b/gradle/gradle-dependency-management/build.gradle
new file mode 100644
index 0000000000..88ed84f4b1
--- /dev/null
+++ b/gradle/gradle-dependency-management/build.gradle
@@ -0,0 +1,32 @@
+plugins {
+ id 'java'
+ id 'org.springframework.boot' version '2.3.4.RELEASE'
+}
+
+group = 'com.gradle'
+version = '1.0.0'
+sourceCompatibility = '14'
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation 'org.springframework.boot:spring-boot-starter:2.3.4.RELEASE'
+
+ testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.4.RELEASE'
+
+ compileOnly 'org.projectlombok:lombok:1.18.14'
+
+ testCompileOnly 'org.projectlombok:lombok:1.18.14'
+
+ runtimeOnly files('libs/sampleOne.jar', 'libs/sampleTwo.jar')
+
+ runtimeOnly fileTree('libs') { include '*.jar' }
+
+// implementation gradleApi()
+}
+
+test {
+ useJUnitPlatform()
+}
diff --git a/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.properties b/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..12d38de6a4
--- /dev/null
+++ b/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradle/gradle-dependency-management/settings.gradle b/gradle/gradle-dependency-management/settings.gradle
new file mode 100644
index 0000000000..09bfe08af7
--- /dev/null
+++ b/gradle/gradle-dependency-management/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'dependencymanagement'
diff --git a/gradle/gradle-dependency-management/src/main/java/com/gradle/dependencymanagement/DependencyManagementApplication.java b/gradle/gradle-dependency-management/src/main/java/com/gradle/dependencymanagement/DependencyManagementApplication.java
new file mode 100644
index 0000000000..7e589c0477
--- /dev/null
+++ b/gradle/gradle-dependency-management/src/main/java/com/gradle/dependencymanagement/DependencyManagementApplication.java
@@ -0,0 +1,13 @@
+package com.gradle.dependencymanagement;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class DependencyManagementApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DependencyManagementApplication.class, args);
+ }
+
+}
diff --git a/gradle/gradle-dependency-management/src/main/resources/application.properties b/gradle/gradle-dependency-management/src/main/resources/application.properties
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/gradle/gradle-dependency-management/src/main/resources/application.properties
@@ -0,0 +1 @@
+
diff --git a/gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationUnitTests.java b/gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationUnitTests.java
new file mode 100644
index 0000000000..85634a052e
--- /dev/null
+++ b/gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationUnitTests.java
@@ -0,0 +1,13 @@
+package com.gradle.dependencymanagement;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class DependencyManagementApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/gradle/gradle-wrapper/README.md b/gradle/gradle-wrapper/README.md
new file mode 100644
index 0000000000..972ced46c8
--- /dev/null
+++ b/gradle/gradle-wrapper/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+
+- [Guide to the Gradle Wrapper](https://www.baeldung.com/gradle-wrapper)
diff --git a/httpclient-2/README.md b/httpclient-2/README.md
index 52d8b8fcff..9d7a9683cd 100644
--- a/httpclient-2/README.md
+++ b/httpclient-2/README.md
@@ -8,5 +8,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
-- [How to Set TLS Version in Apache HttpClient](https://www.baeldung.com/TODO)
+- [How to Set TLS Version in Apache HttpClient](https://www.baeldung.com/apache-httpclient-tls)
+- [Reading an HTTP Response Body as a String in Java](https://www.baeldung.com/java-http-response-body-as-string)
+- [How To Get Cookies From the Apache HttpClient Response](https://www.baeldung.com/java-apache-httpclient-cookies)
- More articles: [[<-- prev]](../httpclient)
diff --git a/httpclient-2/pom.xml b/httpclient-2/pom.xml
index 1a27d9b5fe..7638c692dc 100644
--- a/httpclient-2/pom.xml
+++ b/httpclient-2/pom.xml
@@ -4,6 +4,7 @@
4.0.0
httpclient-2
0.1-SNAPSHOT
+ httpclient-2
com.baeldung
@@ -13,6 +14,7 @@
+
org.apache.httpcomponents
httpclient
@@ -24,6 +26,19 @@
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ ${spring-boot.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ ${spring-boot.version}
+ test
+
@@ -34,10 +49,24 @@
true
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ ${maven.compiler.source.version}
+ ${maven.compiler.target.version}
+
+
+
4.5.8
+ 11
+ 11
+ 2.1.7.RELEASE
\ No newline at end of file
diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/cookies/HttpClientGettingCookieValueUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/cookies/HttpClientGettingCookieValueUnitTest.java
new file mode 100644
index 0000000000..404acb3098
--- /dev/null
+++ b/httpclient-2/src/test/java/com/baeldung/httpclient/cookies/HttpClientGettingCookieValueUnitTest.java
@@ -0,0 +1,56 @@
+package com.baeldung.httpclient.cookies;
+
+import org.apache.http.client.CookieStore;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.protocol.HttpClientContext;
+import org.apache.http.cookie.ClientCookie;
+import org.apache.http.cookie.Cookie;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.cookie.BasicClientCookie;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+
+public class HttpClientGettingCookieValueUnitTest {
+ private static Logger log = LoggerFactory.getLogger(HttpClientGettingCookieValueUnitTest.class);
+
+ private static final String SAMPLE_URL = "http://www.baeldung.com/";
+
+ @Test
+ public final void whenSettingCustomCookieOnTheRequest_thenGettingTheSameCookieFromTheResponse() throws IOException {
+ HttpClientContext context = HttpClientContext.create();
+ context.setAttribute(HttpClientContext.COOKIE_STORE, createCustomCookieStore());
+
+ try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
+ try (CloseableHttpResponse response = httpClient.execute(new HttpGet(SAMPLE_URL), context)) {
+ CookieStore cookieStore = context.getCookieStore();
+ Cookie customCookie = cookieStore.getCookies()
+ .stream()
+ .peek(cookie -> log.info("cookie name:{}", cookie.getName()))
+ .filter(cookie -> "custom_cookie".equals(cookie.getName()))
+ .findFirst()
+ .orElseThrow(IllegalStateException::new);
+
+ assertEquals("test_value", customCookie.getValue());
+ }
+ }
+ }
+
+ private BasicCookieStore createCustomCookieStore() {
+ BasicCookieStore cookieStore = new BasicCookieStore();
+ BasicClientCookie cookie = new BasicClientCookie("custom_cookie", "test_value");
+ cookie.setDomain("baeldung.com");
+ cookie.setAttribute(ClientCookie.DOMAIN_ATTR, "true");
+ cookie.setPath("/");
+ cookieStore.addCookie(cookie);
+ return cookieStore;
+ }
+}
diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/ApacheHttpClientUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/ApacheHttpClientUnitTest.java
new file mode 100644
index 0000000000..5a638b2bd5
--- /dev/null
+++ b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/ApacheHttpClientUnitTest.java
@@ -0,0 +1,26 @@
+package com.baeldung.httpclient.readresponsebodystring;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class ApacheHttpClientUnitTest {
+ public static final String DUMMY_URL = "https://postman-echo.com/get";
+
+ @Test
+ public void whenUseApacheHttpClient_thenCorrect() throws IOException {
+ HttpGet request = new HttpGet(DUMMY_URL);
+
+ try (CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpResponse response = client.execute(request)) {
+ HttpEntity entity = response.getEntity();
+ String result = EntityUtils.toString(entity);
+ System.out.println("Response -> " + result);
+ }
+ }
+}
diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpClientUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpClientUnitTest.java
new file mode 100644
index 0000000000..1dca1bf7c6
--- /dev/null
+++ b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpClientUnitTest.java
@@ -0,0 +1,29 @@
+package com.baeldung.httpclient.readresponsebodystring;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+
+public class HttpClientUnitTest {
+ public static final String DUMMY_URL = "https://postman-echo.com/get";
+
+ @Test
+ public void whenUseHttpClient_thenCorrect() throws IOException, InterruptedException {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest.newBuilder().uri(URI.create(DUMMY_URL)).build();
+
+ // synchronous response
+ HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
+ System.out.println(response.body());
+
+ // asynchronous response
+ client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
+ .thenApply(HttpResponse::body)
+ .thenAccept(System.out::println)
+ .join();
+ }
+}
diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpUrlConnectionUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpUrlConnectionUnitTest.java
new file mode 100644
index 0000000000..54ae887eb4
--- /dev/null
+++ b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpUrlConnectionUnitTest.java
@@ -0,0 +1,34 @@
+package com.baeldung.httpclient.readresponsebodystring;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+public class HttpUrlConnectionUnitTest {
+
+ public static final String DUMMY_URL = "https://postman-echo.com/get";
+
+ @Test
+ public void whenUseHttpUrlConnection_thenCorrect() throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) new URL(DUMMY_URL).openConnection();
+
+ InputStream inputStream = connection.getInputStream();
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
+ StringBuilder response = new StringBuilder();
+ String currentLine;
+
+ while ((currentLine = in.readLine()) != null)
+ response.append(currentLine);
+
+ in.close();
+ Assert.assertNotNull(response.toString());
+ System.out.println("Response -> " + response.toString());
+ }
+}
diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/SpringRestTemplateUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/SpringRestTemplateUnitTest.java
new file mode 100644
index 0000000000..c59d7662f1
--- /dev/null
+++ b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/SpringRestTemplateUnitTest.java
@@ -0,0 +1,17 @@
+package com.baeldung.httpclient.readresponsebodystring;
+
+import org.junit.Test;
+import org.springframework.web.client.RestTemplate;
+
+public class SpringRestTemplateUnitTest {
+
+ public static final String DUMMY_URL = "https://postman-echo.com/get";
+
+ @Test
+ public void whenUseRestTemplate_thenCorrect() {
+ RestTemplate restTemplate = new RestTemplate();
+ String response = restTemplate.getForObject(DUMMY_URL, String.class);
+ System.out.println(response);
+ }
+
+}
diff --git a/httpclient-simple/pom.xml b/httpclient-simple/pom.xml
index 4b97070307..019f1af856 100644
--- a/httpclient-simple/pom.xml
+++ b/httpclient-simple/pom.xml
@@ -302,7 +302,7 @@
2.5.1
4.4.11
- 4.5.8
+ 4.5.8
1.6.1
diff --git a/httpclient-simple/src/test/java/com/baeldung/httpclient/sec/HttpClientCookieLiveTest.java b/httpclient-simple/src/test/java/com/baeldung/httpclient/sec/HttpClientCookieLiveTest.java
index 287b6e996c..75286e5b2e 100644
--- a/httpclient-simple/src/test/java/com/baeldung/httpclient/sec/HttpClientCookieLiveTest.java
+++ b/httpclient-simple/src/test/java/com/baeldung/httpclient/sec/HttpClientCookieLiveTest.java
@@ -1,19 +1,23 @@
package com.baeldung.httpclient.sec;
-import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.HttpClientContext;
+import org.apache.http.cookie.ClientCookie;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.cookie.BasicClientCookie;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import com.baeldung.httpclient.ResponseUtil;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
@@ -25,6 +29,8 @@ public class HttpClientCookieLiveTest {
private CloseableHttpClient instance;
private CloseableHttpResponse response;
+
+ private static Logger log = LoggerFactory.getLogger(HttpClientCookieLiveTest.class);
@Before
public final void before() {
@@ -54,11 +60,15 @@ public class HttpClientCookieLiveTest {
final BasicCookieStore cookieStore = new BasicCookieStore();
final BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", "1234");
cookie.setDomain(".github.com");
+ cookie.setAttribute(ClientCookie.DOMAIN_ATTR, "true");
+
cookie.setPath("/");
cookieStore.addCookie(cookie);
- final HttpClient client = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build();
-
- final HttpGet request = new HttpGet("http://www.github.com");
+
+ DefaultHttpClient client = new DefaultHttpClient();
+ client.setCookieStore(cookieStore);
+
+ final HttpGet request = new HttpGet("https://www.github.com");
response = (CloseableHttpResponse) client.execute(request);
@@ -70,6 +80,7 @@ public class HttpClientCookieLiveTest {
final BasicCookieStore cookieStore = new BasicCookieStore();
final BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", "1234");
cookie.setDomain(".github.com");
+ cookie.setAttribute(ClientCookie.DOMAIN_ATTR, "true");
cookie.setPath("/");
cookieStore.addCookie(cookie);
instance = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build();
diff --git a/jackson-modules/jackson-custom-conversions/pom.xml b/jackson-modules/jackson-custom-conversions/pom.xml
index c319891da9..f58b25781c 100644
--- a/jackson-modules/jackson-custom-conversions/pom.xml
+++ b/jackson-modules/jackson-custom-conversions/pom.xml
@@ -23,6 +23,13 @@
jackson-datatype-joda
${jackson.version}
+
+ com.fasterxml.jackson.core
+ jackson-core
+ ${jackson.version}
+
+
+
diff --git a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java
index f2a2502c3e..17016149a2 100644
--- a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java
+++ b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java
@@ -60,8 +60,6 @@ public class CustomDeserializationUnitTest {
String converted = objectMapper.writeValueAsString(now);
// restore an instance of ZonedDateTime from String
ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class);
- System.out.println("serialized: " + now);
- System.out.println("restored: " + restored);
assertThat(now, is(not(restored)));
}
@@ -70,15 +68,14 @@ public class CustomDeserializationUnitTest {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.findAndRegisterModules();
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+ objectMapper.enable(SerializationFeature.WRITE_DATES_WITH_ZONE_ID);
objectMapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE);
// construct a new instance of ZonedDateTime
ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Europe/Berlin"));
String converted = objectMapper.writeValueAsString(now);
// restore an instance of ZonedDateTime from String
ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class);
- System.out.println("serialized: " + now);
- System.out.println("restored: " + restored);
- assertThat(now, is(restored));
+ assertThat(restored, is(now));
}
}
diff --git a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java
index 6cb4019fa2..9c46a86fd8 100644
--- a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java
+++ b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java
@@ -24,7 +24,6 @@ public class CustomSerializationUnitTest {
public final void whenSerializing_thenNoExceptions() throws JsonGenerationException, JsonMappingException, IOException {
final Item myItem = new Item(1, "theItem", new User(2, "theUser"));
final String serialized = new ObjectMapper().writeValueAsString(myItem);
- System.out.println(serialized);
}
@Test
@@ -38,7 +37,6 @@ public class CustomSerializationUnitTest {
mapper.registerModule(simpleModule);
final String serialized = mapper.writeValueAsString(myItem);
- System.out.println(serialized);
}
@Test
@@ -46,7 +44,6 @@ public class CustomSerializationUnitTest {
final ItemWithSerializer myItem = new ItemWithSerializer(1, "theItem", new User(2, "theUser"));
final String serialized = new ObjectMapper().writeValueAsString(myItem);
- System.out.println(serialized);
}
}
diff --git a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java
index e71f31bc6a..ec753019b2 100644
--- a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java
+++ b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java
@@ -37,7 +37,6 @@ public class IgnoreFieldsWithFilterUnitTest {
assertThat(dtoAsString, not(containsString("intValue")));
assertThat(dtoAsString, containsString("booleanValue"));
assertThat(dtoAsString, containsString("stringValue"));
- System.out.println(dtoAsString);
}
@Test
@@ -83,7 +82,6 @@ public class IgnoreFieldsWithFilterUnitTest {
assertThat(dtoAsString, not(containsString("intValue")));
assertThat(dtoAsString, containsString("booleanValue"));
assertThat(dtoAsString, containsString("stringValue"));
- System.out.println(dtoAsString);
}
}
diff --git a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java
index 6ba14f7476..2fd59e2a82 100644
--- a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java
+++ b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java
@@ -51,8 +51,6 @@ public class JacksonDynamicIgnoreUnitTest {
assertTrue(result.contains("john"));
assertTrue(result.contains("address"));
assertTrue(result.contains("usa"));
-
- System.out.println("Not Hidden = " + result);
}
@Test
@@ -65,8 +63,6 @@ public class JacksonDynamicIgnoreUnitTest {
assertTrue(result.contains("john"));
assertFalse(result.contains("address"));
assertFalse(result.contains("usa"));
-
- System.out.println("Address Hidden = " + result);
}
@Test
@@ -76,8 +72,6 @@ public class JacksonDynamicIgnoreUnitTest {
final String result = mapper.writeValueAsString(person);
assertTrue(result.length() == 0);
-
- System.out.println("All Hidden = " + result);
}
@Test
@@ -90,7 +84,5 @@ public class JacksonDynamicIgnoreUnitTest {
final Person p3 = new Person("adam", ad3, false);
final String result = mapper.writeValueAsString(Arrays.asList(p1, p2, p3));
-
- System.out.println(result);
}
}
diff --git a/java-native/README.md b/java-native/README.md
new file mode 100644
index 0000000000..4f85342a38
--- /dev/null
+++ b/java-native/README.md
@@ -0,0 +1,9 @@
+## JNI
+
+This module contains articles about the Java Native Interface (JNI).
+
+### Relevant Articles:
+
+- [Guide to JNI (Java Native Interface)](https://www.baeldung.com/jni)
+- [Using JNA to Access Native Dynamic Libraries](https://www.baeldung.com/java-jna-dynamic-libraries)
+- [Check if a Java Program Is Running in 64-Bit or 32-Bit JVM](https://www.baeldung.com/java-detect-jvm-64-or-32-bit)
diff --git a/java-native/pom.xml b/java-native/pom.xml
new file mode 100644
index 0000000000..29fc13b8d8
--- /dev/null
+++ b/java-native/pom.xml
@@ -0,0 +1,39 @@
+
+
+ 4.0.0
+ java-native
+ java-native
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
+
+
+ 5.6.0
+
+
+
+
+ net.java.dev.jna
+ jna-platform
+ ${jna.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp
similarity index 100%
rename from jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp
rename to java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp
diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h b/java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h
similarity index 100%
rename from jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h
rename to java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h
diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp
similarity index 100%
rename from jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp
rename to java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp
diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h b/java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h
similarity index 100%
rename from jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h
rename to java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h
diff --git a/jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp
similarity index 100%
rename from jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp
rename to java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp
diff --git a/jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h b/java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h
similarity index 100%
rename from jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h
rename to java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h
diff --git a/jni/src/main/cpp/generateNativeLib.bat b/java-native/src/main/cpp/generateNativeLib.bat
similarity index 100%
rename from jni/src/main/cpp/generateNativeLib.bat
rename to java-native/src/main/cpp/generateNativeLib.bat
diff --git a/jni/src/main/cpp/generateNativeLib.sh b/java-native/src/main/cpp/generateNativeLib.sh
old mode 100755
new mode 100644
similarity index 100%
rename from jni/src/main/cpp/generateNativeLib.sh
rename to java-native/src/main/cpp/generateNativeLib.sh
diff --git a/jni/src/main/cpp/generateNativeLibMac.sh b/java-native/src/main/cpp/generateNativeLibMac.sh
old mode 100755
new mode 100644
similarity index 100%
rename from jni/src/main/cpp/generateNativeLibMac.sh
rename to java-native/src/main/cpp/generateNativeLibMac.sh
diff --git a/java-native/src/main/java/com/baeldung/jna/CMath.java b/java-native/src/main/java/com/baeldung/jna/CMath.java
new file mode 100644
index 0000000000..3ab5bdf48b
--- /dev/null
+++ b/java-native/src/main/java/com/baeldung/jna/CMath.java
@@ -0,0 +1,10 @@
+package com.baeldung.jna;
+
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import com.sun.jna.Platform;
+
+public interface CMath extends Library {
+ CMath INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c", CMath.class);
+ double cosh(double value);
+}
diff --git a/java-native/src/main/java/com/baeldung/jna/Main.java b/java-native/src/main/java/com/baeldung/jna/Main.java
new file mode 100644
index 0000000000..a81c878cde
--- /dev/null
+++ b/java-native/src/main/java/com/baeldung/jna/Main.java
@@ -0,0 +1,8 @@
+package com.baeldung.jna;
+
+public class Main {
+
+ public static void main(String[] args) {
+
+ }
+}
\ No newline at end of file
diff --git a/java-native/src/main/java/com/baeldung/jna/NativeFS.java b/java-native/src/main/java/com/baeldung/jna/NativeFS.java
new file mode 100644
index 0000000000..58f2bda035
--- /dev/null
+++ b/java-native/src/main/java/com/baeldung/jna/NativeFS.java
@@ -0,0 +1,46 @@
+package com.baeldung.jna;
+
+import java.util.Collections;
+import java.util.Map;
+
+import com.sun.jna.FunctionMapper;
+import com.sun.jna.LastErrorException;
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import com.sun.jna.NativeLong;
+import com.sun.jna.Platform;
+import com.sun.jna.Structure;
+import com.sun.jna.Structure.FieldOrder;
+
+public interface NativeFS extends Library {
+
+ FunctionMapper mapper = (library,method) -> {
+ if (Platform.isWindows()) {
+ return "_" + method.getName();
+ }
+ else {
+ return "__x" + method.getName(); // On Linux, stat is actually _xstat
+ }
+ };
+
+ public NativeFS INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c",
+ NativeFS.class,
+ Collections.singletonMap(Library.OPTION_FUNCTION_MAPPER, mapper));
+
+ int stat(String path, Stat stat) throws LastErrorException;
+
+ @FieldOrder({"st_dev","st_ino","st_mode","st_nlink","st_uid","st_gid","st_rdev","st_size","st_atime","st_mtime","st_ctime"})
+ public class Stat extends Structure {
+ public int st_dev;
+ public int st_ino;
+ public short st_mode;
+ public short st_nlink;
+ public short st_uid;
+ public short st_gid;
+ public int st_rdev;
+ public NativeLong st_size;
+ public NativeLong st_atime;
+ public NativeLong st_mtime;
+ public NativeLong st_ctime;
+ }
+}
diff --git a/java-native/src/main/java/com/baeldung/jna/StdC.java b/java-native/src/main/java/com/baeldung/jna/StdC.java
new file mode 100644
index 0000000000..1adbe684c4
--- /dev/null
+++ b/java-native/src/main/java/com/baeldung/jna/StdC.java
@@ -0,0 +1,17 @@
+package com.baeldung.jna;
+
+import com.sun.jna.LastErrorException;
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import com.sun.jna.Platform;
+import com.sun.jna.Pointer;
+
+public interface StdC extends Library {
+ StdC INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c", StdC.class );
+ Pointer malloc(long n);
+ void free(Pointer p);
+ Pointer memset(Pointer p, int c, long n);
+ int open(String path, int flags) throws LastErrorException;
+ int close(int fd) throws LastErrorException;
+}
+
diff --git a/jni/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java b/java-native/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java
similarity index 100%
rename from jni/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java
rename to java-native/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java
diff --git a/jni/src/main/java/com/baeldung/jni/ExampleParametersJNI.java b/java-native/src/main/java/com/baeldung/jni/ExampleParametersJNI.java
similarity index 100%
rename from jni/src/main/java/com/baeldung/jni/ExampleParametersJNI.java
rename to java-native/src/main/java/com/baeldung/jni/ExampleParametersJNI.java
diff --git a/jni/src/main/java/com/baeldung/jni/HelloWorldJNI.java b/java-native/src/main/java/com/baeldung/jni/HelloWorldJNI.java
similarity index 100%
rename from jni/src/main/java/com/baeldung/jni/HelloWorldJNI.java
rename to java-native/src/main/java/com/baeldung/jni/HelloWorldJNI.java
diff --git a/jni/src/main/java/com/baeldung/jni/UserData.java b/java-native/src/main/java/com/baeldung/jni/UserData.java
similarity index 100%
rename from jni/src/main/java/com/baeldung/jni/UserData.java
rename to java-native/src/main/java/com/baeldung/jni/UserData.java
diff --git a/java-native/src/main/java/com/baeldung/jvmbitversion/JVMBitVersion.java b/java-native/src/main/java/com/baeldung/jvmbitversion/JVMBitVersion.java
new file mode 100644
index 0000000000..63684fec49
--- /dev/null
+++ b/java-native/src/main/java/com/baeldung/jvmbitversion/JVMBitVersion.java
@@ -0,0 +1,24 @@
+package com.baeldung.jvmbitversion;
+
+import com.sun.jna.Platform;
+
+public class JVMBitVersion {
+
+ public String getUsingSystemClass() {
+ return System.getProperty("sun.arch.data.model") + "-bit";
+ }
+
+ public String getUsingNativeClass() {
+ if (com.sun.jna.Native.POINTER_SIZE == 8) {
+ return "64-bit";
+ } else if (com.sun.jna.Native.POINTER_SIZE == 4) {
+ return "32-bit";
+ } else
+ return "unknown";
+ }
+
+ public boolean getUsingPlatformClass() {
+ return (Platform.is64Bit());
+ }
+
+}
diff --git a/jni/src/main/resources/logback.xml b/java-native/src/main/resources/logback.xml
similarity index 100%
rename from jni/src/main/resources/logback.xml
rename to java-native/src/main/resources/logback.xml
diff --git a/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java b/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java
new file mode 100644
index 0000000000..a9cc6ed1c4
--- /dev/null
+++ b/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java
@@ -0,0 +1,18 @@
+package com.baeldung.jna;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+import com.sun.jna.Native;
+import com.sun.jna.Platform;
+
+class CMathUnitTest {
+ @Test
+ void whenCallNative_thenSuccess() {
+ CMath lib = Native.load(Platform.isWindows() ? "msvcrt" : "c", CMath.class);
+ double result = lib.cosh(0);
+ assertEquals(1.0,result);
+ }
+
+}
diff --git a/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java b/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java
new file mode 100644
index 0000000000..d296f9e2ca
--- /dev/null
+++ b/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java
@@ -0,0 +1,38 @@
+package com.baeldung.jna;
+
+import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+
+import org.junit.jupiter.api.Test;
+
+import com.baeldung.jna.NativeFS.Stat;
+import com.sun.jna.LastErrorException;
+import com.sun.jna.Platform;
+
+public class NativeFSUnitTest {
+
+
+ @Test
+ public void whenCallNative_thenSuccess() throws IOException {
+ NativeFS lib = NativeFS.INSTANCE;
+
+ File f = Files.createTempFile("junit", ".bin").toFile();
+ f.deleteOnExit();
+ Stat stat = new Stat();
+ try {
+ if (Platform.isWindows()) {
+ int rc = lib.stat(f.getAbsolutePath(), stat);
+ assertEquals(0, rc);
+ assertEquals(0,stat.st_size.longValue());
+ }
+ }
+ catch(LastErrorException error) {
+ fail("stat failed: error code=" + error.getErrorCode());
+ }
+
+ }
+}
diff --git a/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java b/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java
new file mode 100644
index 0000000000..c536fd63d5
--- /dev/null
+++ b/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java
@@ -0,0 +1,47 @@
+package com.baeldung.jna;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.BeforeClass;
+import org.junit.jupiter.api.Test;
+
+import com.sun.jna.Native;
+import com.sun.jna.Platform;
+import com.sun.jna.Pointer;
+
+class StdCUnitTest {
+
+ @BeforeClass
+ public static void setupProtectedMode() {
+ Native.setProtected(true);
+ }
+
+ @Test
+ public void whenMalloc_thenSuccess() {
+ StdC lib = StdC.INSTANCE;
+ Pointer p = lib.malloc(1024);
+ p.setMemory(0l, 1024l, (byte) 0);
+ lib.free(p);
+ }
+
+ @Test
+ public void whenAccessViolation_thenShouldThrowError() {
+ // Running this test on Linux requires additional setup using libjsig.so
+ // Details here: http://java-native-access.github.io/jna/5.6.0/javadoc/overview-summary.html#crash-protection
+ // IMPORTANT NOTICE: Code for illustration purposes only. DON'T DO THIS IN YOUR OWN CODE
+ if ( Platform.isWindows()) {
+ Error e = null;
+ Pointer p = new Pointer(0l);
+
+ try {
+ p.setMemory(0, 100*1024, (byte) 0);
+ }
+ catch(Error err) {
+ e = err;
+ }
+
+ assertNotNull(e, "Should throw Error");
+ }
+ }
+
+}
diff --git a/jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java b/java-native/src/test/java/com/baeldung/jni/JNINativeManualTest.java
similarity index 100%
rename from jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java
rename to java-native/src/test/java/com/baeldung/jni/JNINativeManualTest.java
diff --git a/java-native/src/test/java/com/baeldung/jvmbitversion/JVMBitVersionUnitTest.java b/java-native/src/test/java/com/baeldung/jvmbitversion/JVMBitVersionUnitTest.java
new file mode 100644
index 0000000000..152008e5e2
--- /dev/null
+++ b/java-native/src/test/java/com/baeldung/jvmbitversion/JVMBitVersionUnitTest.java
@@ -0,0 +1,46 @@
+package com.baeldung.jvmbitversion;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.baeldung.jvmbitversion.JVMBitVersion;
+import com.sun.jna.Platform;
+
+public class JVMBitVersionUnitTest {
+
+ private JVMBitVersion jvmVersion;
+
+ @Before
+ public void setup() {
+ jvmVersion = new JVMBitVersion();
+ }
+
+ @Test
+ public void whenUsingSystemClass_thenOutputIsAsExpected() {
+ if (System.getProperty("sun.arch.data.model") == "64") {
+ assertEquals("64-bit", jvmVersion.getUsingSystemClass());
+ } else if (System.getProperty("sun.arch.data.model") == "32") {
+ assertEquals("32-bit", jvmVersion.getUsingSystemClass());
+ }
+ }
+
+ @Test
+ public void whenUsingNativeClass_thenResultIsAsExpected() {
+ if (com.sun.jna.Native.POINTER_SIZE == 8) {
+ assertEquals("64-bit", jvmVersion.getUsingNativeClass());
+ } else if (com.sun.jna.Native.POINTER_SIZE == 4) {
+ assertEquals("32-bit", jvmVersion.getUsingNativeClass());
+ }
+ }
+
+ @Test
+ public void whenUsingPlatformClass_thenResultIsAsExpected() {
+ if (Platform.is64Bit() == Boolean.TRUE) {
+ assertEquals(Boolean.TRUE, jvmVersion.getUsingPlatformClass());
+ } else if (com.sun.jna.Native.POINTER_SIZE == 4) {
+ assertEquals(Boolean.FALSE, jvmVersion.getUsingPlatformClass());
+ }
+ }
+}
diff --git a/java-numbers-4/README.md b/java-numbers-4/README.md
index 344d348733..7db25b283c 100644
--- a/java-numbers-4/README.md
+++ b/java-numbers-4/README.md
@@ -1,3 +1,4 @@
### Relevant Articles:
- [Probability in Java](https://www.baeldung.com/java-probability)
+- [Understanding the & 0xff Value in Java](https://www.baeldung.com/java-and-0xff)
diff --git a/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java b/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java
new file mode 100644
index 0000000000..1708afb5a2
--- /dev/null
+++ b/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java
@@ -0,0 +1,20 @@
+package com.baeldung.number_0xff;
+
+public class Number0xff {
+
+ public static int getRedColor(int rgba) {
+ return rgba >> 24 & 0xff;
+ }
+
+ public static int getGreenColor(int rgba) {
+ return rgba >> 16 & 0xff;
+ }
+
+ public static int getBlueColor(int rgba) {
+ return rgba >> 8 & 0xff;
+ }
+
+ public static int getAlfa(int rgba) {
+ return rgba & 0xff;
+ }
+}
diff --git a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java
new file mode 100644
index 0000000000..b0feaf8628
--- /dev/null
+++ b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java
@@ -0,0 +1,49 @@
+package com.baeldung.number_0xff;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class Number0xffUnitTest {
+
+ @Test
+ public void test0xFFAssignedToInteger() {
+ int x = 0xff;
+ int expectedValue = 255;
+ assertEquals(expectedValue, x);
+ }
+
+ @Test
+ public void test0xFFAssignedToByte() {
+ byte y = (byte) 0xff;
+ int expectedValue = -1;
+ assertEquals(expectedValue, y);
+ }
+
+ @Test
+ public void givenColor_whenGetRedColor_thenExtractRedColor() {
+ int rgba = 272214023;
+ int expectedValue = 16;
+ assertEquals(expectedValue, Number0xff.getRedColor(rgba));
+ }
+
+ @Test
+ public void givenColor_whenGetGreenColor_thenExtractGreenColor() {
+ int rgba = 272214023;
+ int expectedValue = 57;
+ assertEquals(expectedValue, Number0xff.getGreenColor(rgba));
+ }
+
+ @Test
+ public void givenColor_whenGetBlueColor_thenExtractBlueColor() {
+ int rgba = 272214023;
+ int expectedValue = 168;
+ assertEquals(expectedValue, Number0xff.getBlueColor(rgba));
+ }
+
+ @Test
+ public void givenColor_whenGetAlfa_thenExtractAlfa() {
+ int rgba = 272214023;
+ int expectedValue = 7;
+ assertEquals(expectedValue, Number0xff.getAlfa(rgba));
+ }
+}
diff --git a/java-numbers/README.md b/java-numbers/README.md
index f4b76c3c98..3007e1746c 100644
--- a/java-numbers/README.md
+++ b/java-numbers/README.md
@@ -3,12 +3,12 @@
This module contains articles about numbers in Java.
### Relevant Articles:
-- [Number of Digits in an Integer in Java](http://www.baeldung.com/java-number-of-digits-in-int)
-- [How to Round a Number to N Decimal Places in Java](http://www.baeldung.com/java-round-decimal-number)
-- [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)
-- [A Practical Guide to DecimalFormat](http://www.baeldung.com/java-decimalformat)
+- [Number of Digits in an Integer in Java](https://www.baeldung.com/java-number-of-digits-in-int)
+- [How to Round a Number to N Decimal Places in Java](https://www.baeldung.com/java-round-decimal-number)
+- [BigDecimal and BigInteger in Java](https://www.baeldung.com/java-bigdecimal-biginteger)
+- [Find All Pairs of Numbers in an Array That Add Up to a Given Sum in Java](https://www.baeldung.com/java-algorithm-number-pairs-sum)
+- [Java – Random Long, Float, Integer and Double](https://www.baeldung.com/java-generate-random-long-float-integer-double)
+- [A Practical Guide to DecimalFormat](https://www.baeldung.com/java-decimalformat)
- [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root)
- [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string)
- [Changing the Order in a Sum Operation Can Produce Different Results?](https://www.baeldung.com/java-floating-point-sum-order)
diff --git a/javafx/src/main/java/com/baeldung/view/SearchController.java b/javafx/src/main/java/com/baeldung/view/SearchController.java
index 430580f8b5..3bde84958c 100644
--- a/javafx/src/main/java/com/baeldung/view/SearchController.java
+++ b/javafx/src/main/java/com/baeldung/view/SearchController.java
@@ -10,6 +10,7 @@ import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.VBox;
+import javafx.scene.control.cell.PropertyValueFactory;
import java.util.stream.Collectors;
@@ -22,11 +23,14 @@ public class SearchController {
@FXML
private Button searchButton;
@FXML
- private Pagination pagination;
- @FXML
private Label searchLabel;
-
+ @FXML
+ private TableView tableView;
+ @FXML
+ private VBox dataContainer;
+
private ObservableList masterData = FXCollections.observableArrayList();
+ private ObservableList results = FXCollections.observableList(masterData);
public SearchController() {
masterData.add(new Person(5, "John", true));
@@ -40,7 +44,7 @@ public class SearchController {
// search panel
searchButton.setText("Search");
searchButton.setOnAction(event -> loadData());
- searchButton.setStyle("-fx-background-color: #457ecd; -fx-text-fill: #ffffff;");
+ searchButton.setStyle("-fx-background-color: slateblue; -fx-text-fill: white;");
searchField.setOnKeyPressed(event -> {
if (event.getCode().equals(KeyCode.ENTER)) {
@@ -52,22 +56,23 @@ public class SearchController {
searchLabel.setText(newValue);
});
- pagination.setPageFactory(SearchController.this::createPage);
+ initTable();
+
}
- private Node createPage(Integer pageIndex) {
+ private void initTable() {
+ tableView = new TableView<>(FXCollections.observableList(masterData));
+ tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
- VBox dataContainer = new VBox();
-
- TableView tableView = new TableView<>(masterData);
TableColumn id = new TableColumn("ID");
+ id.setCellValueFactory(new PropertyValueFactory("id"));
TableColumn name = new TableColumn("NAME");
+ name.setCellValueFactory(new PropertyValueFactory("name"));
TableColumn employed = new TableColumn("EMPLOYED");
-
+ employed.setCellValueFactory(new PropertyValueFactory("isEmployed"));
tableView.getColumns().addAll(id, name, employed);
+
dataContainer.getChildren().add(tableView);
-
- return dataContainer;
}
private void loadData() {
@@ -86,11 +91,10 @@ public class SearchController {
};
task.setOnSucceeded(event -> {
- masterData = task.getValue();
- pagination.setVisible(true);
- pagination.setPageCount(masterData.size() / PAGE_ITEMS_COUNT);
+ results = task.getValue();
+ tableView.setItems(FXCollections.observableList(results));
});
-
+
Thread th = new Thread(task);
th.setDaemon(true);
th.start();
diff --git a/javafx/src/main/resources/SearchController.fxml b/javafx/src/main/resources/SearchController.fxml
index 5e83024d03..b1e11a8864 100644
--- a/javafx/src/main/resources/SearchController.fxml
+++ b/javafx/src/main/resources/SearchController.fxml
@@ -20,14 +20,13 @@
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/javax-servlets/src/main/java/com/baeldung/servlets/UpdateServlet.java b/javax-servlets/src/main/java/com/baeldung/servlets/UpdateServlet.java
index d0404d0cd4..35c9819a6f 100644
--- a/javax-servlets/src/main/java/com/baeldung/servlets/UpdateServlet.java
+++ b/javax-servlets/src/main/java/com/baeldung/servlets/UpdateServlet.java
@@ -1,6 +1,5 @@
package com.baeldung.servlets;
-
import java.io.IOException;
import javax.servlet.RequestDispatcher;
@@ -18,10 +17,14 @@ public class UpdateServlet extends HttpServlet {
HttpSession session = request.getSession(false);
- session.setAttribute("userName", request.getParameter("userName"));
- session.setAttribute("age", request.getParameter("age"));
+ if (session != null) {
+
+ session.setAttribute("userName", request.getParameter("userName"));
+ session.setAttribute("age", request.getParameter("age"));
+
+ request.setAttribute("sessionData", session);
+ }
- request.setAttribute("sessionData", session);
RequestDispatcher requestDispather = request.getRequestDispatcher("update.jsp");
requestDispather.forward(request, response);
diff --git a/jni/README.md b/jni/README.md
deleted file mode 100644
index 6b984e6590..0000000000
--- a/jni/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-## JNI
-
-This module contains articles about the Java Native Interface (JNI).
-
-### Relevant Articles:
-
-- [Guide to JNI (Java Native Interface)](https://www.baeldung.com/jni)
diff --git a/jni/native/linux_x86_64/libnative.so b/jni/native/linux_x86_64/libnative.so
deleted file mode 100755
index 213491e268..0000000000
Binary files a/jni/native/linux_x86_64/libnative.so and /dev/null differ
diff --git a/jni/native/macos/libnative.dylib b/jni/native/macos/libnative.dylib
deleted file mode 100755
index 6d1264d696..0000000000
Binary files a/jni/native/macos/libnative.dylib and /dev/null differ
diff --git a/jni/pom.xml b/jni/pom.xml
deleted file mode 100644
index d64fa12c5a..0000000000
--- a/jni/pom.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- 4.0.0
- jni
- jni
-
-
- com.baeldung
- parent-modules
- 1.0.0-SNAPSHOT
-
-
-
\ No newline at end of file
diff --git a/json-2/pom.xml b/json-2/pom.xml
index c5f11754f4..0bdede3b1a 100644
--- a/json-2/pom.xml
+++ b/json-2/pom.xml
@@ -53,12 +53,12 @@
com.fasterxml.jackson.core
jackson-annotations
- 2.11.0
+ ${jackson.version}
com.fasterxml.jackson.core
jackson-databind
- 2.11.0
+ ${jackson.version}
com.io-informatics.oss
diff --git a/kotlin-js/build.gradle b/kotlin-js/build.gradle
old mode 100755
new mode 100644
index 9efef0f475..ede6f51448
--- a/kotlin-js/build.gradle
+++ b/kotlin-js/build.gradle
@@ -1,27 +1,27 @@
-buildscript {
- ext.kotlin_version = '1.2.41'
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- }
-}
-
-group 'com.baeldung'
-version '1.0-SNAPSHOT'
-apply plugin: 'kotlin2js'
-
-repositories {
- mavenCentral()
-}
-
-dependencies {
- compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
- testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
-}
-
-compileKotlin2Js.kotlinOptions {
- moduleKind = "commonjs"
- outputFile = "node/crypto.js"
-}
+buildscript {
+ ext.kotlin_version = '1.4.10'
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
+group 'com.baeldung'
+version '1.0-SNAPSHOT'
+apply plugin: 'kotlin2js'
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
+ testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
+}
+
+compileKotlin2Js.kotlinOptions {
+ moduleKind = "commonjs"
+ outputFile = "node/crypto.js"
+}
diff --git a/kotlin-js/gradle/wrapper/gradle-wrapper.jar b/kotlin-js/gradle/wrapper/gradle-wrapper.jar
index 01b8bf6b1f..490fda8577 100644
Binary files a/kotlin-js/gradle/wrapper/gradle-wrapper.jar and b/kotlin-js/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/kotlin-js/gradle/wrapper/gradle-wrapper.properties b/kotlin-js/gradle/wrapper/gradle-wrapper.properties
index 933b6473ce..a4b4429748 100644
--- a/kotlin-js/gradle/wrapper/gradle-wrapper.properties
+++ b/kotlin-js/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
diff --git a/kotlin-js/gradlew b/kotlin-js/gradlew
index cccdd3d517..2fe81a7d95 100755
--- a/kotlin-js/gradlew
+++ b/kotlin-js/gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -138,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ i=`expr $i + 1`
done
case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -159,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
-APP_ARGS=$(save "$@")
+APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
exec "$JAVACMD" "$@"
diff --git a/kotlin-js/gradlew.bat b/kotlin-js/gradlew.bat
old mode 100755
new mode 100644
index e95643d6a2..9109989e3c
--- a/kotlin-js/gradlew.bat
+++ b/kotlin-js/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
diff --git a/kotlin-js/package.json b/kotlin-js/package.json
old mode 100755
new mode 100644
index c75313e3ff..915b9d41ea
--- a/kotlin-js/package.json
+++ b/kotlin-js/package.json
@@ -1,17 +1,15 @@
{
- "name": "kotlin-node.js",
+ "name": "kotlin-node",
"version": "1.0.0",
"description": "Example of using NodeJS in Kotlin",
"main": "crypto.js",
- "dependencies": {
- "express": "^4.15.2",
- "fs": "0.0.1-security",
- "kotlin": "^1.1.0",
- "node.js": "0.0.0",
- "request": "^2.85.0"
- },
- "devDependencies": {},
"scripts": {
"start": "node node/crypto.js"
+ },
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "express": "^4.17.1",
+ "kotlin": "^1.4.10"
}
}
diff --git a/kotlin-js/settings.gradle b/kotlin-js/settings.gradle
index 64767a30c5..30c62d39ef 100755
--- a/kotlin-js/settings.gradle
+++ b/kotlin-js/settings.gradle
@@ -1 +1 @@
-rootProject.name = 'KotlinNode'
+rootProject.name = 'kotlin-node'
diff --git a/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java
index e4ac8a3a95..8d4918a3e7 100644
--- a/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java
+++ b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java
@@ -7,22 +7,38 @@ import au.com.dius.pact.consumer.dsl.PactDslWithProvider;
import au.com.dius.pact.model.RequestResponsePact;
import org.junit.Rule;
import org.junit.Test;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
+import java.io.IOException;
+import java.net.ServerSocket;
import java.util.HashMap;
import java.util.Map;
+import java.util.Random;
import static org.assertj.core.api.Assertions.assertThat;
public class PactConsumerDrivenContractUnitTest {
+ private static int getAvailablePort() {
+ return new Random()
+ .ints(6000, 9000)
+ .filter(PactConsumerDrivenContractUnitTest::isFree)
+ .findFirst()
+ .orElse(8080);
+ }
+
+ private static boolean isFree(int port) {
+ try {
+ new ServerSocket(port).close();
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
@Rule
- public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("test_provider", "localhost", 8080, this);
+ public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("test_provider", "localhost", getAvailablePort(), this);
@Pact(consumer = "test_consumer")
public RequestResponsePact createPact(PactDslWithProvider builder) {
diff --git a/libraries-6/README.md b/libraries-6/README.md
index 3748522b9d..ecad499e07 100644
--- a/libraries-6/README.md
+++ b/libraries-6/README.md
@@ -13,7 +13,9 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m
- [Implementing a FTP-Client in Java](https://www.baeldung.com/java-ftp-client)
- [Introduction to Functional Java](https://www.baeldung.com/java-functional-library)
- [A Guide to the Reflections Library](https://www.baeldung.com/reflections-library)
-- [Exactly Once Processing in Kafka](https://www.baeldung.com/kafka-exactly-once)
+- [Exactly Once Processing in Kafka with Java](https://www.baeldung.com/kafka-exactly-once)
- [Introduction to Protonpack](https://www.baeldung.com/java-protonpack)
- [Java-R Integration](https://www.baeldung.com/java-r-integration)
+- [Using libphonenumber to Validate Phone Numbers](https://www.baeldung.com/java-libphonenumber)
+- [Apache Commons Collections vs Google Guava](https://www.baeldung.com/apache-commons-collections-vs-guava)
- More articles [[<-- prev]](/libraries-5)
diff --git a/libraries-6/pom.xml b/libraries-6/pom.xml
index 2f8cc385cb..0f129c27c9 100644
--- a/libraries-6/pom.xml
+++ b/libraries-6/pom.xml
@@ -76,6 +76,11 @@
commons-lang3
${commons-lang3.version}
+
+ org.apache.commons
+ commons-collections4
+ ${commons-collections4.version}
+
commons-net
commons-net
@@ -107,6 +112,12 @@
renjin-script-engine
${renjin.version}
+
+
+ com.googlecode.libphonenumber
+ libphonenumber
+ ${libphonenumber.version}
+
@@ -150,6 +161,8 @@
RELEASE
3.0
1.8.1
+ 4.4
+ 8.12.9
diff --git a/libraries-6/src/test/java/com/baeldung/apache/commons/CollectionsUnitTest.java b/libraries-6/src/test/java/com/baeldung/apache/commons/CollectionsUnitTest.java
new file mode 100644
index 0000000000..3de0c64fb9
--- /dev/null
+++ b/libraries-6/src/test/java/com/baeldung/apache/commons/CollectionsUnitTest.java
@@ -0,0 +1,182 @@
+package com.baeldung.apache.commons;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.collections4.BidiMap;
+import org.apache.commons.collections4.MultiValuedMap;
+import org.apache.commons.collections4.bidimap.DualHashBidiMap;
+import org.apache.commons.collections4.bidimap.DualTreeBidiMap;
+import org.apache.commons.collections4.bidimap.TreeBidiMap;
+import org.apache.commons.collections4.map.MultiKeyMap;
+import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
+import org.junit.Test;
+
+public class CollectionsUnitTest {
+ private final static BidiMap daysOfWeek = new TreeBidiMap();
+ private final static MultiValuedMap groceryCart = new ArrayListValuedHashMap<>();
+ private final static MultiKeyMap days = new MultiKeyMap();
+ private final static MultiKeyMap cityCoordinates = new MultiKeyMap();
+ private long start;
+
+ static {
+ daysOfWeek.put(1, "Monday");
+ daysOfWeek.put(2, "Tuesday");
+ daysOfWeek.put(3, "Wednesday");
+ daysOfWeek.put(4, "Thursday");
+ daysOfWeek.put(5, "Friday");
+ daysOfWeek.put(6, "Saturday");
+ daysOfWeek.put(7, "Sunday");
+
+ groceryCart.put("Fruits", "Apple");
+ groceryCart.put("Fruits", "Grapes");
+ groceryCart.put("Fruits", "Strawberries");
+ groceryCart.put("Vegetables", "Spinach");
+ groceryCart.put("Vegetables", "Cabbage");
+
+ days.put("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Weekday");
+ days.put("Saturday", "Sunday", "Weekend");
+
+ cityCoordinates.put("40.7128° N", "74.0060° W", "New York");
+ cityCoordinates.put("48.8566° N", "2.3522° E", "Paris");
+ cityCoordinates.put("19.0760° N", "72.8777° E", "Mumbai");
+
+ }
+
+ @Test
+ public void givenBidiMap_whenValue_thenKeyReturned() {
+ assertEquals(Integer.valueOf(7), daysOfWeek.inverseBidiMap()
+ .get("Sunday"));
+ }
+
+ @Test
+ public void givenBidiMap_whenKey_thenValueReturned() {
+ assertEquals("Tuesday", daysOfWeek.get(2));
+ }
+
+ @Test
+ public void givenMultiValuedMap_whenFruitsFetched_thenFruitsReturned() {
+
+ List fruits = Arrays.asList("Apple", "Grapes", "Strawberries");
+ assertEquals(fruits, groceryCart.get("Fruits"));
+ }
+
+ @Test
+ public void givenMultiValuedMap_whenVeggiesFetched_thenVeggiesReturned() {
+ List veggies = Arrays.asList("Spinach", "Cabbage");
+ assertEquals(veggies, groceryCart.get("Vegetables"));
+ }
+
+ @Test
+ public void givenMultiValuedMap_whenFuitsRemoved_thenVeggiesPreserved() {
+
+ assertEquals(5, groceryCart.size());
+
+ groceryCart.remove("Fruits");
+ assertEquals(2, groceryCart.size());
+ }
+
+ @Test
+ public void givenDaysMultiKeyMap_whenFetched_thenOK() {
+ assertFalse(days.get("Saturday", "Sunday")
+ .equals("Weekday"));
+ }
+
+ @Test
+ public void givenCoordinatesMultiKeyMap_whenQueried_thenOK() {
+ List expectedLongitudes = Arrays.asList("72.8777° E", "2.3522° E", "74.0060° W");
+ List longitudes = new ArrayList<>();
+
+ cityCoordinates.forEach((key, value) -> {
+ longitudes.add(key.getKey(1));
+ });
+
+ assertArrayEquals(expectedLongitudes.toArray(), longitudes.toArray());
+
+ List expectedCities = Arrays.asList("Mumbai", "Paris", "New York");
+ List cities = new ArrayList<>();
+
+ cityCoordinates.forEach((key, value) -> {
+ cities.add(value);
+ });
+
+ assertArrayEquals(expectedCities.toArray(), cities.toArray());
+
+ }
+
+ @Test
+ public void givenTreeBidiMap_whenHundredThousandKeys_thenPerformanceNoted() {
+ System.out.println("**TreeBidiMap**");
+ BidiMap map = new TreeBidiMap<>();
+ start = System.nanoTime();
+ for (int i = 0; i < 100000; i++) {
+ Integer key = new Integer(i);
+ Integer value = new Integer(i + 1);
+ map.put(key, value);
+ }
+ System.out.println("Insertion time:" + TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+
+ start = System.nanoTime();
+ Integer value = (Integer) map.get(new Integer(500));
+ System.out.println("Value:" + value);
+ System.out.println("Fetch time key:" + TimeUnit.MICROSECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+
+ start = System.nanoTime();
+ Integer key = (Integer) map.getKey(new Integer(501));
+ System.out.println("Key:" + key);
+ System.out.println("Fetch time value:" + TimeUnit.MICROSECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+ }
+
+ @Test
+ public void givenDualTreeBidiMap_whenHundredThousandKeys_thenPerformanceNoted() {
+ System.out.println("**DualTreeBidiMap**");
+ BidiMap map = new DualTreeBidiMap<>();
+ start = System.nanoTime();
+ for (int i = 0; i < 100000; i++) {
+ Integer key = new Integer(i);
+ Integer value = new Integer(i + 1);
+ map.put(key, value);
+ }
+ System.out.println("Insertion time:" + TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+
+ start = System.nanoTime();
+ Integer value = (Integer) map.get(new Integer(500));
+ System.out.println("Value:" + value);
+ System.out.println("Fetch time key:" + TimeUnit.MICROSECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+
+ start = System.nanoTime();
+ Integer key = (Integer) map.getKey(new Integer(501));
+ System.out.println("Key:" + key);
+ System.out.println("Fetch time value:" + TimeUnit.MICROSECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+ }
+
+ @Test
+ public void givenDualHashBidiMap_whenHundredThousandKeys_thenPerformanceNoted() {
+ System.out.println("**DualHashBidiMap**");
+ BidiMap map = new DualHashBidiMap<>();
+ start = System.nanoTime();
+ for (int i = 0; i < 100000; i++) {
+ Integer key = new Integer(i);
+ Integer value = new Integer(i + 1);
+ map.put(key, value);
+ }
+ System.out.println("Insertion time:" + TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+
+ start = System.nanoTime();
+ Integer value = (Integer) map.get(new Integer(500));
+ System.out.println("Value:" + value);
+ System.out.println("Fetch time key:" + TimeUnit.MICROSECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+
+ start = System.nanoTime();
+ Integer key = (Integer) map.getKey(new Integer(501));
+ System.out.println("Key:" + key);
+ System.out.println("Fetch time value:" + TimeUnit.MICROSECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+ }
+
+}
\ No newline at end of file
diff --git a/libraries-6/src/test/java/com/baeldung/guava/GuavaUnitTest.java b/libraries-6/src/test/java/com/baeldung/guava/GuavaUnitTest.java
new file mode 100644
index 0000000000..c0501f761e
--- /dev/null
+++ b/libraries-6/src/test/java/com/baeldung/guava/GuavaUnitTest.java
@@ -0,0 +1,143 @@
+package com.baeldung.guava;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBasedTable;
+import com.google.common.collect.HashBiMap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Table;
+
+public class GuavaUnitTest {
+ private final static BiMap daysOfWeek = HashBiMap.create();
+ private final static Multimap groceryCart = ArrayListMultimap.create();
+ private final static Table cityCoordinates = HashBasedTable.create();
+ private final static Table movies = HashBasedTable.create();
+ private long start;
+
+ static {
+ daysOfWeek.put(1, "Monday");
+ daysOfWeek.put(2, "Tuesday");
+ daysOfWeek.put(3, "Wednesday");
+ daysOfWeek.put(4, "Thursday");
+ daysOfWeek.put(5, "Friday");
+ daysOfWeek.put(6, "Saturday");
+ daysOfWeek.put(7, "Sunday");
+
+ groceryCart.put("Fruits", "Apple");
+ groceryCart.put("Fruits", "Grapes");
+ groceryCart.put("Fruits", "Strawberries");
+ groceryCart.put("Vegetables", "Spinach");
+ groceryCart.put("Vegetables", "Cabbage");
+
+ cityCoordinates.put("40.7128° N", "74.0060° W", "New York");
+ cityCoordinates.put("48.8566° N", "2.3522° E", "Paris");
+ cityCoordinates.put("19.0760° N", "72.8777° E", "Mumbai");
+
+ movies.put("Tom Hanks", "Meg Ryan", "You've Got Mail");
+ movies.put("Tom Hanks", "Catherine Zeta-Jones", "The Terminal");
+ movies.put("Bradley Cooper", "Lady Gaga", "A Star is Born");
+ movies.put("Keenu Reaves", "Sandra Bullock", "Speed");
+ movies.put("Tom Hanks", "Sandra Bullock", "Extremely Loud & Incredibly Close");
+ }
+
+ @Test
+ public void givenBiMap_whenValue_thenKeyReturned() {
+ assertEquals(Integer.valueOf(7), daysOfWeek.inverse()
+ .get("Sunday"));
+ }
+
+ @Test
+ public void givenBiMap_whenKey_thenValueReturned() {
+ assertEquals("Tuesday", daysOfWeek.get(2));
+ }
+
+ @Test
+ public void givenMultiValuedMap_whenFruitsFetched_thenFruitsReturned() {
+
+ List fruits = Arrays.asList("Apple", "Grapes", "Strawberries");
+ assertEquals(fruits, groceryCart.get("Fruits"));
+ }
+
+ @Test
+ public void givenMultiValuedMap_whenVeggiesFetched_thenVeggiesReturned() {
+ List veggies = Arrays.asList("Spinach", "Cabbage");
+ assertEquals(veggies, groceryCart.get("Vegetables"));
+ }
+
+ @Test
+ public void givenMultiValuedMap_whenFuitsRemoved_thenVeggiesPreserved() {
+
+ assertEquals(5, groceryCart.size());
+
+ groceryCart.remove("Fruits", "Apple");
+ assertEquals(4, groceryCart.size());
+
+ groceryCart.removeAll("Fruits");
+ assertEquals(2, groceryCart.size());
+ }
+
+ @Test
+ public void givenCoordinatesTable_whenFetched_thenOK() {
+
+ List expectedLongitudes = Arrays.asList("74.0060° W", "2.3522° E", "72.8777° E");
+
+ assertArrayEquals(expectedLongitudes.toArray(), cityCoordinates.columnKeySet()
+ .toArray());
+
+ List expectedCities = Arrays.asList("New York", "Paris", "Mumbai");
+
+ assertArrayEquals(expectedCities.toArray(), cityCoordinates.values()
+ .toArray());
+
+ assertTrue(cityCoordinates.rowKeySet()
+ .contains("48.8566° N"));
+
+ }
+
+ @Test
+ public void givenMoviesTable_whenFetched_thenOK() {
+ assertEquals(3, movies.row("Tom Hanks")
+ .size());
+
+ assertEquals(2, movies.column("Sandra Bullock")
+ .size());
+
+ assertEquals("A Star is Born", movies.get("Bradley Cooper", "Lady Gaga"));
+
+ assertTrue(movies.containsValue("Speed"));
+
+ }
+
+ @Test
+ public void givenHashBiMap_whenHundredThousandKeys_thenPerformanceNoted() {
+ BiMap map = HashBiMap.create();
+ start = System.nanoTime();
+ for (int i = 0; i < 100000; i++) {
+ Integer key = new Integer(i);
+ Integer value = new Integer(i + 1);
+ map.put(key, value);
+ }
+ System.out.println("Insertion time:" + TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+
+ start = System.nanoTime();
+ Integer value = map.get(new Integer(500));
+ System.out.println("Value:" + value);
+ System.out.println("Fetch time key:" + TimeUnit.MICROSECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+
+ start = System.nanoTime();
+ Integer key = map.inverse()
+ .get(new Integer(501));
+ System.out.println("Key:" + key);
+ System.out.println("Fetch time value:" + TimeUnit.MICROSECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS));
+ }
+}
\ No newline at end of file
diff --git a/libraries-6/src/test/java/com/baeldung/libphonenumber/LibPhoneNumberUnitTest.java b/libraries-6/src/test/java/com/baeldung/libphonenumber/LibPhoneNumberUnitTest.java
new file mode 100644
index 0000000000..39b96b3e38
--- /dev/null
+++ b/libraries-6/src/test/java/com/baeldung/libphonenumber/LibPhoneNumberUnitTest.java
@@ -0,0 +1,79 @@
+package com.baeldung.libphonenumber;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.google.i18n.phonenumbers.NumberParseException;
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberType;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
+
+public class LibPhoneNumberUnitTest {
+
+ private static final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
+
+ @Test
+ public void givenPhoneNumber_whenValid_thenOK() throws Exception {
+
+ PhoneNumber phone = phoneNumberUtil.parse("+911234567890", CountryCodeSource.UNSPECIFIED.name());
+
+ assertTrue(phoneNumberUtil.isValidNumber(phone));
+ assertTrue(phoneNumberUtil.isValidNumberForRegion(phone, "IN"));
+ assertFalse(phoneNumberUtil.isValidNumberForRegion(phone, "US"));
+ assertTrue(phoneNumberUtil.isValidNumber(phoneNumberUtil.getExampleNumber("IN")));
+ }
+
+ @Test
+ public void givenPhoneNumber_whenAlphaNumber_thenValid() {
+ assertTrue(phoneNumberUtil.isAlphaNumber("325-CARS"));
+ assertTrue(phoneNumberUtil.isAlphaNumber("0800 REPAIR"));
+ assertTrue(phoneNumberUtil.isAlphaNumber("1-800-MY-APPLE"));
+ assertTrue(phoneNumberUtil.isAlphaNumber("1-800-MY-APPLE.."));
+ assertFalse(phoneNumberUtil.isAlphaNumber("+876 1234-1234"));
+ }
+
+ @Test
+ public void givenPhoneNumber_whenPossibleForType_thenValid() {
+ PhoneNumber number = new PhoneNumber();
+ number.setCountryCode(54);
+
+ number.setNationalNumber(123456);
+ assertTrue(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.FIXED_LINE));
+ assertFalse(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.TOLL_FREE));
+
+ number.setNationalNumber(12345678901L);
+ assertFalse(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.FIXED_LINE));
+ assertTrue(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.MOBILE));
+ assertFalse(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.TOLL_FREE));
+ }
+
+ @Test
+ public void givenPhoneNumber_whenPossible_thenValid() {
+ PhoneNumber number = new PhoneNumber();
+ number.setCountryCode(1)
+ .setNationalNumber(123000L);
+ assertFalse(phoneNumberUtil.isPossibleNumber(number));
+ assertFalse(phoneNumberUtil.isPossibleNumber("+1 343 253 00000", "US"));
+ assertFalse(phoneNumberUtil.isPossibleNumber("(343) 253-00000", "US"));
+ assertFalse(phoneNumberUtil.isPossibleNumber("dial p for pizza", "US"));
+ assertFalse(phoneNumberUtil.isPossibleNumber("123-000", "US"));
+ }
+
+ @Test
+ public void givenPhoneNumber_whenNumberGeographical_thenValid() throws NumberParseException {
+
+ PhoneNumber phone = phoneNumberUtil.parse("+911234567890", "IN");
+ assertTrue(phoneNumberUtil.isNumberGeographical(phone));
+
+ phone = new PhoneNumber().setCountryCode(1)
+ .setNationalNumber(2530000L);
+ assertFalse(phoneNumberUtil.isNumberGeographical(phone));
+
+ phone = new PhoneNumber().setCountryCode(800)
+ .setNationalNumber(12345678L);
+ assertFalse(phoneNumberUtil.isNumberGeographical(phone));
+ }
+}
diff --git a/libraries-data-2/README.md b/libraries-data-2/README.md
index a8f2a0cb37..893d3e64e8 100644
--- a/libraries-data-2/README.md
+++ b/libraries-data-2/README.md
@@ -4,7 +4,7 @@ This module contains articles about libraries for data processing in Java.
### Relevant articles
- [Introduction to Apache Flink with Java](https://www.baeldung.com/apache-flink)
-- [Guide to the HyperLogLog Algorithm](https://www.baeldung.com/java-hyperloglog)
+- [Guide to the HyperLogLog Algorithm in Java](https://www.baeldung.com/java-hyperloglog)
- [Introduction to Conflict-Free Replicated Data Types](https://www.baeldung.com/java-conflict-free-replicated-data-types)
- [Introduction to javax.measure](https://www.baeldung.com/javax-measure)
- [A Guide to Infinispan in Java](https://www.baeldung.com/infinispan)
diff --git a/libraries-data-2/pom.xml b/libraries-data-2/pom.xml
index 26d8651cdd..0154823cca 100644
--- a/libraries-data-2/pom.xml
+++ b/libraries-data-2/pom.xml
@@ -168,7 +168,7 @@
0.1.0
1.0.3
9.1.5.Final
- 2.9.8
+
4.3.8.RELEASE
4.0.0
1.1.0
diff --git a/libraries-http-2/README.md b/libraries-http-2/README.md
index 5ba45eb4a9..c0d6e76f1b 100644
--- a/libraries-http-2/README.md
+++ b/libraries-http-2/README.md
@@ -6,5 +6,6 @@ This module contains articles about HTTP libraries.
- [Jetty ReactiveStreams HTTP Client](https://www.baeldung.com/jetty-reactivestreams-http-client)
- [Decode an OkHttp JSON Response](https://www.baeldung.com/okhttp-json-response)
+- [Retrofit 2 – Dynamic URL](https://www.baeldung.com/retrofit-dynamic-url)
- More articles [[<-- prev]](/libraries-http)
diff --git a/libraries-http-2/pom.xml b/libraries-http-2/pom.xml
index 73fe6c66bd..96f9e2911d 100644
--- a/libraries-http-2/pom.xml
+++ b/libraries-http-2/pom.xml
@@ -66,16 +66,29 @@
reactive-streams
${reactive.stream.version}
+
+
+
+ com.squareup.retrofit2
+ retrofit
+ ${retrofit.version}
+
+
+ com.squareup.retrofit2
+ converter-gson
+ ${retrofit.version}
+
3.14.2
2.8.5
3.14.2
- 2.9.8
+
1.0.3
9.4.19.v20190610
2.2.11
+ 2.3.0
5.1.9.RELEASE
1.0.3
3.2.12.RELEASE
diff --git a/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApi.java b/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApi.java
new file mode 100644
index 0000000000..5356c12b26
--- /dev/null
+++ b/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApi.java
@@ -0,0 +1,19 @@
+package com.baeldung.retrofit.dynamic;
+
+import com.baeldung.retrofit.models.Contributor;
+import com.baeldung.retrofit.models.Repository;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Path;
+import retrofit2.http.Url;
+
+import java.util.List;
+
+public interface GitHubDynamicApi {
+
+ @GET
+ Call> reposList(@Url String url);
+
+ @GET("{fullUrl}")
+ Call> contributorsList(@Path(value = "fullUrl", encoded = true) String fullUrl);
+}
diff --git a/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApiApp.java b/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApiApp.java
new file mode 100644
index 0000000000..06f6b3cef7
--- /dev/null
+++ b/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApiApp.java
@@ -0,0 +1,13 @@
+package com.baeldung.retrofit.dynamic;
+
+import java.io.IOException;
+import java.util.List;
+
+public class GitHubDynamicApiApp {
+
+ public static void main(String[] args) throws IOException {
+ String url = "https://api.github.com/users/eugenp/repos";
+ List topContributors = new GitHubDynamicApiService().getTopContributors(url);
+ topContributors.forEach(System.out::println);
+ }
+}
diff --git a/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApiService.java b/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApiService.java
new file mode 100644
index 0000000000..cb8e95f2d5
--- /dev/null
+++ b/libraries-http-2/src/main/java/com/baeldung/retrofit/dynamic/GitHubDynamicApiService.java
@@ -0,0 +1,44 @@
+package com.baeldung.retrofit.dynamic;
+
+import com.baeldung.retrofit.models.Contributor;
+import com.baeldung.retrofit.models.Repository;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class GitHubDynamicApiService {
+
+ private GitHubDynamicApi gitHubDynamicApi;
+
+ GitHubDynamicApiService() {
+ Retrofit retrofit = new Retrofit.Builder().baseUrl("https://api.github.com/").addConverterFactory(GsonConverterFactory.create()).build();
+
+ gitHubDynamicApi = retrofit.create(GitHubDynamicApi.class);
+ }
+
+ List getTopContributors(String url) throws IOException {
+ List repos = gitHubDynamicApi.reposList(url).execute().body();
+
+ repos = repos != null ? repos : Collections.emptyList();
+
+ return repos.stream().flatMap(repo -> getContributors("repos/eugenp/"+repo+"/contributors")).sorted((a, b) -> b.getContributions() - a.getContributions()).map(com.baeldung.retrofit.models.Contributor::getName).distinct().sorted().collect(Collectors.toList());
+ }
+
+ private Stream getContributors(String fullUrl) {
+ List contributors = null;
+ try {
+ contributors = gitHubDynamicApi.contributorsList(fullUrl).execute().body();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ contributors = contributors != null ? contributors : Collections.emptyList();
+
+ return contributors.stream().filter(c -> c.getContributions() > 100);
+ }
+}
diff --git a/libraries-http-2/src/main/java/com/baeldung/retrofit/models/Contributor.java b/libraries-http-2/src/main/java/com/baeldung/retrofit/models/Contributor.java
new file mode 100644
index 0000000000..f98b19de96
--- /dev/null
+++ b/libraries-http-2/src/main/java/com/baeldung/retrofit/models/Contributor.java
@@ -0,0 +1,33 @@
+package com.baeldung.retrofit.models;
+
+import com.google.gson.annotations.SerializedName;
+
+public class Contributor {
+
+ @SerializedName("login")
+ private String name;
+
+ private Integer contributions;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getContributions() {
+ return contributions;
+ }
+
+ public void setContributions(Integer contributions) {
+ this.contributions = contributions;
+ }
+
+ @Override
+ public String toString() {
+ return "Contributer [name=" + name + ", contributions=" + contributions + "]";
+ }
+
+}
diff --git a/libraries-http-2/src/main/java/com/baeldung/retrofit/models/Repository.java b/libraries-http-2/src/main/java/com/baeldung/retrofit/models/Repository.java
new file mode 100644
index 0000000000..6bc91eb772
--- /dev/null
+++ b/libraries-http-2/src/main/java/com/baeldung/retrofit/models/Repository.java
@@ -0,0 +1,30 @@
+package com.baeldung.retrofit.models;
+
+public class Repository {
+
+ private String name;
+
+ private String description;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public String toString() {
+ return "Repository [name=" + name + ", description=" + description + "]";
+ }
+
+}
diff --git a/libraries-http/pom.xml b/libraries-http/pom.xml
index cbc74ce132..74e00a7291 100644
--- a/libraries-http/pom.xml
+++ b/libraries-http/pom.xml
@@ -118,7 +118,7 @@
2.8.5
4.5.3
- 2.9.8
+
3.6.2
3.14.2
1.23.0
diff --git a/maven-modules/maven-plugins/custom-rule/pom.xml b/maven-modules/maven-plugins/custom-rule/pom.xml
index 0fb551e71b..075a5c7943 100644
--- a/maven-modules/maven-plugins/custom-rule/pom.xml
+++ b/maven-modules/maven-plugins/custom-rule/pom.xml
@@ -51,4 +51,17 @@
1.0-alpha-9
+
+
+
+ maven-verifier-plugin
+ ${maven.verifier.version}
+
+ ../input-resources/verifications.xml
+ false
+
+
+
+
+
diff --git a/maven-modules/maven-plugins/pom.xml b/maven-modules/maven-plugins/pom.xml
index 4877f00a92..9f28871ec0 100644
--- a/maven-modules/maven-plugins/pom.xml
+++ b/maven-modules/maven-plugins/pom.xml
@@ -15,7 +15,7 @@
-
+ custom-rule
maven-enforcer
diff --git a/metrics/pom.xml b/metrics/pom.xml
index 92699c3fb8..07adf15936 100644
--- a/metrics/pom.xml
+++ b/metrics/pom.xml
@@ -66,12 +66,12 @@
com.fasterxml.jackson.core
jackson-databind
- ${fasterxml.jackson.version}
+ ${jackson.version}
com.fasterxml.jackson.dataformat
jackson-dataformat-smile
- ${fasterxml.jackson.version}
+ ${jackson.version}
@@ -93,7 +93,7 @@
3.1.0
0.12.17
0.12.0.RELEASE
- 2.9.1
+
2.0.7.RELEASE
3.11.1
1.1.0
diff --git a/netflix-modules/README.md b/netflix-modules/README.md
index c126bbdf5b..21d6958dab 100644
--- a/netflix-modules/README.md
+++ b/netflix-modules/README.md
@@ -2,3 +2,6 @@
This module contains articles about Netflix.
+### Relevant Articles:
+
+- [Introduction to Netflix Mantis](https://www.baeldung.com/java-netflix-mantis)
diff --git a/netflix-modules/mantis/pom.xml b/netflix-modules/mantis/pom.xml
new file mode 100644
index 0000000000..5d9611ccdf
--- /dev/null
+++ b/netflix-modules/mantis/pom.xml
@@ -0,0 +1,78 @@
+
+
+ 4.0.0
+ mantis
+ Mantis
+ jar
+ Sample project for Netflix Mantis
+
+
+ com.baeldung
+ parent-boot-2
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-2
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+ 2.1.3.RELEASE
+
+
+
+ io.mantisrx
+ mantis-runtime
+ 1.2.63
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.10.2
+
+
+
+ net.andreinc.mockneat
+ mockneat
+ 0.3.8
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.12
+
+
+
+ org.springframework
+ spring-webflux
+ 5.0.9.RELEASE
+ test
+
+
+
+ io.projectreactor.netty
+ reactor-netty
+ 0.9.12.RELEASE
+ test
+
+
+
+
+
+
+ SpringLibReleaseRepo
+ https://repo.spring.io/libs-release/
+
+
+
+
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java
new file mode 100644
index 0000000000..d5ffe977c3
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java
@@ -0,0 +1,23 @@
+package com.baeldung.netflix.mantis;
+
+import com.baeldung.netflix.mantis.job.LogAggregationJob;
+import io.mantisrx.runtime.executor.LocalJobExecutorNetworked;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@Slf4j
+@SpringBootApplication
+public class MantisApplication implements CommandLineRunner {
+
+ public static void main(String[] args) {
+ SpringApplication.run(MantisApplication.class, args);
+ }
+
+ @Override
+ public void run(String... args) {
+ LocalJobExecutorNetworked.execute(new LogAggregationJob().getJobInstance());
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java
new file mode 100644
index 0000000000..7fc514deef
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java
@@ -0,0 +1,37 @@
+package com.baeldung.netflix.mantis.job;
+
+import com.baeldung.netflix.mantis.model.LogAggregate;
+import com.baeldung.netflix.mantis.source.RandomLogSource;
+import com.baeldung.netflix.mantis.stage.CountLogStage;
+import com.baeldung.netflix.mantis.stage.GroupLogStage;
+import com.baeldung.netflix.mantis.stage.TransformLogStage;
+import io.mantisrx.runtime.Job;
+import io.mantisrx.runtime.MantisJob;
+import io.mantisrx.runtime.MantisJobProvider;
+import io.mantisrx.runtime.Metadata;
+import io.mantisrx.runtime.sink.Sink;
+import io.mantisrx.runtime.sink.Sinks;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+public class LogAggregationJob extends MantisJobProvider {
+
+ private Sink sink = Sinks.eagerSubscribe(Sinks.sse(LogAggregate::toJsonString));
+
+ @Override
+ public Job getJobInstance() {
+
+ return MantisJob
+ .source(new RandomLogSource())
+ .stage(new TransformLogStage(), TransformLogStage.stageConfig())
+ .stage(new GroupLogStage(), GroupLogStage.config())
+ .stage(new CountLogStage(), CountLogStage.config())
+ .sink(sink)
+ .metadata(new Metadata.Builder().build())
+ .create();
+
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java
new file mode 100644
index 0000000000..34ccf8355a
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java
@@ -0,0 +1,34 @@
+package com.baeldung.netflix.mantis.job;
+
+import com.baeldung.netflix.mantis.model.LogEvent;
+import com.baeldung.netflix.mantis.sink.LogSink;
+import com.baeldung.netflix.mantis.source.RandomLogSource;
+import com.baeldung.netflix.mantis.stage.TransformLogStage;
+import io.mantisrx.runtime.Job;
+import io.mantisrx.runtime.MantisJob;
+import io.mantisrx.runtime.MantisJobProvider;
+import io.mantisrx.runtime.Metadata;
+import io.mantisrx.runtime.ScalarToScalar;
+import io.mantisrx.runtime.sink.Sink;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+@AllArgsConstructor
+public class LogCollectingJob extends MantisJobProvider {
+
+ private Sink sink = new LogSink();
+
+ @Override
+ public Job getJobInstance() {
+
+ return MantisJob
+ .source(new RandomLogSource())
+ .stage(new TransformLogStage(), new ScalarToScalar.Config<>())
+ .sink(sink)
+ .metadata(new Metadata.Builder().build())
+ .create();
+
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java
new file mode 100644
index 0000000000..e0e3c4f9fa
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java
@@ -0,0 +1,28 @@
+package com.baeldung.netflix.mantis.model;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.mantisrx.runtime.codec.JsonType;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+public class LogAggregate implements JsonType {
+
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ private Integer count;
+ private String level;
+
+ public String toJsonString() {
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ return null;
+ }
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java
new file mode 100644
index 0000000000..a48dfcd5dd
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java
@@ -0,0 +1,35 @@
+package com.baeldung.netflix.mantis.model;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.mantisrx.runtime.codec.JsonType;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
+public class LogEvent implements JsonType {
+
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ private Long index;
+ private String level;
+ private String message;
+
+ public LogEvent(String[] parts) {
+ this.index = Long.valueOf(parts[0]);
+ this.level = parts[1];
+ this.message = parts[2];
+ }
+
+ public String toJsonString() {
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ return null;
+ }
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/sink/LogSink.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/sink/LogSink.java
new file mode 100644
index 0000000000..ae2177bf87
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/sink/LogSink.java
@@ -0,0 +1,37 @@
+package com.baeldung.netflix.mantis.sink;
+
+import com.baeldung.netflix.mantis.model.LogEvent;
+import io.mantisrx.runtime.Context;
+import io.mantisrx.runtime.PortRequest;
+import io.mantisrx.runtime.sink.SelfDocumentingSink;
+import io.mantisrx.runtime.sink.ServerSentEventsSink;
+import io.mantisrx.runtime.sink.Sink;
+import io.mantisrx.runtime.sink.predicate.Predicate;
+import rx.Observable;
+
+public class LogSink implements Sink {
+
+ @Override
+ public void call(Context context, PortRequest portRequest, Observable logEventObservable) {
+
+ SelfDocumentingSink sink = new ServerSentEventsSink.Builder()
+ .withEncoder(LogEvent::toJsonString)
+ .withPredicate(filterByLogMessage())
+ .build();
+
+ logEventObservable.subscribe();
+
+ sink.call(context, portRequest, logEventObservable);
+ }
+
+ private Predicate filterByLogMessage() {
+ return new Predicate<>("filter by message",
+ parameters -> {
+ if (parameters != null && parameters.containsKey("filter")) {
+ return logEvent -> logEvent.getMessage().contains(parameters.get("filter").get(0));
+ }
+ return logEvent -> true;
+ });
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/source/RandomLogSource.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/source/RandomLogSource.java
new file mode 100644
index 0000000000..fe607d9866
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/source/RandomLogSource.java
@@ -0,0 +1,46 @@
+package com.baeldung.netflix.mantis.source;
+
+import io.mantisrx.runtime.Context;
+import io.mantisrx.runtime.source.Index;
+import io.mantisrx.runtime.source.Source;
+import lombok.extern.slf4j.Slf4j;
+import net.andreinc.mockneat.MockNeat;
+import rx.Observable;
+
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+public class RandomLogSource implements Source {
+
+ private MockNeat mockDataGenerator;
+
+ @Override
+ public void init(Context context, Index index) {
+ mockDataGenerator = MockNeat.threadLocal();
+ }
+
+ @Override
+ public Observable> call(Context context, Index index) {
+ return Observable.just(
+ Observable
+ .interval(250, TimeUnit.MILLISECONDS)
+ .map(this::createRandomLogEvent));
+ }
+
+ private String createRandomLogEvent(Long tick) {
+ String level = mockDataGenerator.probabilites(String.class)
+ .add(0.5, "INFO")
+ .add(0.3, "WARN")
+ .add(0.2, "ERROR")
+ .get();
+
+ String message = mockDataGenerator.probabilites(String.class)
+ .add(0.5, "login attempt")
+ .add(0.5, "user created")
+ .get();
+
+ return tick + "#" + level + "#" + message;
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/CountLogStage.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/CountLogStage.java
new file mode 100644
index 0000000000..5f02d783d0
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/CountLogStage.java
@@ -0,0 +1,58 @@
+package com.baeldung.netflix.mantis.stage;
+
+import com.baeldung.netflix.mantis.model.LogAggregate;
+import com.baeldung.netflix.mantis.model.LogEvent;
+import io.mantisrx.common.MantisGroup;
+import io.mantisrx.runtime.Context;
+import io.mantisrx.runtime.GroupToScalar;
+import io.mantisrx.runtime.codec.JacksonCodecs;
+import io.mantisrx.runtime.computation.GroupToScalarComputation;
+import io.mantisrx.runtime.parameter.ParameterDefinition;
+import io.mantisrx.runtime.parameter.type.IntParameter;
+import io.mantisrx.runtime.parameter.validator.Validators;
+import rx.Observable;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+public class CountLogStage implements GroupToScalarComputation {
+
+ private int duration;
+
+ @Override
+ public void init(Context context) {
+ duration = (int)context.getParameters().get("LogAggregationDuration", 1000);
+ }
+
+ @Override
+ public Observable call(Context context, Observable> mantisGroup) {
+ return mantisGroup
+ .window(duration, TimeUnit.MILLISECONDS)
+ .flatMap(o -> o.groupBy(MantisGroup::getKeyValue)
+ .flatMap(group -> group.reduce(0, (count, value) -> count = count + 1)
+ .map((count) -> new LogAggregate(count, group.getKey()))
+ ));
+ }
+
+ public static GroupToScalar.Config config(){
+ return new GroupToScalar.Config()
+ .description("sum events for a log level")
+ .codec(JacksonCodecs.pojo(LogAggregate.class))
+ .withParameters(getParameters());
+ }
+
+ public static List> getParameters() {
+ List> params = new ArrayList<>();
+
+ params.add(new IntParameter()
+ .name("LogAggregationDuration")
+ .description("window size for aggregation in milliseconds")
+ .validator(Validators.range(100, 10000))
+ .defaultValue(5000)
+ .build()) ;
+
+ return params;
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/GroupLogStage.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/GroupLogStage.java
new file mode 100644
index 0000000000..f21c4aba7d
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/GroupLogStage.java
@@ -0,0 +1,25 @@
+package com.baeldung.netflix.mantis.stage;
+
+import com.baeldung.netflix.mantis.model.LogEvent;
+import io.mantisrx.common.MantisGroup;
+import io.mantisrx.runtime.Context;
+import io.mantisrx.runtime.ScalarToGroup;
+import io.mantisrx.runtime.codec.JacksonCodecs;
+import io.mantisrx.runtime.computation.ToGroupComputation;
+import rx.Observable;
+
+public class GroupLogStage implements ToGroupComputation {
+
+ @Override
+ public Observable> call(Context context, Observable logEvent) {
+ return logEvent.map(log -> new MantisGroup<>(log.getLevel(), log));
+ }
+
+ public static ScalarToGroup.Config config(){
+ return new ScalarToGroup.Config()
+ .description("Group event data by level")
+ .codec(JacksonCodecs.pojo(LogEvent.class))
+ .concurrentInput();
+ }
+
+}
diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/TransformLogStage.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/TransformLogStage.java
new file mode 100644
index 0000000000..33e6567d13
--- /dev/null
+++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/TransformLogStage.java
@@ -0,0 +1,24 @@
+package com.baeldung.netflix.mantis.stage;
+
+import com.baeldung.netflix.mantis.model.LogEvent;
+import io.mantisrx.runtime.Context;
+import io.mantisrx.runtime.ScalarToScalar;
+import io.mantisrx.runtime.codec.JacksonCodecs;
+import io.mantisrx.runtime.computation.ScalarComputation;
+import rx.Observable;
+
+public class TransformLogStage implements ScalarComputation {
+
+ @Override
+ public Observable call(Context context, Observable logEntry) {
+ return logEntry
+ .map(log -> log.split("#"))
+ .filter(parts -> parts.length == 3)
+ .map(LogEvent::new);
+ }
+
+ public static ScalarToScalar.Config stageConfig() {
+ return new ScalarToScalar.Config()
+ .codec(JacksonCodecs.pojo(LogEvent.class));
+ }
+}
diff --git a/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogAggregationJobIntegrationTest.java b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogAggregationJobIntegrationTest.java
new file mode 100644
index 0000000000..b9b16e2146
--- /dev/null
+++ b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogAggregationJobIntegrationTest.java
@@ -0,0 +1,56 @@
+package com.baeldung.netflix.mantis.job;
+
+import com.baeldung.netflix.mantis.model.LogAggregate;
+import io.mantisrx.runtime.PortRequest;
+import io.mantisrx.runtime.sink.Sinks;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static java.util.Arrays.asList;
+import static java.util.Optional.of;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class LogAggregationJobIntegrationTest extends MantisJobTestBase {
+
+ private final static int PORT = 7382;
+ private final static String SINK_URL = "http://localhost:" + PORT;
+
+ @BeforeAll
+ static void beforeAll() {
+ start(new LogAggregationJob((context, portRequest, logAggregateObservable) -> {
+ logAggregateObservable.subscribe();
+ Sinks.sse(LogAggregate::toJsonString).call(context, new PortRequest(PORT), logAggregateObservable);
+ }));
+ }
+
+ @Override
+ public String getSinkUrl() {
+ return SINK_URL;
+ }
+
+ @Override
+ public Class getEventType() {
+ return LogAggregate.class;
+ }
+
+ @Test
+ void whenReadingFromSink_thenShouldRetrieveCorrectNumberOfLogAggregates() {
+ assertEquals(of(5L), sinkStream.take(5).count().blockOptional());
+ }
+
+ @Test
+ void whenReadingFromSink_thenShouldRetrieveLogAggregate() {
+ assertNotNull(sinkStream.take(1).blockFirst());
+ }
+
+ @Test
+ void whenReadingFromSink_thenShouldRetrieveValidLogAggregate() {
+ LogAggregate logAggregate = sinkStream.take(1).blockFirst();
+
+ assertTrue(asList("ERROR", "WARN", "INFO").contains(logAggregate.getLevel()));
+ assertTrue(logAggregate.getCount() > 0);
+ }
+
+}
\ No newline at end of file
diff --git a/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogCollectingJobIntegrationTest.java b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogCollectingJobIntegrationTest.java
new file mode 100644
index 0000000000..87e0c194b5
--- /dev/null
+++ b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogCollectingJobIntegrationTest.java
@@ -0,0 +1,73 @@
+package com.baeldung.netflix.mantis.job;
+
+import com.baeldung.netflix.mantis.model.LogEvent;
+import com.baeldung.netflix.mantis.sink.LogSink;
+import io.mantisrx.runtime.Context;
+import io.mantisrx.runtime.PortRequest;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import rx.Observable;
+
+import static java.util.Arrays.asList;
+import static java.util.Optional.of;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class LogCollectingJobIntegrationTest extends MantisJobTestBase {
+
+ private final static int PORT = 7381;
+ private final static String SINK_URL = "http://localhost:" + PORT;
+
+ @BeforeAll
+ static void beforeAll() {
+
+ start(new LogCollectingJob(new LogSink() {
+
+ @Override
+ public void call(Context context, PortRequest portRequest, Observable observable) {
+ super.call(context, new PortRequest(PORT), observable);
+ }
+
+ }));
+
+ }
+
+ @Override
+ public String getSinkUrl() {
+ return SINK_URL;
+ }
+
+ @Override
+ public Class getEventType() {
+ return LogEvent.class;
+ }
+
+ @Test
+ void whenReadingFromSink_thenShouldRetrieveCorrectNumberOfLogEvents() {
+ assertEquals(of(5L), sinkStream.take(5).count().blockOptional());
+ }
+
+ @Test
+ void whenReadingFromSink_thenShouldRetrieveLogEvent() {
+ assertNotNull(sinkStream.take(1).blockFirst());
+ }
+
+ @Test
+ void whenReadingFromSink_thenShouldRetrieveValidLogEvent() {
+ LogEvent logEvent = sinkStream.take(1).blockFirst();
+
+ assertTrue(asList("ERROR", "WARN", "INFO").contains(logEvent.getLevel()));
+ assertTrue(asList("login attempt", "user created").contains(logEvent.getMessage()));
+ }
+
+ @Test
+ void whenReadingFromSink_thenShouldRetrieveFilteredLogEvents() {
+ getSinkStream(SINK_URL + "?filter=login")
+ .take(7)
+ .toStream().forEach(
+ logEvent -> assertEquals("login attempt", logEvent.getMessage())
+ );
+ }
+
+}
\ No newline at end of file
diff --git a/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/MantisJobTestBase.java b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/MantisJobTestBase.java
new file mode 100644
index 0000000000..89425299a4
--- /dev/null
+++ b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/MantisJobTestBase.java
@@ -0,0 +1,49 @@
+package com.baeldung.netflix.mantis.job;
+
+import io.mantisrx.runtime.Job;
+import io.mantisrx.runtime.MantisJobProvider;
+import io.mantisrx.runtime.executor.LocalJobExecutorNetworked;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.springframework.web.reactive.function.client.WebClient;
+import reactor.core.publisher.Flux;
+import reactor.util.retry.Retry;
+
+import java.time.Duration;
+
+public abstract class MantisJobTestBase {
+
+ private static Job jobInstance;
+ Flux sinkStream;
+
+ public abstract String getSinkUrl();
+ public abstract Class getEventType();
+
+ @BeforeEach
+ void setUp() {
+ sinkStream = getSinkStream(getSinkUrl());
+ }
+
+ @AfterAll
+ static void afterAll() {
+ stopJob();
+ }
+
+ protected Flux getSinkStream(String sinkUrl) {
+ return WebClient.builder().build().get()
+ .uri(sinkUrl)
+ .retrieve()
+ .bodyToFlux(getEventType())
+ .retryWhen(Retry.fixedDelay(10, Duration.ofMillis(2000)));
+ }
+
+ static void start(MantisJobProvider job) {
+ jobInstance = job.getJobInstance();
+ new Thread(() -> LocalJobExecutorNetworked.execute(jobInstance)).start();
+ }
+
+ static void stopJob() {
+ jobInstance.getLifecycle().shutdown();
+ }
+
+}
diff --git a/netflix-modules/pom.xml b/netflix-modules/pom.xml
index 9ed22498d8..538126fb34 100644
--- a/netflix-modules/pom.xml
+++ b/netflix-modules/pom.xml
@@ -15,6 +15,7 @@
genie
+ mantis
\ No newline at end of file
diff --git a/patterns/design-patterns-architectural/README.md b/patterns/design-patterns-architectural/README.md
index 5b6011c159..ae6781c66c 100644
--- a/patterns/design-patterns-architectural/README.md
+++ b/patterns/design-patterns-architectural/README.md
@@ -1,4 +1,4 @@
### Relevant Articles:
-- [Service Locator Pattern](https://www.baeldung.com/java-service-locator-pattern)
+- [Service Locator Pattern and Java Implementation](https://www.baeldung.com/java-service-locator-pattern)
- [The DAO Pattern in Java](https://www.baeldung.com/java-dao-pattern)
- [DAO vs Repository Patterns](https://www.baeldung.com/java-dao-vs-repository)
diff --git a/patterns/design-patterns-behavioral/src/main/java/com/baeldung/nulls/UsingOptional.java b/patterns/design-patterns-behavioral/src/main/java/com/baeldung/nulls/UsingOptional.java
index d5dd56e760..099864589c 100644
--- a/patterns/design-patterns-behavioral/src/main/java/com/baeldung/nulls/UsingOptional.java
+++ b/patterns/design-patterns-behavioral/src/main/java/com/baeldung/nulls/UsingOptional.java
@@ -1,23 +1,52 @@
package com.baeldung.nulls;
+import java.util.List;
import java.util.Optional;
+import static java.util.Collections.emptyList;
+
public class UsingOptional {
- public Optional
diff --git a/persistence-modules/hibernate-enterprise/README.md b/persistence-modules/hibernate-enterprise/README.md
index c5606d0970..1a86c32afa 100644
--- a/persistence-modules/hibernate-enterprise/README.md
+++ b/persistence-modules/hibernate-enterprise/README.md
@@ -9,4 +9,5 @@ This module contains articles about enterprise concerns such as Multitenancy, Er
- [Hibernate Aggregate Functions](https://www.baeldung.com/hibernate-aggregate-functions)
- [Common Hibernate Exceptions](https://www.baeldung.com/hibernate-exceptions)
- [Hibernate Error “Not all named parameters have been set”](https://www.baeldung.com/hibernate-error-named-parameters-not-set)
-- [Various Logging Levels in Hibernate](https://www.baeldung.com/hibernate-logging-levels)
\ No newline at end of file
+- [Various Logging Levels in Hibernate](https://www.baeldung.com/hibernate-logging-levels)
+- [Hibernate: save, persist, update, merge, saveOrUpdate](https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate)
\ No newline at end of file
diff --git a/persistence-modules/hibernate-enterprise/pom.xml b/persistence-modules/hibernate-enterprise/pom.xml
index ae58e409c4..c088cc1eca 100644
--- a/persistence-modules/hibernate-enterprise/pom.xml
+++ b/persistence-modules/hibernate-enterprise/pom.xml
@@ -61,13 +61,25 @@
${byte-buddy.version}
test
+
+ org.hsqldb
+ hsqldb
+ ${hsqldb.version}
+ test
+
- geodb-repo
- GeoDB repository
- http://repo.boundlessgeo.com/main/
+ osgeo
+ OSGeo Release Repository
+ https://repo.osgeo.org/repository/release/
+
+ false
+
+
+ true
+
@@ -77,6 +89,7 @@
2.2.3
3.8.0
0.9
+ 2.3.4
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java b/persistence-modules/hibernate-enterprise/src/main/java/com/baeldung/persistence/model/Person.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java
rename to persistence-modules/hibernate-enterprise/src/main/java/com/baeldung/persistence/model/Person.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java b/persistence-modules/hibernate-enterprise/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java
similarity index 79%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java
rename to persistence-modules/hibernate-enterprise/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java
index ef83af3a0d..8c571428b4 100644
--- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java
+++ b/persistence-modules/hibernate-enterprise/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java
@@ -1,6 +1,14 @@
package com.baeldung.persistence.save;
-import com.baeldung.persistence.model.Person;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+
+import javax.persistence.PersistenceException;
+
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@ -8,9 +16,13 @@ import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.service.ServiceRegistry;
-import org.junit.*;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
-import static org.junit.Assert.*;
+import com.baeldung.persistence.model.Person;
/**
* Testing specific implementation details for different methods:
@@ -21,12 +33,19 @@ public class SaveMethodsIntegrationTest {
private static SessionFactory sessionFactory;
private Session session;
+ private boolean doNotCommit = false;
@BeforeClass
public static void beforeTests() {
- Configuration configuration = new Configuration().addAnnotatedClass(Person.class).setProperty("hibernate.dialect", HSQLDialect.class.getName()).setProperty("hibernate.connection.driver_class", org.hsqldb.jdbcDriver.class.getName())
- .setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:test").setProperty("hibernate.connection.username", "sa").setProperty("hibernate.connection.password", "").setProperty("hibernate.hbm2ddl.auto", "update");
- ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
+ Configuration configuration = new Configuration().addAnnotatedClass(Person.class)
+ .setProperty("hibernate.dialect", HSQLDialect.class.getName())
+ .setProperty("hibernate.connection.driver_class", org.hsqldb.jdbcDriver.class.getName())
+ .setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:test")
+ .setProperty("hibernate.connection.username", "sa")
+ .setProperty("hibernate.connection.password", "")
+ .setProperty("hibernate.hbm2ddl.auto", "update");
+ ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties())
+ .build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}
@@ -34,6 +53,7 @@ public class SaveMethodsIntegrationTest {
public void setUp() {
session = sessionFactory.openSession();
session.beginTransaction();
+ doNotCommit = false;
}
@Test
@@ -43,7 +63,8 @@ public class SaveMethodsIntegrationTest {
person.setName("John");
session.persist(person);
- session.getTransaction().commit();
+ session.getTransaction()
+ .commit();
session.close();
session = sessionFactory.openSession();
@@ -68,15 +89,33 @@ public class SaveMethodsIntegrationTest {
assertEquals(id1, id2);
}
- @Test(expected = HibernateException.class)
+ @Test(expected = PersistenceException.class)
public void whenPersistDetached_thenThrowsException() {
+ doNotCommit = true;
+
Person person = new Person();
person.setName("John");
session.persist(person);
session.evict(person);
-
+
session.persist(person);
+ }
+
+ @Test
+ public void whenMergeDetached_thenEntityUpdatedFromDatabase() {
+
+ Person person = new Person();
+ person.setName("John");
+ session.save(person);
+ session.flush();
+ session.evict(person);
+
+ person.setName("Mary");
+ Person mergedPerson = (Person) session.merge(person);
+
+ assertNotSame(person, mergedPerson);
+ assertEquals("Mary", mergedPerson.getName());
}
@@ -92,7 +131,8 @@ public class SaveMethodsIntegrationTest {
assertNotNull(id);
- session.getTransaction().commit();
+ session.getTransaction()
+ .commit();
session.close();
assertEquals(id, person.getId());
@@ -128,22 +168,6 @@ public class SaveMethodsIntegrationTest {
}
- @Test
- public void whenMergeDetached_thenEntityUpdatedFromDatabase() {
-
- Person person = new Person();
- person.setName("John");
- session.save(person);
- session.evict(person);
-
- person.setName("Mary");
- Person mergedPerson = (Person) session.merge(person);
-
- assertNotSame(person, mergedPerson);
- assertEquals("Mary", mergedPerson.getName());
-
- }
-
@Test
public void whenMergeTransient_thenNewEntitySavedToDatabase() {
@@ -151,7 +175,8 @@ public class SaveMethodsIntegrationTest {
person.setName("John");
Person mergedPerson = (Person) session.merge(person);
- session.getTransaction().commit();
+ session.getTransaction()
+ .commit();
session.beginTransaction();
assertNull(person.getId());
@@ -227,7 +252,8 @@ public class SaveMethodsIntegrationTest {
person.setName("John");
session.saveOrUpdate(person);
- session.getTransaction().commit();
+ session.getTransaction()
+ .commit();
session.close();
session = sessionFactory.openSession();
@@ -250,7 +276,10 @@ public class SaveMethodsIntegrationTest {
@After
public void tearDown() {
- session.getTransaction().commit();
+ if (!doNotCommit) {
+ session.getTransaction()
+ .commit();
+ }
session.close();
}
diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java
index f7b8e6bf6d..b547a60b06 100644
--- a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java
+++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java
@@ -8,7 +8,7 @@ public class Application {
public static void main(String[] args) {
EntityManager entityManager = getJpaEntityManager();
- User user = entityManager.find(User.class, 1);
+ User user = entityManager.find(User.class, 1l);
System.out.println(user);
entityManager.getTransaction().begin();
user.setName("John");
diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java
index 927516f6bb..e70c62e77b 100644
--- a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java
+++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java
@@ -1,9 +1,9 @@
package com.baeldung.hibernate.onetoone.sharedkeybased;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
import javax.persistence.MapsId;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@@ -13,7 +13,7 @@ import javax.persistence.Table;
public class Address {
@Id
- @Column(name = "id")
+ @Column(name = "user_id")
private Long id;
@Column(name = "street")
@@ -24,6 +24,7 @@ public class Address {
@OneToOne
@MapsId
+ @JoinColumn(name = "user_id")
private User user;
public Long getId() {
diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java
index fa00db1271..605671a149 100644
--- a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java
+++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java
@@ -8,6 +8,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
@Entity
@@ -22,6 +23,7 @@ public class User {
private String userName;
@OneToOne(mappedBy = "user", cascade = CascadeType.ALL)
+ @PrimaryKeyJoinColumn
private Address address;
public Long getId() {
diff --git a/persistence-modules/hibernate-libraries/pom.xml b/persistence-modules/hibernate-libraries/pom.xml
index 808c47133c..f67309cf43 100644
--- a/persistence-modules/hibernate-libraries/pom.xml
+++ b/persistence-modules/hibernate-libraries/pom.xml
@@ -170,7 +170,6 @@
29.0-jre
2.9.7
5.4.14.Final
- 2.10.3
3.27.0-GA
2.3.1
2.0.0
diff --git a/persistence-modules/java-jpa-3/README.md b/persistence-modules/java-jpa-3/README.md
index dce9c4e711..504c7ccdd0 100644
--- a/persistence-modules/java-jpa-3/README.md
+++ b/persistence-modules/java-jpa-3/README.md
@@ -5,3 +5,4 @@ This module contains articles about the Java Persistence API (JPA) in Java.
### Relevant Articles:
- [JPA Entity Equality](https://www.baeldung.com/jpa-entity-equality)
+- [Ignoring Fields With the JPA @Transient Annotation](https://www.baeldung.com/jpa-transient-ignore-field)
diff --git a/persistence-modules/java-jpa-3/pom.xml b/persistence-modules/java-jpa-3/pom.xml
index da18ae3046..7c02cc6c8e 100644
--- a/persistence-modules/java-jpa-3/pom.xml
+++ b/persistence-modules/java-jpa-3/pom.xml
@@ -27,7 +27,21 @@
h2
${h2.version}
-
+
+ mysql
+ mysql-connector-java
+ 8.0.21
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.11.3
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-hibernate5
+ 2.9.8
+
javax.persistence
diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/HibernateConfig.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/HibernateConfig.java
new file mode 100644
index 0000000000..9285c23dfa
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/HibernateConfig.java
@@ -0,0 +1,37 @@
+package com.baeldung.ignorable.fields;
+
+import java.util.Properties;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.service.ServiceRegistry;
+
+public class HibernateConfig {
+ private static SessionFactory sessionFactory;
+
+ public static SessionFactory getSessionFactory() {
+ if (sessionFactory == null) {
+ Configuration configuration = new Configuration();
+
+ Properties settings = new Properties();
+ settings.put(Environment.DRIVER, "com.mysql.cj.jdbc.Driver");
+ settings.put(Environment.URL, "jdbc:mysql://localhost:3306/app_db?useSSL=false");
+ settings.put(Environment.USER, "root");
+ settings.put(Environment.PASS, "password");
+ settings.put(Environment.DIALECT, "org.hibernate.dialect.MySQL5Dialect");
+ settings.put(Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread");
+ configuration.setProperties(settings);
+
+ configuration.addAnnotatedClass(User.class);
+
+ ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
+ .applySettings(configuration.getProperties())
+ .build();
+
+ sessionFactory = configuration.buildSessionFactory(serviceRegistry);
+ }
+ return sessionFactory;
+ }
+}
\ No newline at end of file
diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/User.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/User.java
new file mode 100644
index 0000000000..8d1812605d
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/User.java
@@ -0,0 +1,80 @@
+package com.baeldung.ignorable.fields;
+
+import java.io.Serializable;
+import java.util.StringJoiner;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "Users")
+public class User implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+ private String email;
+ private String password;
+ @Transient
+ private String currentDevice;
+
+ // Needed for Hibernate mapping
+ public User() {
+ }
+
+ public User(String email, String password, String currentDevice) {
+ this.email = email;
+ this.password = password;
+ this.currentDevice = currentDevice;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getCurrentDevice() {
+ return currentDevice;
+ }
+
+ public void setCurrentDevice(String currentDevice) {
+ this.currentDevice = currentDevice;
+ }
+
+ @Override
+ public String toString() {
+ return new StringJoiner(", ", User.class.getSimpleName() + "[", "]").add("id=" + id)
+ .add("email='" + email + "'")
+ .add("password='" + password + "'")
+ .add("currentDevice='" + currentDevice + "'")
+ .toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (!(o instanceof User))
+ return false;
+ User user = (User) o;
+ return email.equals(user.email);
+ }
+}
\ No newline at end of file
diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/UserDao.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/UserDao.java
new file mode 100644
index 0000000000..45e491e42e
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/ignorable/fields/UserDao.java
@@ -0,0 +1,28 @@
+package com.baeldung.ignorable.fields;
+
+import java.util.List;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
+public class UserDao {
+
+ public void saveUser(User user) {
+ Transaction transaction = null;
+ try (Session session = HibernateConfig.getSessionFactory().openSession()) {
+ transaction = session.beginTransaction();
+ session.save(user);
+ transaction.commit();
+ } catch (Exception e) {
+ if (transaction != null) {
+ transaction.rollback();
+ }
+ }
+ }
+
+ public List getUsers() {
+ try (Session session = HibernateConfig.getSessionFactory().openSession()) {
+ return session.createQuery("from User", User.class).list();
+ }
+ }
+}
diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/index/Student.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/index/Student.java
new file mode 100644
index 0000000000..45de3f3fc4
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/index/Student.java
@@ -0,0 +1,70 @@
+package com.baeldung.jpa.index;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Objects;
+
+@Entity
+@Table(indexes = {
+ @Index(columnList = "firstName"),
+ @Index(name = "fn_index", columnList = "id"),
+ @Index(name = "multiIndex1", columnList = "firstName, lastName"),
+ @Index(name = "multiIndex2", columnList = "lastName, firstName"),
+ @Index(name = "multiSortIndex", columnList = "firstName, lastName DESC"),
+ @Index(name = "uniqueIndex", columnList = "firstName", unique = true),
+ @Index(name = "uniqueMultiIndex", columnList = "firstName, lastName", unique = true)
+})
+public class Student implements Serializable {
+ @Id
+ @GeneratedValue
+ private Long id;
+ private String firstName;
+ private String lastName;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Student student = (Student) o;
+ return Objects.equals(id, student.id) &&
+ Objects.equals(firstName, student.firstName) &&
+ Objects.equals(lastName, student.lastName);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, firstName, lastName);
+ }
+}
diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/LineItem.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/LineItem.java
new file mode 100644
index 0000000000..9ab2dd4e74
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/LineItem.java
@@ -0,0 +1,45 @@
+package com.baeldung.jpa.removal;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import java.util.Objects;
+
+@Entity
+public class LineItem {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long id;
+
+ private String name;
+
+ @ManyToOne
+ private OrderRequest orderRequest;
+
+ public LineItem(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ LineItem lineItem = (LineItem) o;
+
+ return Objects.equals(id, lineItem.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id != null ? id.hashCode() : 0;
+ }
+
+ protected LineItem() {
+ }
+}
diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/OrderRequest.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/OrderRequest.java
new file mode 100644
index 0000000000..739c110d8c
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/OrderRequest.java
@@ -0,0 +1,43 @@
+package com.baeldung.jpa.removal;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import java.util.List;
+
+@Entity
+public class OrderRequest {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long id;
+
+ @OneToOne(cascade = { CascadeType.REMOVE, CascadeType.PERSIST })
+ private ShipmentInfo shipmentInfo;
+
+ @OneToMany(orphanRemoval = true, cascade = CascadeType.PERSIST, mappedBy = "orderRequest")
+ private List lineItems;
+
+ public OrderRequest(ShipmentInfo shipmentInfo) {
+ this.shipmentInfo = shipmentInfo;
+ }
+
+ public OrderRequest(List lineItems) {
+ this.lineItems = lineItems;
+ }
+
+ public void removeLineItem(LineItem lineItem) {
+ lineItems.remove(lineItem);
+ }
+
+ public void setLineItems(List lineItems) {
+ this.lineItems = lineItems;
+ }
+
+ protected OrderRequest() {
+ }
+}
diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/ShipmentInfo.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/ShipmentInfo.java
new file mode 100644
index 0000000000..12274bcadf
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/removal/ShipmentInfo.java
@@ -0,0 +1,23 @@
+package com.baeldung.jpa.removal;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+@Entity
+public class ShipmentInfo {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long id;
+
+ private String name;
+
+ public ShipmentInfo(String name) {
+ this.name = name;
+ }
+
+ protected ShipmentInfo() {
+ }
+}
diff --git a/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml
index 28a929f912..1a53fb8e82 100644
--- a/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml
+++ b/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml
@@ -1,25 +1,58 @@
-
- org.hibernate.jpa.HibernatePersistenceProvider
- com.baeldung.jpa.equality.EqualByJavaDefault
- com.baeldung.jpa.equality.EqualById
- com.baeldung.jpa.equality.EqualByBusinessKey
- true
-
-
-
-
-
-
-
-
-
-
-
-
+ version="2.2">
+
+ org.hibernate.jpa.HibernatePersistenceProvider
+ com.baeldung.jpa.equality.EqualByJavaDefault
+ com.baeldung.jpa.equality.EqualById
+ com.baeldung.jpa.equality.EqualByBusinessKey
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.hibernate.jpa.HibernatePersistenceProvider
+ com.baeldung.jpa.removal.ShipmentInfo
+ com.baeldung.jpa.removal.LineItem
+ com.baeldung.jpa.removal.OrderRequest
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.hibernate.jpa.HibernatePersistenceProvider
+ com.baeldung.jpa.index.Student
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/persistence-modules/java-jpa-3/src/main/resources/logback.xml b/persistence-modules/java-jpa-3/src/main/resources/logback.xml
index 2527fea245..8000740dd1 100644
--- a/persistence-modules/java-jpa-3/src/main/resources/logback.xml
+++ b/persistence-modules/java-jpa-3/src/main/resources/logback.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/ignorable/fields/TransientFieldUnitTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/ignorable/fields/TransientFieldUnitTest.java
new file mode 100644
index 0000000000..114a4cca4c
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/ignorable/fields/TransientFieldUnitTest.java
@@ -0,0 +1,79 @@
+package com.baeldung.ignorable.fields;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import java.io.*;
+import java.util.List;
+import java.util.Random;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
+
+public class TransientFieldUnitTest {
+
+ private final UserDao userDao = new UserDao();
+
+ private final int randInt = new Random().nextInt();
+
+ private final User user = new User("user" + randInt + "@bar.com", "hunter2", "MacOSX");
+
+ @Test
+ public void givenFieldWithTransientAnnotation_whenSavingViaJPA_thenFieldIgnored() {
+ userDao.saveUser(user);
+ List allUsers = userDao.getUsers();
+ User savedUser = allUsers.get(allUsers.indexOf(user));
+
+ assertNull(savedUser.getCurrentDevice());
+ }
+
+ @Test
+ public void givenFieldWithTransientAnnotation_whenSerializingObject_thenFieldSerialized() throws IOException, ClassNotFoundException {
+
+ FileOutputStream fout = new FileOutputStream("test.obj");
+ ObjectOutputStream out = new ObjectOutputStream(fout);
+ out.writeObject(user);
+ out.flush();
+ out.close();
+
+ FileInputStream fin = new FileInputStream("test.obj");
+ ObjectInputStream in = new ObjectInputStream(fin);
+ User savedUser = (User) in.readObject();
+ in.close();
+
+ assertEquals(user.getCurrentDevice(), savedUser.getCurrentDevice());
+ }
+
+ @Test
+ public void givenFieldWithTransientAnnotation_whenSerializingToJSON_thenFieldSerialized() throws JsonProcessingException {
+ ObjectMapper objectMapper = new ObjectMapper();
+ String json = objectMapper.writeValueAsString(user);
+ User savedUser = objectMapper.readValue(json, User.class);
+
+ assertEquals(user.getCurrentDevice(), savedUser.getCurrentDevice());
+ }
+
+ @Test
+ public void givenJacksonHibernate5Module_whenSerializingTransientAnnotation_thenFieldIgnored() throws JsonProcessingException {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.registerModule(new Hibernate5Module());
+ String json = objectMapper.writeValueAsString(user);
+ User savedUser = objectMapper.readValue(json, User.class);
+
+ assertNull(savedUser.getCurrentDevice());
+ }
+
+ @Test
+ public void givenPropagateTransientFieldFlag_whenSerializingTransientAnnotation_thenFieldSerialized() throws JsonProcessingException {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.configure(MapperFeature.PROPAGATE_TRANSIENT_MARKER, true);
+ String json = objectMapper.writeValueAsString(user);
+ User savedUser = objectMapper.readValue(json, User.class);
+
+ assertEquals(user.getCurrentDevice(), savedUser.getCurrentDevice());
+ }
+}
diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/index/IndexIntegrationTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/index/IndexIntegrationTest.java
new file mode 100644
index 0000000000..f59450567b
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/index/IndexIntegrationTest.java
@@ -0,0 +1,50 @@
+package com.baeldung.jpa.index;
+
+import org.hibernate.exception.ConstraintViolationException;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import java.util.Optional;
+
+public class IndexIntegrationTest {
+ private static EntityManagerFactory factory;
+ private static EntityManager entityManager;
+
+ @BeforeClass
+ public static void setup() {
+ factory = Persistence.createEntityManagerFactory("jpa-index");
+ entityManager = factory.createEntityManager();
+ }
+
+ @Test
+ public void givenStudent_whenPersistStudentWithSameFirstName_thenConstraintViolationException() {
+ Student student = new Student();
+ student.setFirstName("FirstName");
+ student.setLastName("LastName");
+
+ Student student2 = new Student();
+ student2.setFirstName("FirstName");
+ student2.setLastName("LastName2");
+
+ entityManager.getTransaction().begin();
+ entityManager.persist(student);
+ entityManager.getTransaction().commit();
+
+ Assert.assertEquals(1L, (long) student.getId());
+
+ entityManager.getTransaction().begin();
+ try {
+ entityManager.persist(student2);
+ entityManager.getTransaction().commit();
+ Assert.fail("Should raise an exception - unique key violation");
+ } catch (Exception ex) {
+ Assert.assertTrue(Optional.of(ex).map(Throwable::getCause).map(Throwable::getCause).filter(x -> x instanceof ConstraintViolationException).isPresent());
+ } finally {
+ entityManager.getTransaction().rollback();
+ }
+ }
+}
diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/removal/CascadeTypeRemoveIntegrationTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/removal/CascadeTypeRemoveIntegrationTest.java
new file mode 100644
index 0000000000..8f99723ac6
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/removal/CascadeTypeRemoveIntegrationTest.java
@@ -0,0 +1,73 @@
+package com.baeldung.jpa.removal;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Root;
+import java.util.List;
+
+public class CascadeTypeRemoveIntegrationTest {
+
+ private static EntityManagerFactory factory;
+ private static EntityManager entityManager;
+
+ @BeforeClass
+ public static void setup() {
+ factory = Persistence.createEntityManagerFactory("jpa-h2-removal");
+ entityManager = factory.createEntityManager();
+ }
+
+ @Test
+ public void whenOrderRequestIsDeleted_thenDeleteShipmentInfo() {
+ createOrderRequestWithShipmentInfo();
+
+ OrderRequest orderRequest = entityManager.find(OrderRequest.class, 1L);
+
+ entityManager.getTransaction().begin();
+ entityManager.remove(orderRequest);
+ entityManager.getTransaction().commit();
+
+ Assert.assertEquals(0, findAllOrderRequest().size());
+ Assert.assertEquals(0, findAllShipmentInfo().size());
+ }
+
+ private void createOrderRequestWithShipmentInfo() {
+ ShipmentInfo shipmentInfo = new ShipmentInfo("name");
+ OrderRequest orderRequest = new OrderRequest(shipmentInfo);
+
+ entityManager.getTransaction().begin();
+ entityManager.persist(orderRequest);
+ entityManager.getTransaction().commit();
+
+ Assert.assertEquals(1, findAllOrderRequest().size());
+ Assert.assertEquals(1, findAllShipmentInfo().size());
+ }
+
+ private List findAllOrderRequest() {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery cq = cb.createQuery(OrderRequest.class);
+ Root root = cq.from(OrderRequest.class);
+ CriteriaQuery findAll = cq.select(root);
+ TypedQuery findAllQuery = entityManager.createQuery(findAll);
+
+ return findAllQuery.getResultList();
+ }
+
+ private List findAllShipmentInfo() {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery cq = cb.createQuery(ShipmentInfo.class);
+ Root root = cq.from(ShipmentInfo.class);
+ CriteriaQuery findAll = cq.select(root);
+ TypedQuery findAllQuery = entityManager.createQuery(findAll);
+
+ return findAllQuery.getResultList();
+ }
+
+}
diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/removal/OrphanRemovalIntegrationTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/removal/OrphanRemovalIntegrationTest.java
new file mode 100644
index 0000000000..615e8cf3a8
--- /dev/null
+++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/removal/OrphanRemovalIntegrationTest.java
@@ -0,0 +1,92 @@
+package com.baeldung.jpa.removal;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.PersistenceException;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Root;
+import java.util.ArrayList;
+import java.util.List;
+
+public class OrphanRemovalIntegrationTest {
+
+ private static EntityManagerFactory factory;
+ private static EntityManager entityManager;
+
+ @Before
+ public void setup() {
+ factory = Persistence.createEntityManagerFactory("jpa-h2-removal");
+ entityManager = factory.createEntityManager();
+ }
+
+ @Test
+ public void whenLineItemIsRemovedFromOrderRequest_thenDeleteOrphanedLineItem() {
+ createOrderRequestWithLineItems();
+
+ OrderRequest orderRequest = entityManager.find(OrderRequest.class, 1L);
+ LineItem lineItem = entityManager.find(LineItem.class, 2L);
+ orderRequest.removeLineItem(lineItem);
+
+ entityManager.getTransaction().begin();
+ entityManager.merge(orderRequest);
+ entityManager.getTransaction().commit();
+
+ Assert.assertEquals(1, findAllOrderRequest().size());
+ Assert.assertEquals(2, findAllLineItem().size());
+ }
+
+ @Test(expected = PersistenceException.class)
+ public void whenLineItemsIsReassigned_thenThrowAnException() {
+ createOrderRequestWithLineItems();
+
+ OrderRequest orderRequest = entityManager.find(OrderRequest.class, 1L);
+ orderRequest.setLineItems(new ArrayList<>());
+
+ entityManager.getTransaction().begin();
+ entityManager.merge(orderRequest);
+ entityManager.getTransaction().commit();
+ }
+
+ private void createOrderRequestWithLineItems() {
+ List lineItems = new ArrayList<>();
+ lineItems.add(new LineItem("line item 1"));
+ lineItems.add(new LineItem("line item 2"));
+ lineItems.add(new LineItem("line item 3"));
+
+ OrderRequest orderRequest = new OrderRequest(lineItems);
+
+ entityManager.getTransaction().begin();
+ entityManager.persist(orderRequest);
+ entityManager.getTransaction().commit();
+
+ Assert.assertEquals(1, findAllOrderRequest().size());
+ Assert.assertEquals(3, findAllLineItem().size());
+ }
+
+ private List findAllOrderRequest() {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery cq = cb.createQuery(OrderRequest.class);
+ Root root = cq.from(OrderRequest.class);
+ CriteriaQuery findAll = cq.select(root);
+ TypedQuery findAllQuery = entityManager.createQuery(findAll);
+
+ return findAllQuery.getResultList();
+ }
+
+ private List findAllLineItem() {
+ CriteriaBuilder cb = entityManager.getCriteriaBuilder();
+ CriteriaQuery cq = cb.createQuery(LineItem.class);
+ Root root = cq.from(LineItem.class);
+ CriteriaQuery findAll = cq.select(root);
+ TypedQuery findAllQuery = entityManager.createQuery(findAll);
+
+ return findAllQuery.getResultList();
+ }
+}
diff --git a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/enums/ArticleUnitTest.java b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/enums/ArticleUnitTest.java
index 82f3abc04d..9d98d6b86f 100644
--- a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/enums/ArticleUnitTest.java
+++ b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/enums/ArticleUnitTest.java
@@ -7,7 +7,9 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
+import javax.persistence.TypedQuery;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -19,7 +21,7 @@ public class ArticleUnitTest {
@BeforeClass
public static void setup() {
- Map properties = new HashMap();
+ Map properties = new HashMap<>();
properties.put("hibernate.show_sql", "true");
properties.put("hibernate.format_sql", "true");
emFactory = Persistence.createEntityManagerFactory("jpa-h2", properties);
@@ -115,4 +117,53 @@ public class ArticleUnitTest {
assertEquals(Category.MUSIC, persistedArticle.getCategory());
}
+ @Test
+ public void shouldFindArticleByCategory() {
+ // given
+ Article article = new Article();
+ article.setId(5);
+ article.setTitle("static");
+ article.setCategory(Category.SPORT);
+
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+ em.persist(article);
+ tx.commit();
+
+ String jpql = "select a from Article a where a.category = com.baeldung.jpa.enums.Category.SPORT";
+
+ // when
+ List articles = em.createQuery(jpql, Article.class).getResultList();
+
+ // then
+ assertEquals(1, articles.size());
+ assertEquals(Category.SPORT, articles.get(0).getCategory());
+ assertEquals("static", articles.get(0).getTitle());
+ }
+
+ @Test
+ public void shouldFindArticleByCategoryParameter() {
+ // given
+ Article article = new Article();
+ article.setId(6);
+ article.setTitle("dynamic");
+ article.setCategory(Category.TECHNOLOGY);
+
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+ em.persist(article);
+ tx.commit();
+
+ String jpql = "select a from Article a where a.category = :category";
+
+ // when
+ TypedQuery query = em.createQuery(jpql, Article.class);
+ query.setParameter("category", Category.TECHNOLOGY);
+ List articles = query.getResultList();
+
+ // then
+ assertEquals(1, articles.size());
+ assertEquals(Category.TECHNOLOGY, articles.get(0).getCategory());
+ assertEquals("dynamic", articles.get(0).getTitle());
+ }
}
\ No newline at end of file
diff --git a/persistence-modules/jooq/README.md b/persistence-modules/jooq/README.md
new file mode 100644
index 0000000000..348baab50c
--- /dev/null
+++ b/persistence-modules/jooq/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+
+- [Getting Started with jOOQ](https://www.baeldung.com/jooq-intro)
diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java
index 0427b71c25..fb3d21c467 100644
--- a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java
+++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java
@@ -19,14 +19,14 @@ public class Crud {
public static Result getAll(DSLContext context, Table extends Record> table) {
return context.select()
- .from(table)
- .fetch();
+ .from(table)
+ .fetch();
}
public static Result getFields(DSLContext context, Table extends Record> table, SelectFieldOrAsterisk... fields) {
return context.select(fields)
- .from(table)
- .fetch();
+ .from(table)
+ .fetch();
}
public static R getOne(DSLContext context, Table table, Condition condition) {
@@ -35,9 +35,9 @@ public class Crud {
public static void update(DSLContext context, Table extends Record> table, Map, T> values, Condition condition) {
context.update(table)
- .set(values)
- .where(condition)
- .execute();
+ .set(values)
+ .where(condition)
+ .execute();
}
public static > void update(UpdatableRecord record) {
@@ -46,8 +46,8 @@ public class Crud {
public static void delete(DSLContext context, Table extends Record> table, Condition condition) {
context.delete(table)
- .where(condition)
- .execute();
+ .where(condition)
+ .execute();
}
public static > void delete(UpdatableRecord record) {
diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java
index 87a7b6439e..57f6df4915 100644
--- a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java
+++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java
@@ -60,8 +60,8 @@ public class CrudExamples {
private void readValues(DSLContext context) {
Result authors = getAll(
- context,
- Author.AUTHOR
+ context,
+ Author.AUTHOR
);
authors.forEach(author -> {
@@ -73,15 +73,15 @@ public class CrudExamples {
});
Result articles = getFields(
- context,
- Author.AUTHOR,
- Article.ARTICLE.ID, Article.ARTICLE.TITLE
+ context,
+ Author.AUTHOR,
+ Article.ARTICLE.ID, Article.ARTICLE.TITLE
);
AuthorRecord author = getOne(
- context,
- Author.AUTHOR,
- Author.AUTHOR.ID.eq(1)
+ context,
+ Author.AUTHOR,
+ Author.AUTHOR.ID.eq(1)
);
}
@@ -90,24 +90,22 @@ public class CrudExamples {
fieldsToUpdate.put(Author.AUTHOR.FIRST_NAME, "David");
fieldsToUpdate.put(Author.AUTHOR.LAST_NAME, "Brown");
update(
- context,
- Author.AUTHOR,
- fieldsToUpdate,
- Author.AUTHOR.ID.eq(1)
+ context,
+ Author.AUTHOR,
+ fieldsToUpdate,
+ Author.AUTHOR.ID.eq(1)
);
ArticleRecord article = context.fetchOne(Article.ARTICLE, Article.ARTICLE.ID.eq(1));
article.setTitle("A New Article Title");
- update(
- article
- );
+ update(article);
}
private void deleteValues(DSLContext context) {
delete(
- context,
- Article.ARTICLE,
- Article.ARTICLE.ID.eq(1)
+ context,
+ Article.ARTICLE,
+ Article.ARTICLE.ID.eq(1)
);
AuthorRecord author = context.fetchOne(Author.AUTHOR, Author.AUTHOR.ID.eq(1));
diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml
index 590e5da76e..c7905a178d 100644
--- a/persistence-modules/pom.xml
+++ b/persistence-modules/pom.xml
@@ -17,6 +17,7 @@
apache-bookkeeper
apache-cayenne
core-java-persistence
+ core-java-persistence-2
deltaspike
elasticsearch
flyway
@@ -81,8 +82,7 @@
spring-data-redis
spring-data-solr
spring-hibernate-3
- spring-hibernate-5
- spring-hibernate4
+ spring-hibernate-5
spring-jpa
spring-jpa-2
spring-jdbc
diff --git a/persistence-modules/r2dbc/pom.xml b/persistence-modules/r2dbc/pom.xml
index 7083eea64d..01f1b351cd 100644
--- a/persistence-modules/r2dbc/pom.xml
+++ b/persistence-modules/r2dbc/pom.xml
@@ -69,10 +69,6 @@
0.8.1.RELEASE
1.4.200
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/redis/pom.xml b/persistence-modules/redis/pom.xml
index 9e00566767..fa82bebc64 100644
--- a/persistence-modules/redis/pom.xml
+++ b/persistence-modules/redis/pom.xml
@@ -62,10 +62,6 @@
3.3.0
4.1.50.Final
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-boot-mysql/pom.xml b/persistence-modules/spring-boot-mysql/pom.xml
index 9b8c6d0028..834d1d1e64 100644
--- a/persistence-modules/spring-boot-mysql/pom.xml
+++ b/persistence-modules/spring-boot-mysql/pom.xml
@@ -40,10 +40,6 @@
8.0.12
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-boot-persistence-2/README.md b/persistence-modules/spring-boot-persistence-2/README.md
index 392218d2bf..d7c13fd363 100644
--- a/persistence-modules/spring-boot-persistence-2/README.md
+++ b/persistence-modules/spring-boot-persistence-2/README.md
@@ -5,4 +5,6 @@
- [Integrating Spring Boot with HSQLDB](https://www.baeldung.com/spring-boot-hsqldb)
- [List of In-Memory Databases](https://www.baeldung.com/java-in-memory-databases)
- [Oracle Connection Pooling With Spring](https://www.baeldung.com/spring-oracle-connection-pooling)
+- [Object States in Hibernate’s Session](https://www.baeldung.com/hibernate-session-object-states)
+- [Storing Files Indexed by a Database](https://www.baeldung.com/java-db-storing-files)
- More articles: [[<-- prev]](../spring-boot-persistence)
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileLocationService.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileLocationService.java
new file mode 100644
index 0000000000..6b2f33e885
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileLocationService.java
@@ -0,0 +1,31 @@
+package com.baeldung.db.indexing;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Service;
+import org.springframework.web.server.ResponseStatusException;
+
+@Service
+class FileLocationService {
+
+ @Autowired
+ FileSystemRepository fileSystemRepository;
+ @Autowired
+ ImageDbRepository imageDbRepository;
+
+ Long save(byte[] bytes, String imageName) throws Exception {
+ String location = fileSystemRepository.save(bytes, imageName);
+
+ return imageDbRepository.save(new Image(imageName, location))
+ .getId();
+ }
+
+ FileSystemResource find(Long imageId) {
+ Image image = imageDbRepository.findById(imageId)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND));
+
+ return fileSystemRepository.findInFileSystem(image.getLocation());
+ }
+
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileSystemImageController.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileSystemImageController.java
new file mode 100644
index 0000000000..09e33bb943
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileSystemImageController.java
@@ -0,0 +1,30 @@
+package com.baeldung.db.indexing;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+@RestController
+@RequestMapping("file-system")
+class FileSystemImageController {
+
+ @Autowired
+ FileLocationService fileLocationService;
+
+ @PostMapping("/image")
+ Long uploadImage(@RequestParam MultipartFile image) throws Exception {
+ return fileLocationService.save(image.getBytes(), image.getOriginalFilename());
+ }
+
+ @GetMapping(value = "/image/{imageId}", produces = MediaType.IMAGE_JPEG_VALUE)
+ FileSystemResource downloadImage(@PathVariable Long imageId) throws Exception {
+ return fileLocationService.find(imageId);
+ }
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileSystemRepository.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileSystemRepository.java
new file mode 100644
index 0000000000..bc6bdecfed
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/FileSystemRepository.java
@@ -0,0 +1,36 @@
+package com.baeldung.db.indexing;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Date;
+
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.stereotype.Repository;
+
+@Repository
+class FileSystemRepository {
+
+ String RESOURCES_DIR = FileSystemRepository.class.getResource("/")
+ .getPath();
+
+ String save(byte[] content, String imageName) throws Exception {
+ Path newFile = Paths.get(RESOURCES_DIR + new Date().getTime() + "-" + imageName);
+ Files.createDirectories(newFile.getParent());
+
+ Files.write(newFile, content);
+
+ return newFile.toAbsolutePath()
+ .toString();
+ }
+
+ FileSystemResource findInFileSystem(String location) {
+ try {
+ return new FileSystemResource(Paths.get(location));
+ } catch (Exception e) {
+ // Handle access or file not found problems.
+ throw new RuntimeException();
+ }
+ }
+
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/Image.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/Image.java
new file mode 100644
index 0000000000..e3fcf53f81
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/Image.java
@@ -0,0 +1,66 @@
+package com.baeldung.db.indexing;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+
+@Entity
+class Image {
+
+ @Id
+ @GeneratedValue
+ Long id;
+
+ String name;
+
+ String location;
+
+ @Lob
+ byte[] content;
+
+ public Image() {
+ }
+
+ public Image(Long id) {
+ this.id = id;
+ }
+
+ public Image(String name, String location) {
+ this.name = name;
+ this.location = location;
+ }
+
+ public byte[] getContent() {
+ return content;
+ }
+
+ public void setContent(byte[] content) {
+ this.content = content;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageArchiveApplication.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageArchiveApplication.java
new file mode 100644
index 0000000000..02d2db32b3
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageArchiveApplication.java
@@ -0,0 +1,13 @@
+package com.baeldung.db.indexing;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ImageArchiveApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ImageArchiveApplication.class, args);
+ }
+
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageController.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageController.java
new file mode 100644
index 0000000000..1b2378a51f
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageController.java
@@ -0,0 +1,46 @@
+package com.baeldung.db.indexing;
+
+import java.io.IOException;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ByteArrayResource;
+import org.springframework.core.io.Resource;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.server.ResponseStatusException;
+
+import lombok.extern.slf4j.Slf4j;
+
+@RestController
+@Slf4j
+class ImageController {
+
+ @Autowired
+ ImageDbRepository imageDbRepository;
+
+ @PostMapping("/image")
+ long uploadImage(@RequestParam MultipartFile multipartImage) throws IOException {
+ Image dbImage = new Image();
+ dbImage.setName(multipartImage.getOriginalFilename());
+ dbImage.setContent(multipartImage.getBytes());
+
+ return imageDbRepository.save(dbImage)
+ .getId();
+ }
+
+ @GetMapping(value = "/image/{imageId}", produces = MediaType.IMAGE_JPEG_VALUE)
+ Resource downloadImage(@PathVariable Long imageId) {
+ byte[] image = imageDbRepository.findById(imageId)
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND))
+ .getContent();
+
+ return new ByteArrayResource(image);
+ }
+
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageDbRepository.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageDbRepository.java
new file mode 100644
index 0000000000..eb33f14dae
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/db/indexing/ImageDbRepository.java
@@ -0,0 +1,9 @@
+package com.baeldung.db.indexing;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+interface ImageDbRepository extends JpaRepository {
+
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/Application.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/Application.java
new file mode 100644
index 0000000000..38118354e0
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/Application.java
@@ -0,0 +1,12 @@
+package com.baeldung.states;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntity.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntity.java
new file mode 100644
index 0000000000..90bd275240
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntity.java
@@ -0,0 +1,27 @@
+package com.baeldung.states;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+@Entity
+@AllArgsConstructor
+@NoArgsConstructor
+@Getter
+@Setter
+public class UserEntity {
+ @Id
+ private String name;
+
+ @ManyToOne
+ private UserEntity manager;
+
+ public UserEntity(String name) {
+ this.name = name;
+ }
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntityWithCascade.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntityWithCascade.java
new file mode 100644
index 0000000000..de0d62bfe2
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntityWithCascade.java
@@ -0,0 +1,28 @@
+package com.baeldung.states;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+@Entity
+@AllArgsConstructor
+@NoArgsConstructor
+@Getter
+@Setter
+public class UserEntityWithCascade {
+ @Id
+ private String name;
+
+ @ManyToOne(cascade = CascadeType.PERSIST)
+ private UserEntityWithCascade manager;
+
+ public UserEntityWithCascade(String name) {
+ this.name = name;
+ }
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/db/indexing/FileSystemImageIntegrationTest.java b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/db/indexing/FileSystemImageIntegrationTest.java
new file mode 100644
index 0000000000..83f5bae095
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/db/indexing/FileSystemImageIntegrationTest.java
@@ -0,0 +1,73 @@
+package com.baeldung.db.indexing;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.BDDMockito.given;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import java.io.InputStream;
+import java.nio.file.Paths;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.MediaType;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+@SpringBootTest(classes = ImageArchiveApplication.class)
+@AutoConfigureMockMvc
+class FileSystemImageIntegrationTest {
+
+ @Autowired
+ MockMvc mockMvc;
+
+ @MockBean
+ FileLocationService fileLocationService;
+
+ @Test
+ void givenJpegImage_whenUploadIt_thenReturnItsId() throws Exception {
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+ InputStream image = classLoader.getResourceAsStream("baeldung.jpeg");
+
+ MockMultipartFile jpegImage = new MockMultipartFile("image", "baeldung", MediaType.TEXT_PLAIN_VALUE, image);
+ MockMultipartHttpServletRequestBuilder multipartRequest = MockMvcRequestBuilders.multipart("/file-system/image")
+ .file(jpegImage);
+
+ given(fileLocationService.save(jpegImage.getBytes(), "baeldung"))
+ .willReturn(1L);
+
+ MvcResult result = mockMvc.perform(multipartRequest)
+ .andExpect(status().isOk())
+ .andReturn();
+
+ assertThat(result.getResponse()
+ .getContentAsString())
+ .isEqualTo("1");
+ }
+
+ @Test
+ void givenBaeldungImage_whenDownloadIt_thenReturnTheImage() throws Exception {
+ given(fileLocationService.find(1L))
+ .willReturn(baeldungJpegResource());
+
+ mockMvc.perform(MockMvcRequestBuilders
+ .get("/file-system/image/1")
+ .contentType(MediaType.IMAGE_JPEG_VALUE))
+ .andExpect(status().isOk());
+ }
+
+ private FileSystemResource baeldungJpegResource() {
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+ String imagePath = classLoader.getResource("baeldung.jpeg")
+ .getFile();
+
+ return new FileSystemResource(Paths.get(imagePath));
+ }
+
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/db/indexing/ImageIntegrationTest.java b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/db/indexing/ImageIntegrationTest.java
new file mode 100644
index 0000000000..e38e0a21a9
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/db/indexing/ImageIntegrationTest.java
@@ -0,0 +1,78 @@
+package com.baeldung.db.indexing;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.BDDMockito.given;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Optional;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.http.MediaType;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+@SpringBootTest(classes = ImageArchiveApplication.class)
+@AutoConfigureMockMvc
+class ImageIntegrationTest {
+
+ @Autowired
+ MockMvc mockMvc;
+
+ @MockBean
+ ImageDbRepository imageRepository;
+
+ @Test
+ void givenBaeldungJpegImage_whenUploadIt_thenReturnItsId() throws Exception {
+ given(imageRepository.save(any()))
+ .willReturn(new Image(1L));
+
+ MvcResult result = mockMvc.perform(createUploadImageRequest())
+ .andExpect(status().isOk())
+ .andReturn();
+
+ assertThat(result.getResponse()
+ .getContentAsString())
+ .isEqualTo("1");
+ }
+
+ @Test
+ void givenExistingImage_whenDownloadIt_thenReturnHttpStatusOk() throws Exception {
+ given(imageRepository.findById(1L))
+ .willReturn(Optional.of(baeldungImage()));
+
+ mockMvc.perform(MockMvcRequestBuilders
+ .get("/image/1")
+ .contentType(MediaType.IMAGE_JPEG_VALUE))
+ .andExpect(status().isOk());
+ }
+
+ private MockMultipartHttpServletRequestBuilder createUploadImageRequest() throws IOException {
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+ InputStream image = classLoader.getResourceAsStream("baeldung.jpeg");
+
+ return MockMvcRequestBuilders.multipart("/image")
+ .file(new MockMultipartFile("multipartImage", "baeldung", MediaType.TEXT_PLAIN_VALUE, image));
+ }
+
+ private Image baeldungImage() throws IOException {
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+
+ Image mockImage = new Image();
+ mockImage.setContent(Files.readAllBytes(Paths.get(classLoader.getResource("baeldung.jpeg")
+ .getFile())));
+ return mockImage;
+ }
+
+}
diff --git a/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/states/UserEntityIntegrationTest.java b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/states/UserEntityIntegrationTest.java
new file mode 100644
index 0000000000..5d0dc99ad7
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/states/UserEntityIntegrationTest.java
@@ -0,0 +1,136 @@
+package com.baeldung.states;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.junit.jupiter.api.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.persistence.EntityManagerFactory;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+class UserEntityIntegrationTest {
+ @Autowired
+ private EntityManagerFactory entityManagerFactory;
+
+ @Test
+ void givenName_thenShouldCreateDetachedUserEntity() {
+ // given
+ Session session = openSession();
+ UserEntity userEntity = new UserEntity("John");
+
+ // then
+ assertThat(session.contains(userEntity)).isFalse();
+ session.close();
+ }
+
+ @Test
+ void givenName_whenPersisted_thenShouldCreatePersistentUserEntity() {
+ // given
+ Session session = openSession();
+ UserEntity userEntity = new UserEntity("John");
+
+ // when
+ session.persist(userEntity);
+
+ // then
+ assertThat(session.contains(userEntity)).isTrue();
+ session.close();
+ }
+
+ @Test
+ void givenPersistentEntity_whenSessionClosed_thenShouldDetachEntity() {
+ // given
+ Session session = openSession();
+ UserEntity userEntity = new UserEntity("John");
+ session.persist(userEntity);
+ assertThat(session.contains(userEntity)).isTrue();
+
+ // when
+ session.close();
+
+ // then
+ assertThat(session.isOpen()).isFalse();
+ assertThatThrownBy(() -> session.contains(userEntity));
+ }
+
+ @Test
+ void givenPersistentEntity_whenAddedTransientManager_thenShouldThrowException() {
+ // given
+ Session session = openSession();
+ Transaction transaction = session.beginTransaction();
+ UserEntity userEntity = new UserEntity("John");
+ session.persist(userEntity);
+ UserEntity manager = new UserEntity("Adam");
+
+ // when
+ userEntity.setManager(manager);
+
+
+ // then
+ assertThatThrownBy(() -> {
+ session.saveOrUpdate(userEntity);
+ transaction.commit();
+ });
+ session.close();
+ }
+
+ @Test
+ void givenPersistentEntity_whenAddedPersistentManager_thenShouldSave() {
+ // given
+ Session session = openSession();
+ Transaction transaction = session.beginTransaction();
+ UserEntity userEntity = new UserEntity("John");
+ session.persist(userEntity);
+ UserEntity manager = new UserEntity("Adam");
+ session.persist(manager);
+
+ // when
+ userEntity.setManager(manager);
+
+
+ // then
+ session.saveOrUpdate(userEntity);
+ transaction.commit();
+ session.close();
+
+ Session otherSession = openSession();
+ UserEntity savedUser = otherSession.get(UserEntity.class, "John");
+ assertThat(savedUser.getManager().getName()).isEqualTo("Adam");
+ }
+
+ @Test
+ void givenPersistentEntityWithCascade_whenAddedTransientManager_thenShouldSave() {
+ // given
+ Session session = openSession();
+ Transaction transaction = session.beginTransaction();
+ UserEntityWithCascade userEntity = new UserEntityWithCascade("John");
+ session.persist(userEntity);
+ UserEntityWithCascade manager = new UserEntityWithCascade("Adam");
+
+ // when
+ userEntity.setManager(manager);
+
+
+ // then
+ session.saveOrUpdate(userEntity);
+ transaction.commit();
+ session.close();
+
+ Session otherSession = openSession();
+ UserEntityWithCascade savedUser = otherSession.get(UserEntityWithCascade.class, "John");
+ assertThat(savedUser.getManager().getName()).isEqualTo("Adam");
+ }
+
+
+ private Session openSession() {
+ return entityManagerFactory.unwrap(SessionFactory.class).openSession();
+ }
+}
\ No newline at end of file
diff --git a/persistence-modules/spring-boot-persistence-2/src/test/resources/baeldung.jpeg b/persistence-modules/spring-boot-persistence-2/src/test/resources/baeldung.jpeg
new file mode 100644
index 0000000000..2654748a27
Binary files /dev/null and b/persistence-modules/spring-boot-persistence-2/src/test/resources/baeldung.jpeg differ
diff --git a/persistence-modules/spring-boot-persistence-h2/README.md b/persistence-modules/spring-boot-persistence-h2/README.md
index d11ec1f409..1d47907a98 100644
--- a/persistence-modules/spring-boot-persistence-h2/README.md
+++ b/persistence-modules/spring-boot-persistence-h2/README.md
@@ -1,5 +1,7 @@
### Relevant Articles:
+
- [Access the Same In-Memory H2 Database in Multiple Spring Boot Applications](https://www.baeldung.com/spring-boot-access-h2-database-multiple-apps)
- [Spring Boot With H2 Database](https://www.baeldung.com/spring-boot-h2-database)
- [Hibernate @NotNull vs @Column(nullable = false)](https://www.baeldung.com/hibernate-notnull-vs-nullable)
- [Quick Guide to Hibernate enable_lazy_load_no_trans Property](https://www.baeldung.com/hibernate-lazy-loading-workaround)
+- [Where Does H2’s Embedded Database Store The Data?](https://www.baeldung.com/h2-embedded-db-data-storage)
diff --git a/persistence-modules/spring-boot-persistence-h2/pom.xml b/persistence-modules/spring-boot-persistence-h2/pom.xml
index 23520a3fda..c06c35cfee 100644
--- a/persistence-modules/spring-boot-persistence-h2/pom.xml
+++ b/persistence-modules/spring-boot-persistence-h2/pom.xml
@@ -47,10 +47,6 @@
com.baeldung.h2db.demo.server.SpringBootApp
1.0.4
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties
new file mode 100644
index 0000000000..be939ffa69
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties
@@ -0,0 +1,10 @@
+#spring.datasource.url=jdbc:h2:file:C:/data/demodb
+#spring.datasource.url=jdbc:h2:file:~/demodb
+spring.datasource.url=jdbc:h2:file:./src/main/resources/db/demodb
+spring.datasource.driverClassName=org.h2.Driver
+spring.datasource.username=sa
+spring.datasource.password=
+spring.h2.console.enabled=true
+spring.jpa.hibernate.ddl-auto=create-drop
+spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
+spring.h2.console.path=/h2-console
diff --git a/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/persistent/FilesLocationUnitTest.java b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/persistent/FilesLocationUnitTest.java
new file mode 100644
index 0000000000..63f195e88d
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/persistent/FilesLocationUnitTest.java
@@ -0,0 +1,52 @@
+package com.baeldung.persistent;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.h2db.auto.configuration.AutoConfigurationDemo;
+
+@ActiveProfiles("persistent-on")
+@RunWith(SpringRunner.class)
+@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
+@SpringBootTest(classes = AutoConfigurationDemo.class)
+public class FilesLocationUnitTest {
+
+ @BeforeClass
+ public static void beforeClass() {
+
+ }
+
+ @Test(expected = Test.None.class)
+ public void whenApplicationStarted_thenEmbeddedDbSubfolderCreated() {
+ File subdirectory = new File("src/main/resources/db");
+ System.out.println(subdirectory.getAbsolutePath());
+ assertTrue(subdirectory.exists());
+ assertTrue(subdirectory.isDirectory());
+ }
+
+ @Test(expected = Test.None.class)
+ public void whenApplicationStarted_thenEmbeddedDbFilesCreated() {
+ File dbFile = new File("src/main/resources/db/demodb.mv.db");
+ System.out.println(dbFile.getAbsolutePath());
+
+ assertTrue(dbFile.exists());
+ assertTrue(dbFile.isFile());
+ }
+
+ @AfterClass
+ public static void cleanUp() {
+ File dbFile = new File("src/main/resources/db/demodb.mv.db");
+ dbFile.deleteOnExit();
+ }
+}
diff --git a/persistence-modules/spring-boot-persistence-mongodb/pom.xml b/persistence-modules/spring-boot-persistence-mongodb/pom.xml
index 69ef09356d..5167483aa3 100644
--- a/persistence-modules/spring-boot-persistence-mongodb/pom.xml
+++ b/persistence-modules/spring-boot-persistence-mongodb/pom.xml
@@ -37,9 +37,5 @@
-
- 2.22.2
- 5.6.2
- 4.13
\ No newline at end of file
diff --git a/persistence-modules/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml
index b034f6dad9..9e44a7b9c1 100644
--- a/persistence-modules/spring-boot-persistence/pom.xml
+++ b/persistence-modules/spring-boot-persistence/pom.xml
@@ -76,11 +76,6 @@
2.23.0
2.0.1.Final
-
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-cassandra-reactive/pom.xml b/persistence-modules/spring-data-cassandra-reactive/pom.xml
index 42329e03f0..f2f71bceac 100644
--- a/persistence-modules/spring-data-cassandra-reactive/pom.xml
+++ b/persistence-modules/spring-data-cassandra-reactive/pom.xml
@@ -54,10 +54,6 @@
2.2.6.RELEASE
3.11.2.0
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-cassandra/pom.xml b/persistence-modules/spring-data-cassandra/pom.xml
index a56d067a05..9de1cbf20e 100644
--- a/persistence-modules/spring-data-cassandra/pom.xml
+++ b/persistence-modules/spring-data-cassandra/pom.xml
@@ -105,10 +105,6 @@
2.1.9.2
2.0-0
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml
index 0f9e8ac72f..19a66648b2 100644
--- a/persistence-modules/spring-data-cosmosdb/pom.xml
+++ b/persistence-modules/spring-data-cosmosdb/pom.xml
@@ -17,10 +17,6 @@
1.8
2.3.0
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-dynamodb/pom.xml b/persistence-modules/spring-data-dynamodb/pom.xml
index 0f4b578088..377e35b635 100644
--- a/persistence-modules/spring-data-dynamodb/pom.xml
+++ b/persistence-modules/spring-data-dynamodb/pom.xml
@@ -182,11 +182,6 @@
1.11.86
https://s3-us-west-2.amazonaws.com/dynamodb-local/release
3.1.1
-
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml
index c94962d39d..6a983145ee 100644
--- a/persistence-modules/spring-data-elasticsearch/pom.xml
+++ b/persistence-modules/spring-data-elasticsearch/pom.xml
@@ -69,10 +69,5 @@
1.2.47
0.7
1.15.0
-
-
- 2.22.2
- 5.6.2
- 4.13
\ No newline at end of file
diff --git a/persistence-modules/spring-data-jdbc/pom.xml b/persistence-modules/spring-data-jdbc/pom.xml
index eca8037e20..15f8d7fb95 100644
--- a/persistence-modules/spring-data-jdbc/pom.xml
+++ b/persistence-modules/spring-data-jdbc/pom.xml
@@ -28,9 +28,5 @@
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-jpa-annotations/pom.xml b/persistence-modules/spring-data-jpa-annotations/pom.xml
index ea2fe34f3c..ff30790eaf 100644
--- a/persistence-modules/spring-data-jpa-annotations/pom.xml
+++ b/persistence-modules/spring-data-jpa-annotations/pom.xml
@@ -73,10 +73,6 @@
42.2.5
21.0
-
- 2.22.2
- 5.6.2
- 4.13
\ No newline at end of file
diff --git a/persistence-modules/spring-data-jpa-crud/pom.xml b/persistence-modules/spring-data-jpa-crud/pom.xml
index 44944298e0..16ee74aa62 100644
--- a/persistence-modules/spring-data-jpa-crud/pom.xml
+++ b/persistence-modules/spring-data-jpa-crud/pom.xml
@@ -16,10 +16,6 @@
-
- org.springframework.boot
- spring-boot-starter-web
-
org.springframework.boot
spring-boot-starter-data-jpa
@@ -66,11 +62,6 @@
1.4.1
21.0
1.12.2
-
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-jpa-enterprise/pom.xml b/persistence-modules/spring-data-jpa-enterprise/pom.xml
index 9ecab5feaa..7ff2f00fdf 100644
--- a/persistence-modules/spring-data-jpa-enterprise/pom.xml
+++ b/persistence-modules/spring-data-jpa-enterprise/pom.xml
@@ -99,10 +99,6 @@
21.0
1.12.2
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-jpa-filtering/pom.xml b/persistence-modules/spring-data-jpa-filtering/pom.xml
index 7448a5a818..25ef68fe4c 100644
--- a/persistence-modules/spring-data-jpa-filtering/pom.xml
+++ b/persistence-modules/spring-data-jpa-filtering/pom.xml
@@ -73,10 +73,6 @@
42.2.5
21.0
-
- 2.22.2
- 5.6.2
- 4.13
\ No newline at end of file
diff --git a/persistence-modules/spring-data-jpa-query-2/README.md b/persistence-modules/spring-data-jpa-query-2/README.md
index fdb4ce3db7..36875c899c 100644
--- a/persistence-modules/spring-data-jpa-query-2/README.md
+++ b/persistence-modules/spring-data-jpa-query-2/README.md
@@ -3,9 +3,15 @@
This module contains articles about querying data using Spring Data JPA
### Relevant Articles:
-- [Spring Data JPA @Query Annotation](https://www.baeldung.com/spring-data-jpa-query)
+- [Spring Data JPA @Query](https://www.baeldung.com/spring-data-jpa-query)
- [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries)
- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date)
+- [Hibernate Pagination](https://www.baeldung.com/hibernate-pagination)
+- [Sorting with Hibernate](https://www.baeldung.com/hibernate-sort)
+- [Stored Procedures with Hibernate](https://www.baeldung.com/stored-procedures-with-hibernate-tutorial)
+- [Eager/Lazy Loading In Hibernate](https://www.baeldung.com/hibernate-lazy-eager-loading)
+- [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa)
+
- More articles: [[<-- prev]](../spring-data-jpa-query)
### Eclipse Config
diff --git a/persistence-modules/spring-data-jpa-query-2/pom.xml b/persistence-modules/spring-data-jpa-query-2/pom.xml
index 231640284e..282a1ff83a 100644
--- a/persistence-modules/spring-data-jpa-query-2/pom.xml
+++ b/persistence-modules/spring-data-jpa-query-2/pom.xml
@@ -18,6 +18,10 @@
org.springframework.boot
spring-boot-starter-data-jpa
+
+ org.springframework.security
+ spring-security-core
+
com.h2database
@@ -28,12 +32,62 @@
com.fasterxml.jackson.core
jackson-databind
+
+
+ org.hibernate
+ hibernate-envers
+
+
+ javax.transaction
+ jta
+ ${jta.version}
+
+
+ mysql
+ mysql-connector-java
+
+
+ com.google.guava
+ guava
+ ${guava.version}
+
+
+ org.apache.tomcat
+ tomcat-dbcp
+ ${tomcat-dbcp.version}
+
+
+ org.hibernate
+ hibernate-core
+ ${hibernate.version}
+
+
+ org.hibernate
+ hibernate-envers
+ ${hibernate.version}
+
+
+ org.springframework
+ spring-test
+ test
+
+
+ org.springframework.security
+ spring-security-test
+ test
+
+
+ org.hsqldb
+ hsqldb
+ test
+
-
- 2.22.2
- 5.6.2
- 4.13
+ 9.0.0.M26
+ 1.1
+ 21.0
+
+ 5.2.10.Final
\ No newline at end of file
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java
similarity index 95%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java
index 4927c9957c..a0d70ed006 100644
--- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring;
+package com.baeldung.config;
import java.util.Properties;
@@ -15,8 +15,8 @@ import org.springframework.dao.annotation.PersistenceExceptionTranslationPostPro
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
-import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
+import org.springframework.orm.hibernate5.HibernateTransactionManager;
+import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
@@ -47,7 +47,7 @@ import com.google.common.base.Preconditions;
@Configuration
@EnableTransactionManagement
-@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager")
+@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager", entityManagerFactoryRef = "jpaEntityManager")
@EnableJpaAuditing(auditorAwareRef = "auditorProvider")
@PropertySource({ "classpath:persistence-h2.properties" })
@ComponentScan({ "com.baeldung.persistence" })
@@ -75,7 +75,7 @@ public class PersistenceConfig {
return sessionFactory;
}
- @Bean
+ @Bean("jpaEntityManager")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(restDataSource());
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceXmlConfig.java
similarity index 94%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceXmlConfig.java
index 9cbeb8e1f8..388494b21a 100644
--- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceXmlConfig.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring;
+package com.baeldung.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java
similarity index 80%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java
index 7aef08b2ce..5dd12e6841 100644
--- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java
@@ -9,11 +9,10 @@ import org.springframework.security.core.context.SecurityContextHolder;
public class AuditorAwareImpl implements AuditorAware {
@Override
- public String getCurrentAuditor() {
+ public Optional getCurrentAuditor() {
return Optional.ofNullable(SecurityContextHolder.getContext())
.map(e -> e.getAuthentication())
- .map(Authentication::getName)
- .orElse(null);
+ .map(Authentication::getName);
}
}
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java
diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java
deleted file mode 100644
index 48620f4ff1..0000000000
--- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.baeldung.persistence.dao;
-
-import com.baeldung.persistence.model.Book;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-
-public interface BookRepository extends JpaRepository, BookRepositoryCustom, JpaSpecificationExecutor {
-
-}
diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java
deleted file mode 100644
index eda34542df..0000000000
--- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.baeldung.persistence.dao;
-
-import com.baeldung.persistence.model.Book;
-
-import java.util.List;
-
-public interface BookRepositoryCustom {
-
- List findBooksByAuthorNameAndTitle(String authorName, String title);
-
-}
diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java
deleted file mode 100644
index 7f5bedd018..0000000000
--- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.baeldung.persistence.dao;
-
-import com.baeldung.persistence.model.Book;
-import org.springframework.stereotype.Repository;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import java.util.ArrayList;
-import java.util.List;
-
-@Repository
-public class BookRepositoryImpl implements BookRepositoryCustom {
-
- private EntityManager em;
-
- public BookRepositoryImpl(EntityManager em) {
- this.em = em;
- }
-
- @Override
- public List findBooksByAuthorNameAndTitle(String authorName, String title) {
- CriteriaBuilder cb = em.getCriteriaBuilder();
- CriteriaQuery cq = cb.createQuery(Book.class);
-
- Root book = cq.from(Book.class);
- List predicates = new ArrayList<>();
-
- if (authorName != null) {
- predicates.add(cb.equal(book.get("author"), authorName));
- }
- if (title != null) {
- predicates.add(cb.like(book.get("title"), "%" + title + "%"));
- }
- cq.where(predicates.toArray(new Predicate[0]));
-
- TypedQuery query = em.createQuery(cq);
- return query.getResultList();
- }
-
-}
diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java
deleted file mode 100644
index 4165cd8eb9..0000000000
--- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.baeldung.persistence.dao;
-
-import com.baeldung.persistence.model.Book;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-import static com.baeldung.persistence.dao.BookSpecifications.hasAuthor;
-import static com.baeldung.persistence.dao.BookSpecifications.titleContains;
-import static org.springframework.data.jpa.domain.Specification.where;
-
-@Service
-public class BookService {
-
- private BookRepository bookRepository;
-
- public BookService(BookRepository bookRepository) {
- this.bookRepository = bookRepository;
- }
-
- public List query(String author, String title) {
- return bookRepository.findAll(where(hasAuthor(author)).and(titleContains(title)));
- }
-
-}
diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java
deleted file mode 100644
index 16646a5b4b..0000000000
--- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.baeldung.persistence.dao;
-
-import com.baeldung.persistence.model.Book;
-import org.springframework.data.jpa.domain.Specification;
-
-public class BookSpecifications {
-
- public static Specification hasAuthor(String author) {
- return (book, cq, cb) -> cb.equal(book.get("author"), author);
- }
-
- public static Specification titleContains(String title) {
- return (book, cq, cb) -> cb.like(book.get("title"), "%" + title + "%");
- }
-
-}
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IChildDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IChildDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IParentDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IParentDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java
similarity index 96%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java
index 69f8e58c25..79bdd86658 100644
--- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java
@@ -12,7 +12,7 @@ import javax.persistence.criteria.Root;
public class AbstractJpaDao extends AbstractDao implements IOperations {
- @PersistenceContext
+ @PersistenceContext(unitName = "jpaEntityManager")
private EntityManager em;
// API
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IOperations.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IOperations.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Bar.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Bar.java
diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java
deleted file mode 100644
index 507043dd56..0000000000
--- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.baeldung.persistence.model;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-
-@Entity
-public class Book {
-
- @Id
- private Long id;
-
- private String title;
-
- private String author;
-
- public Long getId() {
- return id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
-}
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Child.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Child.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Foo.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Foo.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Parent.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Parent.java
diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Person.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Person.java
new file mode 100644
index 0000000000..6a95a7acf5
--- /dev/null
+++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Person.java
@@ -0,0 +1,31 @@
+package com.baeldung.persistence.model;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class Person {
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ private String name;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IChildService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IChildService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IParentService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IParentService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java
similarity index 86%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java
index cef483e6bf..73fe27e9ec 100644
--- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java
@@ -2,6 +2,7 @@ package com.baeldung.persistence.service.common;
import java.io.Serializable;
import java.util.List;
+import java.util.Optional;
import com.baeldung.persistence.dao.common.IOperations;
import org.springframework.data.repository.CrudRepository;
@@ -14,7 +15,8 @@ public abstract class AbstractSpringDataJpaService imple
@Override
public T findOne(final long id) {
- return getDao().findOne(Long.valueOf(id));
+ Optional opt = getDao().findById(Long.valueOf(id));
+ return opt.get();
}
@Override
@@ -39,7 +41,7 @@ public abstract class AbstractSpringDataJpaService imple
@Override
public void deleteById(final long entityId) {
- getDao().delete(Long.valueOf(entityId));
+ getDao().deleteById(Long.valueOf(entityId));
}
protected abstract CrudRepository getDao();
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ChildService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ChildService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ParentService.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java
rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ParentService.java
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching_create_queries.sql
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching_create_queries.sql
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Config.xml
similarity index 92%
rename from persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Config.xml
index ca507802cd..bbb61cb3e0 100644
--- a/persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml
+++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Config.xml
@@ -7,7 +7,7 @@
-
+
@@ -21,11 +21,11 @@
-
+
-
+
diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Configuration.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Configuration.xml
new file mode 100644
index 0000000000..1870cfb917
--- /dev/null
+++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Configuration.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+ ${hibernate.hbm2ddl.auto}
+ ${hibernate.dialect}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/immutable.cfg.xml
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/immutable.cfg.xml
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql b/persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_statements.sql
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_statements.sql
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/logback.xml
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/logback.xml
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/logback.xml
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties b/persistence-modules/spring-data-jpa-query-2/src/main/resources/persistence-mysql.properties
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/persistence-mysql.properties
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql b/persistence-modules/spring-data-jpa-query-2/src/main/resources/stored_procedure.sql
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/stored_procedure.sql
diff --git a/persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/webSecurityConfig.xml
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml
rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/webSecurityConfig.xml
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java
similarity index 98%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java
index 733074a6a3..f591773cde 100644
--- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java
@@ -47,6 +47,7 @@ public class JPABarAuditIntegrationTest {
private IBarService barService;
@Autowired
+ @Qualifier("jpaEntityManager")
private EntityManagerFactory entityManagerFactory;
private EntityManager em;
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java
similarity index 98%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java
index 18227abd28..0603067810 100644
--- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java
@@ -46,6 +46,7 @@ public class SpringDataJPABarAuditIntegrationTest {
private IBarService barService;
@Autowired
+ @Qualifier("jpaEntityManager")
private EntityManagerFactory entityManagerFactory;
private EntityManager em;
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
similarity index 98%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
index d9353f1ad1..8bf33c4110 100644
--- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java
@@ -21,8 +21,8 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
+import com.baeldung.config.PersistenceConfig;
import com.baeldung.persistence.model.Foo;
-import com.baeldung.spring.PersistenceConfig;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java
similarity index 96%
rename from persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java
rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java
index 9bf55c902a..34301741fe 100644
--- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java
@@ -14,8 +14,8 @@ import org.springframework.core.env.Environment;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
-import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
+import org.springframework.orm.hibernate5.HibernateTransactionManager;
+import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
@@ -45,7 +45,7 @@ import com.google.common.base.Preconditions;
@Configuration
@EnableTransactionManagement
-@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager")
+@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager", entityManagerFactoryRef = "jpaEntityManager")
@EnableJpaAuditing
@PropertySource({ "classpath:persistence-h2.properties" })
@ComponentScan({ "com.baeldung.persistence" })
@@ -68,7 +68,7 @@ public class PersistenceTestConfig {
return sessionFactory;
}
- @Bean
+ @Bean("jpaEntityManager")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(restDataSource());
diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java
index 38fd804195..b1158b3dae 100644
--- a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java
+++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java
@@ -6,6 +6,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner;
+import com.baeldung.spring.data.jpa.query.datetime.Article;
+import com.baeldung.spring.data.jpa.query.datetime.ArticleRepository;
+
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.List;
diff --git a/persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml
rename to persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml
diff --git a/persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml
rename to persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml
diff --git a/persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties b/persistence-modules/spring-data-jpa-query-2/src/test/resources/persistence-h2.properties
similarity index 100%
rename from persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties
rename to persistence-modules/spring-data-jpa-query-2/src/test/resources/persistence-h2.properties
diff --git a/persistence-modules/spring-data-jpa-query/pom.xml b/persistence-modules/spring-data-jpa-query/pom.xml
index fe42d4b595..1576fd729d 100644
--- a/persistence-modules/spring-data-jpa-query/pom.xml
+++ b/persistence-modules/spring-data-jpa-query/pom.xml
@@ -44,10 +44,6 @@
1.4.1
-
- 2.22.2
- 5.6.2
- 4.13
\ No newline at end of file
diff --git a/persistence-modules/spring-data-jpa-repo-2/pom.xml b/persistence-modules/spring-data-jpa-repo-2/pom.xml
index 98ecdc6645..3be1068d8c 100644
--- a/persistence-modules/spring-data-jpa-repo-2/pom.xml
+++ b/persistence-modules/spring-data-jpa-repo-2/pom.xml
@@ -44,9 +44,5 @@
29.0-jre
-
- 2.22.2
- 5.6.2
- 4.13
\ No newline at end of file
diff --git a/persistence-modules/spring-data-jpa-repo/pom.xml b/persistence-modules/spring-data-jpa-repo/pom.xml
index 07514e9771..16a214fd7f 100644
--- a/persistence-modules/spring-data-jpa-repo/pom.xml
+++ b/persistence-modules/spring-data-jpa-repo/pom.xml
@@ -50,9 +50,6 @@
-
- 2.22.2
- 5.6.2
- 4.13
+
\ No newline at end of file
diff --git a/persistence-modules/spring-data-keyvalue/pom.xml b/persistence-modules/spring-data-keyvalue/pom.xml
index 190d6c7445..3aaee2f00c 100644
--- a/persistence-modules/spring-data-keyvalue/pom.xml
+++ b/persistence-modules/spring-data-keyvalue/pom.xml
@@ -29,9 +29,6 @@
-
- 2.22.2
- 5.6.2
- 4.13
+
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml
index a3a81fe450..448b635667 100644
--- a/persistence-modules/spring-data-mongodb/pom.xml
+++ b/persistence-modules/spring-data-mongodb/pom.xml
@@ -108,10 +108,6 @@
3.2.0.RELEASE
4.0.5
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-redis/pom.xml b/persistence-modules/spring-data-redis/pom.xml
index 34674dc223..d271df31c7 100644
--- a/persistence-modules/spring-data-redis/pom.xml
+++ b/persistence-modules/spring-data-redis/pom.xml
@@ -98,11 +98,6 @@
3.2.4
0.10.0
0.6
-
-
- 2.22.2
- 5.6.2
- 4.13
diff --git a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java
index 497e1506bd..7fd13d2777 100644
--- a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java
+++ b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java
@@ -5,7 +5,6 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
-import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextTest.java
index 4df0cbd0ad..5167e63721 100644
--- a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextTest.java
+++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextTest.java
@@ -1,16 +1,32 @@
package com.baeldung;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import com.baeldung.spring.data.redis.config.RedisConfig;
+import com.baeldung.spring.data.redis.SpringRedisApplication;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = RedisConfig.class)
+import redis.embedded.RedisServerBuilder;
+
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisApplication.class)
+@DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
public class SpringContextTest {
+
+ private static redis.embedded.RedisServer redisServer;
+
+ @BeforeClass
+ public static void startRedisServer() {
+ redisServer = new RedisServerBuilder().port(6379).setting("maxmemory 256M").build();
+ redisServer.start();
+ }
+ @AfterClass
+ public static void stopRedisServer() {
+ redisServer.stop();
+ }
@Test
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
}
diff --git a/persistence-modules/spring-data-solr/pom.xml b/persistence-modules/spring-data-solr/pom.xml
index 94a796c466..38b5bf8238 100644
--- a/persistence-modules/spring-data-solr/pom.xml
+++ b/persistence-modules/spring-data-solr/pom.xml
@@ -46,10 +46,6 @@
2.0.5.RELEASE
-
- 2.22.2
- 5.6.2
- 4.13
\ No newline at end of file
diff --git a/persistence-modules/spring-hibernate-5/README.md b/persistence-modules/spring-hibernate-5/README.md
index 6d7526a13b..eff59a0362 100644
--- a/persistence-modules/spring-hibernate-5/README.md
+++ b/persistence-modules/spring-hibernate-5/README.md
@@ -12,4 +12,5 @@ This module contains articles about Hibernate 5 with Spring.
- [Hibernate Second-Level Cache](http://www.baeldung.com/hibernate-second-level-cache)
- [Deleting Objects with Hibernate](http://www.baeldung.com/delete-with-hibernate)
- [Spring, Hibernate and a JNDI Datasource](http://www.baeldung.com/spring-persistence-jpa-jndi-datasource)
-- [@Immutable in Hibernate](http://www.baeldung.com/hibernate-immutable)
\ No newline at end of file
+- [@Immutable in Hibernate](http://www.baeldung.com/hibernate-immutable)
+- [Bootstrapping Hibernate 5 with Spring](https://www.baeldung.com/hibernate-5-spring)
diff --git a/persistence-modules/spring-hibernate4/.gitignore b/persistence-modules/spring-hibernate4/.gitignore
deleted file mode 100644
index d31cc4c619..0000000000
--- a/persistence-modules/spring-hibernate4/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-*.class
-
-#folders#
-/target
-/neoDb*
-/data
-/src/main/webapp/WEB-INF/classes
-*/META-INF/*
-
-# Packaged files #
-*.jar
-*.war
-*.ear
-/target/
-/target/
diff --git a/persistence-modules/spring-hibernate4/README.md b/persistence-modules/spring-hibernate4/README.md
deleted file mode 100644
index a5a72a9b7e..0000000000
--- a/persistence-modules/spring-hibernate4/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-## Spring with Hibernate 4
-
-This module contains articles about Spring with Hibernate 4
-
-### Relevant Articles:
-- [Guide to Hibernate 4 with Spring](https://www.baeldung.com/hibernate-4-spring)
-- [Hibernate Pagination](https://www.baeldung.com/hibernate-pagination)
-- [Sorting with Hibernate](https://www.baeldung.com/hibernate-sort)
-- [Stored Procedures with Hibernate](https://www.baeldung.com/stored-procedures-with-hibernate-tutorial)
-- [Hibernate: save, persist, update, merge, saveOrUpdate](https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate)
-- [Eager/Lazy Loading In Hibernate](https://www.baeldung.com/hibernate-lazy-eager-loading)
-- [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa)
-
-### Quick Start
-
-```
-git clone git://github.com/eugenp/REST.git
-cd REST
-mvn install
-mvn cargo:run
-```
-
-- **note**: starts on port `8082`
-
diff --git a/persistence-modules/spring-hibernate4/pom.xml b/persistence-modules/spring-hibernate4/pom.xml
deleted file mode 100644
index 3e5a6f913f..0000000000
--- a/persistence-modules/spring-hibernate4/pom.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-
-
- 4.0.0
- spring-hibernate4
- 0.1-SNAPSHOT
- spring-hibernate4
-
-
- com.baeldung
- parent-spring-4
- 0.0.1-SNAPSHOT
- ../../parent-spring-4
-
-
-
-
-
-
- org.springframework
- spring-context
- ${org.springframework.version}
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.springframework
- spring-aspects
- ${org.springframework.version}
-
-
- org.springframework.security
- spring-security-core
- ${org.springframework.security.version}
-
-
-
-
-
- org.springframework
- spring-orm
- ${org.springframework.version}
-
-
- org.springframework.data
- spring-data-jpa
- ${org.springframework.data.version}
-
-
- org.hibernate
- hibernate-core
- ${hibernate.version}
-
-
- org.hibernate
- hibernate-envers
- ${hibernate-envers.version}
-
-
- javax.transaction
- jta
- ${jta.version}
-
-
- mysql
- mysql-connector-java
- ${mysql-connector-java.version}
-
-
-
- org.apache.tomcat
- tomcat-dbcp
- ${tomcat-dbcp.version}
-
-
-
-
-
- org.hibernate
- hibernate-validator
- ${hibernate-validator.version}
-
-
- javax.el
- javax.el-api
- ${javax.el-api.version}
-
-
-
-
-
- com.google.guava
- guava
- ${guava.version}
-
-
-
-
-
- org.apache.commons
- commons-lang3
- ${commons-lang3.version}
- test
-
-
-
- org.springframework
- spring-test
- ${org.springframework.version}
- test
-
-
-
- org.springframework.security
- spring-security-test
- ${org.springframework.security.version}
- test
-
-
-
- org.hsqldb
- hsqldb
- ${hsqldb.version}
- test
-
-
- com.h2database
- h2
- ${h2.version}
- test
-
-
-
-
-
-
- 4.3.4.RELEASE
- 4.2.0.RELEASE
- 1.10.5.RELEASE
-
-
- 4.3.11.Final
- ${hibernate.version}
- 5.1.40
- 8.5.8
- 1.1
- 2.3.4
-
-
- 5.3.3.Final
- 2.2.5
-
-
- 19.0
-
-
- 2.22.2
- 5.6.2
- 4.13
-
-
-
diff --git a/persistence-modules/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
deleted file mode 100644
index 957207b7e6..0000000000
--- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.baeldung.hibernate.criteria.model;
-
-import java.io.Serializable;
-
-public class Item implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private Integer itemId;
- private String itemName;
- private String itemDescription;
- private Integer itemPrice;
-
- // constructors
- public Item() {
-
- }
-
- public Item(final Integer itemId, final String itemName, final String itemDescription) {
- super();
- this.itemId = itemId;
- this.itemName = itemName;
- this.itemDescription = itemDescription;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((itemId == null) ? 0 : itemId.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final Item other = (Item) obj;
- if (itemId == null) {
- if (other.itemId != null)
- return false;
- } else if (!itemId.equals(other.itemId))
- return false;
- return true;
- }
-
- public Integer getItemId() {
- return itemId;
- }
-
- public void setItemId(final Integer itemId) {
- this.itemId = itemId;
- }
-
- public String getItemName() {
- return itemName;
- }
-
- public void setItemName(final String itemName) {
- this.itemName = itemName;
- }
-
- public String getItemDescription() {
- return itemDescription;
- }
-
- public Integer getItemPrice() {
- return itemPrice;
- }
-
- public void setItemPrice(final Integer itemPrice) {
- this.itemPrice = itemPrice;
- }
-
- public void setItemDescription(final String itemDescription) {
- this.itemDescription = itemDescription;
- }
-}
diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java
deleted file mode 100644
index e19965773e..0000000000
--- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.baeldung;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.AnnotationConfigContextLoader;
-
-import com.baeldung.spring.PersistenceConfig;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class SpringContextTest {
-
- @Test
- public void whenSpringContextIsBootstrapped_thenNoExceptions() {
- }
-}
diff --git a/persistence-modules/spring-hibernate4/src/test/resources/.gitignore b/persistence-modules/spring-hibernate4/src/test/resources/.gitignore
deleted file mode 100644
index 83c05e60c8..0000000000
--- a/persistence-modules/spring-hibernate4/src/test/resources/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-*.class
-
-#folders#
-/target
-/neoDb*
-/data
-/src/main/webapp/WEB-INF/classes
-*/META-INF/*
-
-# Packaged files #
-*.jar
-*.war
-*.ear
\ No newline at end of file
diff --git a/persistence-modules/spring-jdbc/README.md b/persistence-modules/spring-jdbc/README.md
index 58d7bdec43..1433344b7a 100644
--- a/persistence-modules/spring-jdbc/README.md
+++ b/persistence-modules/spring-jdbc/README.md
@@ -1,6 +1,6 @@
## Spring JDBC
### Relevant Articles:
-- [Spring JDBC Template](https://www.baeldung.com/spring-jdbc-jdbctemplate)
-- [Spring JDBC Template Testing](https://www.baeldung.com/spring-jdbctemplate-testing)
-- [Spring JDBC Template In Clause](https://www.baeldung.com/spring-jdbctemplate-in-list)
\ No newline at end of file
+- [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate)
+- [Spring JdbcTemplate Unit Testing](https://www.baeldung.com/spring-jdbctemplate-testing)
+- [Using a List of Values in a JdbcTemplate IN Clause](https://www.baeldung.com/spring-jdbctemplate-in-list)
diff --git a/persistence-modules/spring-jdbc/pom.xml b/persistence-modules/spring-jdbc/pom.xml
index 77200cd66e..8a5786e1a5 100644
--- a/persistence-modules/spring-jdbc/pom.xml
+++ b/persistence-modules/spring-jdbc/pom.xml
@@ -18,7 +18,6 @@
org.springframework.data
spring-data-jdbc
- ${spring-data-jdbc.version}
org.springframework.boot
@@ -36,11 +35,5 @@
- 2.0.3.RELEASE
-
-
- 2.22.2
- 5.6.2
- 4.13
\ No newline at end of file
diff --git a/persistence-modules/spring-jpa-2/README.md b/persistence-modules/spring-jpa-2/README.md
index fe661c2f28..59543cade7 100644
--- a/persistence-modules/spring-jpa-2/README.md
+++ b/persistence-modules/spring-jpa-2/README.md
@@ -3,8 +3,7 @@
### Relevant Articles:
- [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many)
- [A Guide to JPA with Spring](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa)
-- [Bootstrapping Hibernate 5 with Spring](https://www.baeldung.com/hibernate-5-spring)
- [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring)
- [The DAO with Spring and Hibernate](https://www.baeldung.com/persistence-layer-with-spring-and-hibernate)
- [Simplify the DAO with Spring and Java Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics)
-- More articles: [[<-- prev]](/spring-jpa)
\ No newline at end of file
+- More articles: [[<-- prev]](/spring-jpa)
diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md
index baa9107f4e..f118d12f6f 100644
--- a/persistence-modules/spring-persistence-simple/README.md
+++ b/persistence-modules/spring-persistence-simple/README.md
@@ -5,8 +5,9 @@
### Relevant Articles:
- [Transaction Propagation and Isolation in Spring @Transactional](https://www.baeldung.com/spring-transactional-propagation-isolation)
-- [JTA Transaction with Spring](https://www.baeldung.com/spring-vs-jta-transactional)
-- [Mock JNDI Datasource](https://www.baeldung.com/spring-mock-jndi-datasource)
+- [Transactional Annotations: Spring vs. JTA](https://www.baeldung.com/spring-vs-jta-transactional)
+- [Test a Mock JNDI Datasource with Spring](https://www.baeldung.com/spring-mock-jndi-datasource)
+- [Detecting If a Spring Transaction Is Active](https://www.baeldung.com/spring-transaction-active)
### Eclipse Config
After importing the project into Eclipse, you may see the following error:
diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml
index a069f70994..13898d01e7 100644
--- a/persistence-modules/spring-persistence-simple/pom.xml
+++ b/persistence-modules/spring-persistence-simple/pom.xml
@@ -72,6 +72,12 @@
${org.springframework.version}
test
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+ ${spring-boot-starter.version}
+
org.mockito
mockito-core
diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionUnitTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionUnitTest.java
new file mode 100644
index 0000000000..db4dbd630a
--- /dev/null
+++ b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionUnitTest.java
@@ -0,0 +1,27 @@
+package com.baeldung.transactional;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+@SpringBootApplication
+@RunWith(SpringJUnit4ClassRunner.class)
+public class TransactionalDetectionUnitTest {
+
+ @Test
+ @Transactional
+ public void givenTransactional_whenCheckingForActiveTransaction_thenReceiveTrue() {
+ assertTrue(TransactionSynchronizationManager.isActualTransactionActive());
+ }
+
+ @Test
+ public void givenNoTransactional_whenCheckingForActiveTransaction_thenReceiveFalse() {
+ assertFalse(TransactionSynchronizationManager.isActualTransactionActive());
+ }
+}
diff --git a/pom.xml b/pom.xml
index 065d6abbdd..82e242b9af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -397,6 +397,7 @@
ddd
deeplearning4j
+ discord4j
disruptor
dozer
drools
@@ -424,7 +425,7 @@
hazelcast
helidon
httpclient
- httpclient-2
+
httpclient-simple
hystrix
@@ -465,7 +466,7 @@
jjwt
jmeter
jmh
- jni
+ java-native
jooby
jsf
json
@@ -696,7 +697,6 @@
spring-reactor
spring-remoting
spring-rest-angular
- spring-rest-compress
spring-rest-http
spring-rest-http-2
spring-rest-query-language
@@ -909,6 +909,7 @@
ddd
deeplearning4j
+ discord4j
disruptor
dozer
drools
@@ -936,7 +937,7 @@
hazelcast
helidon
httpclient
- httpclient-2
+
httpclient-simple
hystrix
@@ -977,7 +978,7 @@
jjwt
jmeter
jmh
- jni
+ java-native
jooby
jsf
json
@@ -1198,7 +1199,6 @@
spring-reactor
spring-remoting
spring-rest-angular
- spring-rest-compress
spring-rest-http
spring-rest-query-language
spring-rest-shell
@@ -1485,9 +1485,8 @@
3.1.0
1.2
2.3.1
- 1.9.13
1.2
- 2.9.8
+ 2.11.1
1.3
1.2.0
5.2.0
@@ -1502,4 +1501,4 @@
1.4.197
-
\ No newline at end of file
+
diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml
index fd9868ad66..0bb69d8057 100644
--- a/spring-5-mvc/pom.xml
+++ b/spring-5-mvc/pom.xml
@@ -173,7 +173,6 @@
2.9.0
- 2.9.9
1.2.71
4.5.8
com.baeldung.Spring5Application
diff --git a/spring-5-reactive-2/README.md b/spring-5-reactive-2/README.md
index 54f7ad35b1..397f6be57c 100644
--- a/spring-5-reactive-2/README.md
+++ b/spring-5-reactive-2/README.md
@@ -6,7 +6,7 @@ This module contains articles about reactive Spring 5
- [Validation for Functional Endpoints in Spring 5](https://www.baeldung.com/spring-functional-endpoints-validation)
- [Logging a Reactive Sequence](https://www.baeldung.com/spring-reactive-sequence-logging)
- [Testing Reactive Streams Using StepVerifier and TestPublisher](https://www.baeldung.com/reactive-streams-step-verifier-test-publisher)
-- [Debugging Reactive Streams in Spring 5](https://www.baeldung.com/spring-debugging-reactive-streams)
+- [Debugging Reactive Streams in Java](https://www.baeldung.com/spring-debugging-reactive-streams)
- [Static Content in Spring WebFlux](https://www.baeldung.com/spring-webflux-static-content)
- [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events)
- More articles: [[<-- prev]](/spring-5-reactive)
diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java
index b2bc1e037f..d6cf1eb781 100644
--- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java
+++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java
@@ -7,7 +7,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Component
-@Endpoint(id = "features", enableByDefault = true)
+@Endpoint(id = "features")
public class FeaturesEndpoint {
private Map features = new ConcurrentHashMap<>();
diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java
index 03943d436d..600bff5948 100644
--- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java
+++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java
@@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
-public class Spring5ReactiveApplication{
+public class Spring5ReactiveApplication {
public static void main(String[] args) {
SpringApplication.run(Spring5ReactiveApplication.class, args);
diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java
index 07f805fea4..384e26ac8c 100644
--- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java
+++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java
@@ -1,10 +1,7 @@
package com.baeldung.reactive.actuator;
-import org.springframework.boot.actuate.autoconfigure.security.reactive.EndpointRequest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
@@ -12,17 +9,15 @@ import org.springframework.security.web.server.SecurityWebFilterChain;
@Configuration
@EnableWebFluxSecurity
public class WebSecurityConfig {
-
-
+
@Bean
public SecurityWebFilterChain securitygWebFilterChain(
ServerHttpSecurity http) {
- return http
-
- .authorizeExchange()
- .matchers(EndpointRequest.to(
- FeaturesEndpoint.class
- )).permitAll().anyExchange().permitAll().and().csrf().disable().build();
+
+ return http.authorizeExchange()
+ .pathMatchers("/actuator/**").permitAll()
+ .anyExchange().authenticated()
+ .and().build();
}
-
+
}
diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java
index 225f78b3f7..64e96ddae1 100644
--- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java
+++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java
@@ -21,12 +21,12 @@ public class SecurityConfig {
@Bean
public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
return http.authorizeExchange()
- .pathMatchers("/", "/admin")
+ .pathMatchers("/admin")
.hasAuthority("ROLE_ADMIN")
.matchers(EndpointRequest.to(FeaturesEndpoint.class))
.permitAll()
.anyExchange()
- .permitAll()
+ .authenticated()
.and()
.formLogin()
.and()
diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java
index 325923f577..bb0f007ada 100644
--- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java
+++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java
@@ -28,9 +28,7 @@ public class SpringSecurity5Application {
HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context)
.build();
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
- HttpServer httpServer = HttpServer.create();
- httpServer.host("localhost");
- httpServer.port(8080);
+ HttpServer httpServer = HttpServer.create().host("localhost").port(8083);
return httpServer.handle(adapter).bindNow();
}
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java
deleted file mode 100644
index b8dd9c9509..0000000000
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.baeldung.reactive;
-
-import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
-import static org.springframework.web.reactive.function.server.RequestPredicates.POST;
-
-import java.time.Duration;
-
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.springframework.http.server.reactive.HttpHandler;
-import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
-import org.springframework.web.reactive.function.server.RouterFunction;
-import org.springframework.web.reactive.function.server.RouterFunctions;
-import org.springframework.web.reactive.function.server.ServerResponse;
-
-import com.baeldung.web.reactive.Task;
-
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-import reactor.netty.DisposableServer;
-import reactor.netty.http.server.HttpServer;
-
-public class Spring5ReactiveServerClientIntegrationTest {
- private static DisposableServer disposableServer;
-
- @BeforeAll
- public static void setUp() throws Exception {
- HttpServer server = HttpServer.create()
- .host("localhost")
- .port(8080);
- RouterFunction> route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok()
- .body(request.bodyToFlux(Task.class)
- .map(ll -> new Task("TaskName", 1)), Task.class))
- .and(RouterFunctions.route(GET("/task"), request -> ServerResponse.ok()
- .body(Mono.just("server is alive"), String.class)));
- HttpHandler httpHandler = RouterFunctions.toHttpHandler(route);
- ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
- disposableServer = server.handle(adapter)
- .bindNow();
- }
-
- @AfterAll
- public static void shutDown() {
- disposableServer.disposeNow();
- }
-
- // @Test
- // public void givenCheckTask_whenServerHandle_thenServerResponseALiveString() throws Exception {
- // WebClient client = WebClient.create("http://localhost:8080");
- // Mono result = client
- // .get()
- // .uri("/task")
- // .exchange()
- // .then(response -> response.bodyToMono(String.class));
- //
- // assertThat(result.block()).isInstanceOf(String.class);
- // }
-
- // @Test
- // public void givenThreeTasks_whenServerHandleTheTasks_thenServerResponseATask() throws Exception {
- // URI uri = URI.create("http://localhost:8080/task/process");
- // ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector());
- // ClientRequest request = ClientRequest
- // .method(HttpMethod.POST, uri)
- // .body(BodyInserters.fromPublisher(getLatLngs(), Task.class))
- // .build();
- //
- // Flux taskResponse = exchange
- // .exchange(request)
- // .flatMap(response -> response.bodyToFlux(Task.class));
- //
- // assertThat(taskResponse.blockFirst()).isInstanceOf(Task.class);
- // }
-
- // @Test
- // public void givenCheckTask_whenServerHandle_thenOragicServerResponseALiveString() throws Exception {
- // URI uri = URI.create("http://localhost:8080/task");
- // ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector());
- // ClientRequest request = ClientRequest
- // .method(HttpMethod.GET, uri)
- // .body(BodyInserters.fromPublisher(getLatLngs(), Task.class))
- // .build();
- //
- // Flux taskResponse = exchange
- // .exchange(request)
- // .flatMap(response -> response.bodyToFlux(String.class));
- //
- // assertThat(taskResponse.blockFirst()).isInstanceOf(String.class);
- // }
-
- private static Flux getLatLngs() {
- return Flux.range(0, 3)
- .zipWith(Flux.interval(Duration.ofSeconds(1)))
- .map(x -> new Task("taskname", 1))
- .doOnNext(ll -> System.out.println("Produced: {}" + ll));
- }
-}
diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java
index e17e339142..c9164e2215 100644
--- a/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java
+++ b/spring-5-security-oauth/src/main/java/com/baeldung/oauth2/SecurityConfig.java
@@ -12,6 +12,8 @@ import org.springframework.core.env.Environment;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.oauth2.client.CommonOAuth2Provider;
+import org.springframework.security.oauth2.client.InMemoryOAuth2AuthorizedClientService;
+import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService;
import org.springframework.security.oauth2.client.endpoint.DefaultAuthorizationCodeTokenResponseClient;
import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient;
import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest;
@@ -46,7 +48,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.defaultSuccessUrl("/loginSuccess")
.failureUrl("/loginFailure");
}
-
+
@Bean
public AuthorizationRequestRepository authorizationRequestRepository() {
return new HttpSessionOAuth2AuthorizationRequestRepository();
@@ -58,11 +60,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return accessTokenResponseClient;
}
-
// additional configuration for non-Spring Boot projects
private static List clients = Arrays.asList("google", "facebook");
- //@Bean
+// @Bean
public ClientRegistrationRepository clientRegistrationRepository() {
List registrations = clients.stream()
.map(c -> getRegistration(c))
@@ -72,6 +73,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return new InMemoryClientRegistrationRepository(registrations);
}
+// @Bean
+ public OAuth2AuthorizedClientService authorizedClientService() {
+ return new InMemoryOAuth2AuthorizedClientService(clientRegistrationRepository());
+ }
+
private static String CLIENT_PROPERTY_KEY = "spring.security.oauth2.client.registration.";
@Autowired
diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml
index fa70a9f058..622a5c0f42 100644
--- a/spring-boot-modules/pom.xml
+++ b/spring-boot-modules/pom.xml
@@ -26,6 +26,7 @@
spring-boot-artifacts
spring-boot-autoconfiguration
spring-boot-basic-customization
+ spring-boot-basic-customization-2
spring-boot-bootstrap
spring-boot-client
spring-boot-config-jpa-error
@@ -64,6 +65,7 @@
spring-boot-security
spring-boot-springdoc
spring-boot-swagger
+ spring-boot-swagger-jwt
spring-boot-testing
spring-boot-vue
spring-boot-xml
diff --git a/spring-boot-modules/spring-boot-annotations/README.md b/spring-boot-modules/spring-boot-annotations/README.md
index a721f28d55..6ead94de86 100644
--- a/spring-boot-modules/spring-boot-annotations/README.md
+++ b/spring-boot-modules/spring-boot-annotations/README.md
@@ -9,3 +9,4 @@ This module contains articles about Spring Boot annotations
- [Spring Web Annotations](https://www.baeldung.com/spring-mvc-annotations)
- [Spring Core Annotations](https://www.baeldung.com/spring-core-annotations)
- [Spring Bean Annotations](https://www.baeldung.com/spring-bean-annotations)
+- [Difference Between @ComponentScan and @EnableAutoConfiguration in Spring Boot](https://www.baeldung.com/spring-componentscan-vs-enableautoconfiguration)
diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java
new file mode 100644
index 0000000000..17c7af858b
--- /dev/null
+++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java
@@ -0,0 +1,19 @@
+package com.baeldung.annotations;
+
+import com.baeldung.annotations.componentscanautoconfigure.teacher.Teacher;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+
+@ComponentScan(basePackages = {"com.baeldung.annotations.componentscanautoconfigure.healthcare",
+ "com.baeldung.annotations.componentscanautoconfigure.employee"},
+ basePackageClasses = Teacher.class)
+@EnableAutoConfiguration(exclude = {JdbcTemplateAutoConfiguration.class})
+//@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration"})
+public class EmployeeApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(EmployeeApplication.class, args);
+ }
+}
diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java
new file mode 100644
index 0000000000..9be3388046
--- /dev/null
+++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java
@@ -0,0 +1,12 @@
+package com.baeldung.annotations.componentscanautoconfigure.employee;
+
+import org.springframework.stereotype.Component;
+
+@Component("employee")
+public class Employee {
+
+ @Override
+ public String toString() {
+ return "Employee" + this.hashCode();
+ }
+}
diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java
new file mode 100644
index 0000000000..242e84f887
--- /dev/null
+++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java
@@ -0,0 +1,12 @@
+package com.baeldung.annotations.componentscanautoconfigure.employee;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class SeniorEmployee {
+
+ @Override
+ public String toString() {
+ return "Senior Employee" + this.hashCode();
+ }
+}
diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Doctor.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Doctor.java
new file mode 100644
index 0000000000..7e7e6cb03b
--- /dev/null
+++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Doctor.java
@@ -0,0 +1,9 @@
+package com.baeldung.annotations.componentscanautoconfigure.healthcare;
+
+public class Doctor {
+
+ @Override
+ public String toString() {
+ return "Doctor" + this.hashCode();
+ }
+}
diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Hospital.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Hospital.java
new file mode 100644
index 0000000000..0711544060
--- /dev/null
+++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Hospital.java
@@ -0,0 +1,13 @@
+package com.baeldung.annotations.componentscanautoconfigure.healthcare;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class Hospital {
+
+ @Bean("doctor")
+ public Doctor getDoctor() {
+ return new Doctor();
+ }
+}
diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java
new file mode 100644
index 0000000000..56f2ac9830
--- /dev/null
+++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java
@@ -0,0 +1,12 @@
+package com.baeldung.annotations.componentscanautoconfigure.student;
+
+import org.springframework.stereotype.Component;
+
+@Component("student")
+public class Student {
+
+ @Override
+ public String toString() {
+ return "Student" + this.hashCode();
+ }
+}
diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java
new file mode 100644
index 0000000000..e2c653204d
--- /dev/null
+++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java
@@ -0,0 +1,12 @@
+package com.baeldung.annotations.componentscanautoconfigure.teacher;
+
+import org.springframework.stereotype.Component;
+
+@Component("teacher")
+public class Teacher {
+
+ @Override
+ public String toString() {
+ return "Teacher" + this.hashCode();
+ }
+}
diff --git a/spring-boot-modules/spring-boot-annotations/src/main/test/com.baeldung.annotations/EmployeeApplicationTest.java b/spring-boot-modules/spring-boot-annotations/src/main/test/com.baeldung.annotations/EmployeeApplicationTest.java
new file mode 100644
index 0000000000..66700cf781
--- /dev/null
+++ b/spring-boot-modules/spring-boot-annotations/src/main/test/com.baeldung.annotations/EmployeeApplicationTest.java
@@ -0,0 +1,23 @@
+package com.baeldung.annotations;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertAll;
+
+public class EmployeeApplicationTest {
+ private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
+ .withUserConfiguration(EmployeeApplication.class);
+
+ @Test
+ void whenApplicationContextRuns_thenContainAllDefinedBeans() {
+ contextRunner.run(context -> assertAll(
+ () -> assertTrue(context.containsBeanDefinition("employee")),
+ () -> assertTrue(context.containsBeanDefinition("seniorEmployee")),
+ () -> assertTrue(context.containsBeanDefinition("doctor")),
+ () -> assertTrue(context.containsBeanDefinition("hospital")),
+ () -> assertFalse(context.containsBeanDefinition("student")),
+ () -> assertTrue(context.containsBeanDefinition("teacher"))));
+ }
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/README.md b/spring-boot-modules/spring-boot-basic-customization-2/README.md
new file mode 100644
index 0000000000..faaee0962e
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization-2/README.md
@@ -0,0 +1,7 @@
+## Spring Boot Basic Customization 2
+
+This module contains articles about Spring Boot customization 2
+
+### Relevant Articles:
+
+ - [DispatcherServlet and web.xml in Spring Boot](https://www.baeldung.com/)
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/pom.xml b/spring-boot-modules/spring-boot-basic-customization-2/pom.xml
new file mode 100644
index 0000000000..3ce9266ebe
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization-2/pom.xml
@@ -0,0 +1,33 @@
+
+
+ 4.0.0
+
+
+ com.baeldung.spring-boot-modules
+ spring-boot-modules
+ 1.0.0-SNAPSHOT
+ ../
+
+
+ spring-boot-basic-customization-2
+ jar
+
+ spring-boot-basic-customization-2
+ Module For Spring Boot Basic Customization 2
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/DispatchServletApplication.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/DispatchServletApplication.java
new file mode 100644
index 0000000000..4d58715d88
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/DispatchServletApplication.java
@@ -0,0 +1,15 @@
+package com.baeldung.dispatchservlet;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+@SpringBootApplication
+public class DispatchServletApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DispatchServletApplication.class, args);
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/conf/WebConf.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/conf/WebConf.java
new file mode 100644
index 0000000000..7c52b117fd
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/conf/WebConf.java
@@ -0,0 +1,29 @@
+package com.baeldung.dispatchservlet.conf;
+
+import com.baeldung.dispatchservlet.listener.CustomListener;
+import com.baeldung.dispatchservlet.servlet.CustomServlet;
+import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.servlet.ServletContextListener;
+
+@Configuration
+public class WebConf {
+
+ @Bean
+ public ServletRegistrationBean customServletBean() {
+ ServletRegistrationBean bean
+ = new ServletRegistrationBean(new CustomServlet(), "/servlet");
+ return bean;
+ }
+
+ @Bean
+ public ServletListenerRegistrationBean customListenerBean() {
+ ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean();
+ bean.setListener(new CustomListener());
+ return bean;
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/controller/Controller.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/controller/Controller.java
new file mode 100644
index 0000000000..14d71c60fb
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/controller/Controller.java
@@ -0,0 +1,15 @@
+package com.baeldung.dispatchservlet.controller;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping(value = "/")
+public class Controller {
+
+ @GetMapping
+ public String getRequest(){
+ return "Baeldung DispatcherServlet";
+ }
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/filter/CustomFilter.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/filter/CustomFilter.java
new file mode 100644
index 0000000000..8429fc855f
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/filter/CustomFilter.java
@@ -0,0 +1,30 @@
+package com.baeldung.dispatchservlet.filter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.*;
+import java.io.IOException;
+
+@Component
+public class CustomFilter implements Filter {
+
+ Logger logger = LoggerFactory.getLogger(CustomFilter.class);
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ logger.info("CustomFilter is invoked");
+ chain.doFilter(request, response);
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/listener/CustomListener.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/listener/CustomListener.java
new file mode 100644
index 0000000000..62b316c012
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/listener/CustomListener.java
@@ -0,0 +1,22 @@
+package com.baeldung.dispatchservlet.listener;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class CustomListener implements ServletContextListener {
+
+ Logger logger = LoggerFactory.getLogger(CustomListener.class);
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+ logger.info("CustomListener is initialized");
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ logger.info("CustomListener is destroyed");
+ }
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/servlet/CustomServlet.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/servlet/CustomServlet.java
new file mode 100644
index 0000000000..2a99e797ce
--- /dev/null
+++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/servlet/CustomServlet.java
@@ -0,0 +1,29 @@
+package com.baeldung.dispatchservlet.servlet;
+
+import com.baeldung.dispatchservlet.filter.CustomFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class CustomServlet extends HttpServlet {
+
+ Logger logger = LoggerFactory.getLogger(CustomServlet.class);
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ logger.info("CustomServlet doGet() method is invoked");
+ super.doGet(req, resp);
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ logger.info("CustomServlet doPost() method is invoked");
+ super.doPost(req, resp);
+ }
+}
diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties b/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-boot-modules/spring-boot-data/README.md b/spring-boot-modules/spring-boot-data/README.md
index 98589cf2d2..da22b62128 100644
--- a/spring-boot-modules/spring-boot-data/README.md
+++ b/spring-boot-modules/spring-boot-data/README.md
@@ -10,4 +10,4 @@ This module contains articles about Spring Boot with Spring Data
- [Repositories with Multiple Spring Data Modules](https://www.baeldung.com/spring-multiple-data-modules)
- [Spring Custom Property Editor](https://www.baeldung.com/spring-mvc-custom-property-editor)
- [Using @JsonComponent in Spring Boot](https://www.baeldung.com/spring-boot-jsoncomponent)
-- [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring)
+- [Guide To Running Logic on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring)
diff --git a/spring-boot-modules/spring-boot-environment/README.md b/spring-boot-modules/spring-boot-environment/README.md
index e916c503bc..e7b0ace7a4 100644
--- a/spring-boot-modules/spring-boot-environment/README.md
+++ b/spring-boot-modules/spring-boot-environment/README.md
@@ -4,4 +4,5 @@ This module contains articles about configuring the Spring Boot `Environment`
### Relevant Articles:
- [EnvironmentPostProcessor in Spring Boot](https://www.baeldung.com/spring-boot-environmentpostprocessor)
- - [Spring Properties File Outside jar](https://www.baeldung.com/spring-properties-file-outside-jar)
\ No newline at end of file
+ - [Spring Properties File Outside jar](https://www.baeldung.com/spring-properties-file-outside-jar)
+ - [Get the Running Port in Spring Boot](https://www.baeldung.com/spring-boot-running-port)
diff --git a/spring-boot-modules/spring-boot-keycloak/README.md b/spring-boot-modules/spring-boot-keycloak/README.md
index 74fbbb6f09..2aff4664a6 100644
--- a/spring-boot-modules/spring-boot-keycloak/README.md
+++ b/spring-boot-modules/spring-boot-keycloak/README.md
@@ -5,3 +5,7 @@ This module contains articles about Keycloak in Spring Boot projects.
## Relevant articles:
- [A Quick Guide to Using Keycloak with Spring Boot](https://www.baeldung.com/spring-boot-keycloak)
- [Custom User Attributes with Keycloak](https://www.baeldung.com/keycloak-custom-user-attributes)
+- [Customizing the Login Page for Keycloak](https://www.baeldung.com/keycloak-custom-login-page)
+- [Keycloak User Self-Registration](https://www.baeldung.com/keycloak-user-registration)
+- [Customizing Themes for Keycloak](https://www.baeldung.com/spring-keycloak-custom-themes)
+
diff --git a/spring-boot-modules/spring-boot-keycloak/pom.xml b/spring-boot-modules/spring-boot-keycloak/pom.xml
index 5049cc3651..cfcdcf2c37 100644
--- a/spring-boot-modules/spring-boot-keycloak/pom.xml
+++ b/spring-boot-modules/spring-boot-keycloak/pom.xml
@@ -76,7 +76,7 @@
- 10.0.2
+ 11.0.2
diff --git a/spring-boot-modules/spring-boot-libraries-2/README.md b/spring-boot-modules/spring-boot-libraries-2/README.md
index b0840798e3..4218dfc1be 100644
--- a/spring-boot-modules/spring-boot-libraries-2/README.md
+++ b/spring-boot-modules/spring-boot-libraries-2/README.md
@@ -4,4 +4,4 @@ This module contains articles about various Spring Boot libraries
### Relevant Articles:
-- Running background jobs in Spring with JobRunr
+- [Background Jobs in Spring with JobRunr](https://www.baeldung.com/java-jobrunr-spring)
diff --git a/spring-boot-modules/spring-boot-libraries-2/pom.xml b/spring-boot-modules/spring-boot-libraries-2/pom.xml
index 2633c8fad3..35dec54450 100644
--- a/spring-boot-modules/spring-boot-libraries-2/pom.xml
+++ b/spring-boot-modules/spring-boot-libraries-2/pom.xml
@@ -39,8 +39,8 @@
- 1.0.0
+ 1.1.0
4.0.3
-
\ No newline at end of file
+
diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties b/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties
index 69f5a7356e..bb2a31f1d9 100644
--- a/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties
+++ b/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties
@@ -1,2 +1,2 @@
-org.jobrunr.background_job_server=true
-org.jobrunr.dashboard=true
+org.jobrunr.background-job-server.enabled=true
+org.jobrunr.dashboard.enabled=true
diff --git a/spring-boot-modules/spring-boot-mvc-3/README.md b/spring-boot-modules/spring-boot-mvc-3/README.md
index 796ab72425..bc3eb9e496 100644
--- a/spring-boot-modules/spring-boot-mvc-3/README.md
+++ b/spring-boot-modules/spring-boot-mvc-3/README.md
@@ -8,4 +8,5 @@ This module contains articles about Spring Web MVC in Spring Boot projects.
- [Download an Image or a File with Spring MVC](https://www.baeldung.com/spring-controller-return-image-file)
- [Spring MVC Async vs Spring WebFlux](https://www.baeldung.com/spring-mvc-async-vs-webflux)
- [Differences in @Valid and @Validated Annotations in Spring](https://www.baeldung.com/spring-valid-vs-validated)
+- [CharacterEncodingFilter In SpringBoot](https://www.baeldung.com/spring-boot-characterencodingfilter)
- More articles: [[prev -->]](/spring-boot-modules/spring-boot-mvc-2)
diff --git a/spring-boot-modules/spring-boot-mvc-birt/pom.xml b/spring-boot-modules/spring-boot-mvc-birt/pom.xml
index 0ab744bb26..4963cc3036 100644
--- a/spring-boot-modules/spring-boot-mvc-birt/pom.xml
+++ b/spring-boot-modules/spring-boot-mvc-birt/pom.xml
@@ -4,11 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+
- com.baeldung.spring-boot-modules
- spring-boot-modules
- 1.0.0-SNAPSHOT
- ../
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.1.1.RELEASE
+
spring-boot-mvc-birt
@@ -19,10 +20,6 @@
Module For Spring Boot Integration with BIRT
-
- org.springframework.boot
- spring-boot-starter
-
org.springframework.boot
@@ -51,17 +48,14 @@
org.eclipse.birt.runtime_4.8.0-20180626
${eclipse.birt.runtime.version}
-
log4j
log4j
${log4j.version}
-
org.projectlombok
lombok
- ${lombok.version}
provided
@@ -81,6 +75,7 @@
1.8
1.8
4.8.0
+ 1.2.17
diff --git a/spring-boot-modules/spring-boot-mvc-birt/src/main/resources/log4j.properties b/spring-boot-modules/spring-boot-mvc-birt/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..e4fcb01308
--- /dev/null
+++ b/spring-boot-modules/spring-boot-mvc-birt/src/main/resources/log4j.properties
@@ -0,0 +1,9 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=DEBUG, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
\ No newline at end of file
diff --git a/spring-boot-modules/spring-boot-mvc-birt/src/test/java/com/baeldung/birt/engine/SpringContextTest.java b/spring-boot-modules/spring-boot-mvc-birt/src/test/java/com/baeldung/birt/engine/SpringContextTest.java
new file mode 100644
index 0000000000..5235a494df
--- /dev/null
+++ b/spring-boot-modules/spring-boot-mvc-birt/src/test/java/com/baeldung/birt/engine/SpringContextTest.java
@@ -0,0 +1,13 @@
+package com.baeldung.birt.engine;
+
+import org.junit.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class SpringContextTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+
+ }
+}
diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/configurationproperties/ConfigurationScanDemoApplication.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/configurationproperties/ConfigurationScanDemoApplication.java
new file mode 100644
index 0000000000..b2339b9980
--- /dev/null
+++ b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/configurationproperties/ConfigurationScanDemoApplication.java
@@ -0,0 +1,14 @@
+package com.baeldung.configurationproperties;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
+
+@SpringBootApplication
+@ConfigurationPropertiesScan("com.baeldung.configurationproperties")
+public class ConfigurationScanDemoApplication{
+
+ public static void main(String[] args) {
+ SpringApplication.run(ConfigurationScanDemoApplication.class, args);
+ }
+}
diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/configurationproperties/EnableConfigurationDemoApplication.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/configurationproperties/EnableConfigurationDemoApplication.java
new file mode 100644
index 0000000000..69b8c2802b
--- /dev/null
+++ b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/configurationproperties/EnableConfigurationDemoApplication.java
@@ -0,0 +1,13 @@
+package com.baeldung.configurationproperties;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+
+@SpringBootApplication
+@EnableConfigurationProperties(ConfigProperties.class)
+public class EnableConfigurationDemoApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(EnableConfigurationDemoApplication.class, args);
+ }
+}
diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/ConfigPropertiesDemoApplication.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/ConfigPropertiesDemoApplication.java
index 1e5e88921a..c435f9e320 100644
--- a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/ConfigPropertiesDemoApplication.java
+++ b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/ConfigPropertiesDemoApplication.java
@@ -1,13 +1,10 @@
package com.baeldung.properties;
-import com.baeldung.buildproperties.Application;
+import com.baeldung.configurationproperties.ConfigProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
-import com.baeldung.configurationproperties.ConfigProperties;
-
@SpringBootApplication
@ComponentScan(basePackageClasses = {ConfigProperties.class, AdditionalProperties.class})
public class ConfigPropertiesDemoApplication {
diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/yaml/MyApplication.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/yaml/MyApplication.java
index f3cfff57b7..27195911bd 100644
--- a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/yaml/MyApplication.java
+++ b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/yaml/MyApplication.java
@@ -5,15 +5,13 @@
*/
package com.baeldung.yaml;
-import java.util.Collections;
+import com.baeldung.yaml.YAMLConfig.Idm;
+import com.baeldung.yaml.YAMLConfig.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import com.baeldung.yaml.YAMLConfig.Idm;
-import com.baeldung.yaml.YAMLConfig.Service;
-
@SpringBootApplication
public class MyApplication implements CommandLineRunner {
@@ -28,6 +26,7 @@ public class MyApplication implements CommandLineRunner {
public void run(String... args) throws Exception {
System.out.println("using environment:" + myConfig.getEnvironment());
System.out.println("name:" + myConfig.getName());
+ System.out.println("enabled:" + myConfig.isEnabled());
System.out.println("servers:" + myConfig.getServers());
if ("testing".equalsIgnoreCase(myConfig.getEnvironment())) {
diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/yaml/YAMLConfig.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/yaml/YAMLConfig.java
index 83c083734c..4099ded1aa 100644
--- a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/yaml/YAMLConfig.java
+++ b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/yaml/YAMLConfig.java
@@ -15,6 +15,7 @@ import org.springframework.context.annotation.Configuration;
public class YAMLConfig {
private String name;
private String environment;
+ private boolean enabled;
private List servers = new ArrayList();
private List external = new ArrayList();
private Map map = new HashMap();
@@ -43,7 +44,15 @@ public class YAMLConfig {
public void setEnvironment(String environment) {
this.environment = environment;
}
-
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
public Component getComponent() {
return component;
}
diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/application.yml b/spring-boot-modules/spring-boot-properties/src/main/resources/application.yml
index 30e64f9d35..fc9bb42a95 100644
--- a/spring-boot-modules/spring-boot-properties/src/main/resources/application.yml
+++ b/spring-boot-modules/spring-boot-properties/src/main/resources/application.yml
@@ -9,6 +9,7 @@ spring:
profiles: test
name: test-YAML
environment: testing
+enabled: false
servers:
- www.abc.test.com
- www.xyz.test.com
@@ -39,6 +40,7 @@ spring:
profiles: prod
name: prod-YAML
environment: production
+enabled: true
servers:
- www.abc.com
- www.xyz.com
@@ -49,6 +51,7 @@ spring:
profiles: dev
name: ${DEV_NAME:dev-YAML}
environment: development
+enabled: true
servers:
- www.abc.dev.com
- www.xyz.dev.com
diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/configurationproperties/ConfigPropertiesIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/configurationproperties/ConfigPropertiesIntegrationTest.java
index 3b80fa66fe..7f239cbcff 100644
--- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/configurationproperties/ConfigPropertiesIntegrationTest.java
+++ b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/configurationproperties/ConfigPropertiesIntegrationTest.java
@@ -4,12 +4,10 @@ import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
-import com.baeldung.configurationproperties.ConfigProperties;
import com.baeldung.properties.AdditionalProperties;
import com.baeldung.properties.ConfigPropertiesDemoApplication;
@@ -19,34 +17,34 @@ import com.baeldung.properties.ConfigPropertiesDemoApplication;
public class ConfigPropertiesIntegrationTest {
@Autowired
- private ConfigProperties properties;
+ private ConfigProperties configProperties;
@Autowired
private AdditionalProperties additionalProperties;
@Test
public void whenSimplePropertyQueriedthenReturnsProperty() throws Exception {
- Assert.assertTrue("From address is read as null!", properties.getFrom() != null);
+ Assert.assertTrue("From address is read as null!", configProperties.getFrom() != null);
}
@Test
public void whenListPropertyQueriedthenReturnsProperty() throws Exception {
- Assert.assertTrue("Couldn't bind list property!", properties.getDefaultRecipients().size() == 2);
- Assert.assertTrue("Incorrectly bound list property. Expected 2 entries!", properties.getDefaultRecipients().size() == 2);
+ Assert.assertTrue("Couldn't bind list property!", configProperties.getDefaultRecipients().size() == 2);
+ Assert.assertTrue("Incorrectly bound list property. Expected 2 entries!", configProperties.getDefaultRecipients().size() == 2);
}
@Test
public void whenMapPropertyQueriedthenReturnsProperty() throws Exception {
- Assert.assertTrue("Couldn't bind map property!", properties.getAdditionalHeaders() != null);
- Assert.assertTrue("Incorrectly bound map property. Expected 3 Entries!", properties.getAdditionalHeaders().size() == 3);
+ Assert.assertTrue("Couldn't bind map property!", configProperties.getAdditionalHeaders() != null);
+ Assert.assertTrue("Incorrectly bound map property. Expected 3 Entries!", configProperties.getAdditionalHeaders().size() == 3);
}
@Test
public void whenObjectPropertyQueriedthenReturnsProperty() throws Exception {
- Assert.assertTrue("Couldn't bind map property!", properties.getCredentials() != null);
- Assert.assertTrue("Incorrectly bound object property!", properties.getCredentials().getAuthMethod().equals("SHA1"));
- Assert.assertTrue("Incorrectly bound object property!", properties.getCredentials().getUsername().equals("john"));
- Assert.assertTrue("Incorrectly bound object property!", properties.getCredentials().getPassword().equals("password"));
+ Assert.assertTrue("Couldn't bind map property!", configProperties.getCredentials() != null);
+ Assert.assertTrue("Incorrectly bound object property!", configProperties.getCredentials().getAuthMethod().equals("SHA1"));
+ Assert.assertTrue("Incorrectly bound object property!", configProperties.getCredentials().getUsername().equals("john"));
+ Assert.assertTrue("Incorrectly bound object property!", configProperties.getCredentials().getPassword().equals("password"));
}
@Test
diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/yaml/YAMLDevIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/yaml/YAMLDevIntegrationTest.java
index 8dfc4c2208..5e6ebf6d81 100644
--- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/yaml/YAMLDevIntegrationTest.java
+++ b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/yaml/YAMLDevIntegrationTest.java
@@ -21,5 +21,6 @@ class YAMLDevIntegrationTest {
void whenProfileTest_thenNameTesting() {
assertTrue("development".equalsIgnoreCase(config.getEnvironment()));
assertTrue("dev-YAML".equalsIgnoreCase(config.getName()));
+ assertTrue(config.isEnabled());
}
}
diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/yaml/YAMLIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/yaml/YAMLIntegrationTest.java
index 19412c91f5..278307504b 100644
--- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/yaml/YAMLIntegrationTest.java
+++ b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/yaml/YAMLIntegrationTest.java
@@ -1,5 +1,6 @@
package com.baeldung.yaml;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
@@ -22,5 +23,6 @@ class YAMLIntegrationTest {
assertTrue("testing".equalsIgnoreCase(config.getEnvironment()));
assertTrue("test-YAML".equalsIgnoreCase(config.getName()));
assertTrue("myurl".equalsIgnoreCase(config.getComponent().getIdm().getUrl()));
+ assertFalse(config.isEnabled());
}
}
diff --git a/spring-boot-modules/spring-boot-swagger-jwt/README.md b/spring-boot-modules/spring-boot-swagger-jwt/README.md
new file mode 100644
index 0000000000..f04dd5957a
--- /dev/null
+++ b/spring-boot-modules/spring-boot-swagger-jwt/README.md
@@ -0,0 +1,3 @@
+## Relevant Articles:
+
+- [Set JWT with Spring Boot and Swagger UI](https://www.baeldung.com/spring-boot-swagger-jwt)
diff --git a/spring-boot-modules/spring-boot-swagger-jwt/pom.xml b/spring-boot-modules/spring-boot-swagger-jwt/pom.xml
new file mode 100644
index 0000000000..d71d7342ce
--- /dev/null
+++ b/spring-boot-modules/spring-boot-swagger-jwt/pom.xml
@@ -0,0 +1,41 @@
+
+
+ 4.0.0
+
+
+ com.baeldung.spring-boot-modules
+ spring-boot-modules
+ 1.0.0-SNAPSHOT
+ ../
+
+
+ spring-boot-swagger-jwt
+ 0.1.0-SNAPSHOT
+ spring-boot-swagger-jwt
+ jar
+
+ Module For Spring Boot Swagger UI
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ io.springfox
+ springfox-boot-starter
+ 3.0.0
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/SpringBootSwaggerUIApplication.java b/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/SpringBootSwaggerUIApplication.java
new file mode 100644
index 0000000000..e9e5d24b54
--- /dev/null
+++ b/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/SpringBootSwaggerUIApplication.java
@@ -0,0 +1,13 @@
+package com.baeldung.swaggerjwt;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SpringBootSwaggerUIApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootSwaggerUIApplication.class, args);
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/configuration/SwaggerConfiguration.java b/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/configuration/SwaggerConfiguration.java
new file mode 100644
index 0000000000..240a21cd21
--- /dev/null
+++ b/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/configuration/SwaggerConfiguration.java
@@ -0,0 +1,62 @@
+package com.baeldung.swaggerjwt.configuration;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.*;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spi.service.contexts.SecurityContext;
+import springfox.documentation.spring.web.plugins.Docket;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+@Configuration
+public class SwaggerConfiguration {
+
+ public static final String AUTHORIZATION_HEADER = "Authorization";
+
+ private ApiInfo apiInfo() {
+ return new ApiInfo("My REST API",
+ "Some custom description of API.",
+ "1.0",
+ "Terms of service",
+ new Contact("Sallo Szrajbman", "www.baeldung.com", "salloszraj@gmail.com"),
+ "License of API",
+ "API license URL",
+ Collections.emptyList());
+ }
+
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .apiInfo(apiInfo())
+ .securityContexts(Arrays.asList(securityContext()))
+ .securitySchemes(Arrays.asList(apiKey()))
+ .select()
+ .apis(RequestHandlerSelectors.any())
+ .paths(PathSelectors.any())
+ .build();
+ }
+
+ private ApiKey apiKey() {
+ return new ApiKey("JWT", AUTHORIZATION_HEADER, "header");
+ }
+
+ private SecurityContext securityContext() {
+ return SecurityContext.builder()
+ .securityReferences(defaultAuth())
+ .build();
+ }
+
+ List defaultAuth() {
+ AuthorizationScope authorizationScope
+ = new AuthorizationScope("global", "accessEverything");
+ AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+ authorizationScopes[0] = authorizationScope;
+ return Arrays.asList(new SecurityReference("JWT", authorizationScopes));
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/controller/ClientsRestController.java b/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/controller/ClientsRestController.java
new file mode 100644
index 0000000000..f60ba2448a
--- /dev/null
+++ b/spring-boot-modules/spring-boot-swagger-jwt/src/main/java/com/baeldung/swaggerjwt/controller/ClientsRestController.java
@@ -0,0 +1,25 @@
+package com.baeldung.swaggerjwt.controller;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.baeldung.swaggerjwt.configuration.SwaggerConfiguration;
+import io.swagger.annotations.Api;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RestController;
+
+import io.swagger.annotations.ApiOperation;
+
+@RestController(value = "/clients")
+@Api( tags = "Clients")
+public class ClientsRestController {
+
+ @ApiOperation(value = "This method is used to get the clients.")
+ @GetMapping
+ public List getClients() {
+ return Arrays.asList("First Client", "Second Client");
+ }
+
+}
diff --git a/spring-boot-modules/spring-boot-swagger-jwt/src/main/resources/application.properties b/spring-boot-modules/spring-boot-swagger-jwt/src/main/resources/application.properties
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml
index ee7b80ffc1..c0e452afaf 100644
--- a/spring-cloud/pom.xml
+++ b/spring-cloud/pom.xml
@@ -52,12 +52,30 @@
org.springframework.boot
spring-boot-maven-plugin
- ${spring-boot-maven-plugin.version}
+
+
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
Hoxton.SR4
2.2.3.RELEASE
@@ -66,8 +84,7 @@
1.4.7.RELEASE
1.4.7.RELEASE
3.0.6.RELEASE
- 2.3.1.RELEASE
- 2.3.1.RELEASE
+
diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml
index 2b05020888..f65db6a2fe 100644
--- a/spring-cloud/spring-cloud-aws/pom.xml
+++ b/spring-cloud/spring-cloud-aws/pom.xml
@@ -67,6 +67,7 @@
com.baeldung.spring.cloud.aws.SpringCloudAwsApplication
Dalston.SR4
2.2.1.RELEASE
+
diff --git a/spring-cloud/spring-cloud-bootstrap/config/pom.xml b/spring-cloud/spring-cloud-bootstrap/config/pom.xml
index 67831d0c7f..6ebf23637e 100644
--- a/spring-cloud/spring-cloud-bootstrap/config/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/config/pom.xml
@@ -42,6 +42,7 @@
Brixton.SR7
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml b/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml
index 8fcf4adadb..729abb4f05 100644
--- a/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml
@@ -17,13 +17,6 @@
-
- org.springframework.boot
- spring-boot-dependencies
- ${spring-boot.version}
- pom
- import
-
org.springframework.boot
spring-boot-starter-web
diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml
index 46550031e1..d77e29768f 100644
--- a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml
@@ -51,6 +51,7 @@
Edgware.SR5
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
index 10a04db197..34b7af7c0a 100644
--- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml
@@ -100,6 +100,7 @@
Dalston.RELEASE
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/order-service/order-client/pom.xml b/spring-cloud/spring-cloud-bootstrap/order-service/order-client/pom.xml
index 4c8cf742b1..01e8afeec3 100644
--- a/spring-cloud/spring-cloud-bootstrap/order-service/order-client/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/order-service/order-client/pom.xml
@@ -14,5 +14,4 @@
order-service
1.0.0-SNAPSHOT
-
diff --git a/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml b/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml
index a1c6c1c39f..a32bd5a2d3 100644
--- a/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml
@@ -118,5 +118,6 @@
1.8
1.8
com.baeldung.orderservice.OrderApplication
+
diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml
index 36227f93c6..de0785bd45 100644
--- a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml
@@ -73,6 +73,7 @@
Dalston.RELEASE
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml
index 0a01488628..0cce78276a 100644
--- a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml
@@ -82,6 +82,7 @@
Dalston.RELEASE
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml
index bf7525a8e4..b83c5a2aaa 100644
--- a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml
+++ b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml
@@ -50,6 +50,7 @@
Brixton.SR7
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml
index 4f4a420238..805a50bfdb 100644
--- a/spring-cloud/spring-cloud-config/client/pom.xml
+++ b/spring-cloud/spring-cloud-config/client/pom.xml
@@ -36,5 +36,4 @@
-
diff --git a/spring-cloud/spring-cloud-config/pom.xml b/spring-cloud/spring-cloud-config/pom.xml
index 8411a65500..7fb0c1fd68 100644
--- a/spring-cloud/spring-cloud-config/pom.xml
+++ b/spring-cloud/spring-cloud-config/pom.xml
@@ -34,6 +34,7 @@
Hoxton.SR4
+
diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml
index 9574834457..e32a473cd6 100644
--- a/spring-cloud/spring-cloud-config/server/pom.xml
+++ b/spring-cloud/spring-cloud-config/server/pom.xml
@@ -40,5 +40,4 @@
-
diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml
index 7d85e07bb8..e71e1350a2 100644
--- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml
+++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml
@@ -64,6 +64,7 @@
Hoxton.SR4
42.2.10
1.10.10
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml
index d82ee6566d..dc6a1ae236 100644
--- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml
+++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml
@@ -17,6 +17,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml
index 1ecc50a81f..e0d63dc15d 100644
--- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml
+++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml
@@ -17,6 +17,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml
index 627be513ba..9c0a933753 100644
--- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml
+++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml
@@ -17,6 +17,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml
index 7e6f5dfbdc..0be3941db1 100644
--- a/spring-cloud/spring-cloud-functions/pom.xml
+++ b/spring-cloud/spring-cloud-functions/pom.xml
@@ -86,6 +86,7 @@
2.0.2
1.1.0
1.0.10.RELEASE
+
diff --git a/spring-cloud/spring-cloud-functions/src/main/java/com/baeldung/spring/cloudfunction/aws/functions/Greeter.java b/spring-cloud/spring-cloud-functions/src/main/java/com/baeldung/spring/cloudfunction/aws/functions/Greeter.java
index c443b98c18..bbc87a4ae2 100644
--- a/spring-cloud/spring-cloud-functions/src/main/java/com/baeldung/spring/cloudfunction/aws/functions/Greeter.java
+++ b/spring-cloud/spring-cloud-functions/src/main/java/com/baeldung/spring/cloudfunction/aws/functions/Greeter.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.cloudfunction.functions.aws;
+package com.baeldung.spring.cloudfunction.aws.functions;
import java.util.function.Function;
diff --git a/spring-cloud/spring-cloud-functions/src/main/resources/application.properties b/spring-cloud/spring-cloud-functions/src/main/resources/application.properties
index b445bfa4ed..2cb479879c 100644
--- a/spring-cloud/spring-cloud-functions/src/main/resources/application.properties
+++ b/spring-cloud/spring-cloud-functions/src/main/resources/application.properties
@@ -1 +1 @@
-spring.cloud.function.scan.packages: com.baeldung.spring.cloudfunction.functions.aws
\ No newline at end of file
+spring.cloud.function.scan.packages: com.baeldung.spring.cloudfunction.aws.functions
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml
index bbacf7a8ce..c9c087d738 100644
--- a/spring-cloud/spring-cloud-gateway/pom.xml
+++ b/spring-cloud/spring-cloud-gateway/pom.xml
@@ -17,19 +17,16 @@
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud-dependencies.version}
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
pom
import
-
-
- org.junit
- junit-bom
- ${junit-bom.version}
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud-dependencies.version}
pom
import
diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml
index acb9993881..204cb8765c 100644
--- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml
+++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml
@@ -17,6 +17,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
@@ -51,7 +58,6 @@
org.springframework.boot
spring-boot-starter-web
- ${spring-boot-starter-web.version}
org.springframework.boot
diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml
index ba03ad3348..44e5bf2501 100644
--- a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml
+++ b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml
@@ -16,6 +16,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
@@ -40,24 +47,20 @@
org.springframework.boot
spring-boot-starter-web
- ${spring-boot-starter-web.version}
org.springframework.boot
spring-boot-starter-thymeleaf
- ${spring-boot-starter-web.version}
org.springframework.boot
spring-boot-starter-actuator
- ${spring-boot-starter-web.version}
org.springframework.boot
spring-boot-starter-test
test
- ${spring-boot-starter-web.version}
diff --git a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml
index cb7377d705..e7be8f2c58 100644
--- a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml
+++ b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml
@@ -18,13 +18,11 @@
org.springframework.boot
spring-boot-starter-web
- ${spring-boot-starter-web.version}
org.springframework.boot
spring-boot-starter-test
- ${spring-boot-starter-web.version}
test
diff --git a/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml
index 9a4924b903..004fabeb09 100644
--- a/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml
+++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml
@@ -33,5 +33,4 @@
-
diff --git a/spring-cloud/spring-cloud-kubernetes/pom.xml b/spring-cloud/spring-cloud-kubernetes/pom.xml
index ed4bccbf78..a3669d2d55 100644
--- a/spring-cloud/spring-cloud-kubernetes/pom.xml
+++ b/spring-cloud/spring-cloud-kubernetes/pom.xml
@@ -24,4 +24,6 @@
kubernetes-guide/travel-agency-service
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-netflix-feign/README.md b/spring-cloud/spring-cloud-netflix-feign/README.md
new file mode 100644
index 0000000000..2e96a0045d
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/README.md
@@ -0,0 +1,3 @@
+### Relevant Articles:
+
+- [Differences Between Netflix Feign and OpenFeign](https://www.baeldung.com/netflix-feign-vs-openfeign)
diff --git a/spring-cloud/spring-cloud-netflix-feign/pom.xml b/spring-cloud/spring-cloud-netflix-feign/pom.xml
new file mode 100644
index 0000000000..aa5ba5dbdb
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/pom.xml
@@ -0,0 +1,71 @@
+
+
+ 4.0.0
+ com.baeldung.cloud
+ spring-cloud-netlix-feign
+ 0.0.1-SNAPSHOT
+ spring-cloud-netflix-feign
+ Netflix Feign project for Spring Boot
+
+
+ com.baeldung
+ parent-boot-1
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-1
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-feign
+
+
+
+ com.netflix.feign
+ feign-okhttp
+ ${feign-ok.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.apache.httpcomponents
+ httpcore
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ Camden.SR7
+ 8.18.0
+
+
+
+
+
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/ExampleApplication.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/ExampleApplication.java
new file mode 100644
index 0000000000..e5ed9cbecf
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/ExampleApplication.java
@@ -0,0 +1,16 @@
+package com.baeldung.cloud.netflix.feign;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
+
+@SpringBootApplication
+@EnableFeignClients
+public class ExampleApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ExampleApplication.class, args);
+ }
+
+}
+
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/client/JSONPlaceHolderClient.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/client/JSONPlaceHolderClient.java
new file mode 100644
index 0000000000..80a455a4c4
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/client/JSONPlaceHolderClient.java
@@ -0,0 +1,25 @@
+package com.baeldung.cloud.netflix.feign.client;
+
+import com.baeldung.cloud.netflix.feign.config.ClientConfiguration;
+import com.baeldung.cloud.netflix.feign.hystrix.JSONPlaceHolderFallback;
+import com.baeldung.cloud.netflix.feign.model.Post;
+import org.springframework.cloud.netflix.feign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+@FeignClient(value = "jplaceholder",
+ url = "https://jsonplaceholder.typicode.com/",
+ configuration = ClientConfiguration.class,
+ fallback = JSONPlaceHolderFallback.class)
+public interface JSONPlaceHolderClient {
+
+ @RequestMapping(method = RequestMethod.GET, value = "/posts")
+ List getPosts();
+
+
+ @RequestMapping(method = RequestMethod.GET, value = "/posts/{postId}", produces = "application/json")
+ Post getPostById(@PathVariable("postId") Long postId);
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/ClientConfiguration.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/ClientConfiguration.java
new file mode 100644
index 0000000000..bc211b181e
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/ClientConfiguration.java
@@ -0,0 +1,38 @@
+package com.baeldung.cloud.netflix.feign.config;
+
+import feign.Logger;
+import feign.RequestInterceptor;
+import feign.codec.ErrorDecoder;
+import feign.okhttp.OkHttpClient;
+
+import org.apache.http.entity.ContentType;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ClientConfiguration {
+
+ @Bean
+ public Logger.Level feignLoggerLevel() {
+ return Logger.Level.FULL;
+ }
+
+ @Bean
+ public ErrorDecoder errorDecoder() {
+ return new ErrorDecoder.Default();
+ }
+
+ @Bean
+ public OkHttpClient client() {
+ return new OkHttpClient();
+ }
+
+ @Bean
+ public RequestInterceptor requestInterceptor() {
+ return requestTemplate -> {
+ requestTemplate.header("user", "ajeje");
+ requestTemplate.header("password", "brazof");
+ requestTemplate.header("Accept", ContentType.APPLICATION_JSON.getMimeType());
+ };
+ }
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/CustomErrorDecoder.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/CustomErrorDecoder.java
new file mode 100644
index 0000000000..3e0e80f6d5
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/CustomErrorDecoder.java
@@ -0,0 +1,21 @@
+package com.baeldung.cloud.netflix.feign.config;
+
+import com.baeldung.cloud.netflix.feign.exception.BadRequestException;
+import com.baeldung.cloud.netflix.feign.exception.NotFoundException;
+import feign.Response;
+import feign.codec.ErrorDecoder;
+
+public class CustomErrorDecoder implements ErrorDecoder {
+ @Override
+ public Exception decode(String methodKey, Response response) {
+
+ switch (response.status()){
+ case 400:
+ return new BadRequestException();
+ case 404:
+ return new NotFoundException();
+ default:
+ return new Exception("Generic error");
+ }
+ }
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/BadRequestException.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/BadRequestException.java
new file mode 100644
index 0000000000..6a5f60f7c0
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/BadRequestException.java
@@ -0,0 +1,21 @@
+package com.baeldung.cloud.netflix.feign.exception;
+
+public class BadRequestException extends Exception {
+
+ public BadRequestException() {
+ }
+
+ public BadRequestException(String message) {
+ super(message);
+ }
+
+ public BadRequestException(Throwable cause) {
+ super(cause);
+ }
+
+ @Override
+ public String toString() {
+ return "BadRequestException: "+getMessage();
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/NotFoundException.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/NotFoundException.java
new file mode 100644
index 0000000000..a8d89049fd
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/NotFoundException.java
@@ -0,0 +1,21 @@
+package com.baeldung.cloud.netflix.feign.exception;
+
+public class NotFoundException extends Exception {
+
+ public NotFoundException() {
+ }
+
+ public NotFoundException(String message) {
+ super(message);
+ }
+
+ public NotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ @Override
+ public String toString() {
+ return "NotFoundException: "+getMessage();
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/hystrix/JSONPlaceHolderFallback.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/hystrix/JSONPlaceHolderFallback.java
new file mode 100644
index 0000000000..ab1aa6bf50
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/hystrix/JSONPlaceHolderFallback.java
@@ -0,0 +1,22 @@
+package com.baeldung.cloud.netflix.feign.hystrix;
+
+import com.baeldung.cloud.netflix.feign.client.JSONPlaceHolderClient;
+import com.baeldung.cloud.netflix.feign.model.Post;
+import org.springframework.stereotype.Component;
+
+import java.util.Collections;
+import java.util.List;
+
+@Component
+public class JSONPlaceHolderFallback implements JSONPlaceHolderClient {
+
+ @Override
+ public List getPosts() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Post getPostById(Long postId) {
+ return null;
+ }
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/model/Post.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/model/Post.java
new file mode 100644
index 0000000000..73dd2bc198
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/model/Post.java
@@ -0,0 +1,41 @@
+package com.baeldung.cloud.netflix.feign.model;
+
+public class Post {
+
+ private String userId;
+ private Long id;
+ private String title;
+ private String body;
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/JSONPlaceHolderService.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/JSONPlaceHolderService.java
new file mode 100644
index 0000000000..d2e174a1f0
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/JSONPlaceHolderService.java
@@ -0,0 +1,12 @@
+package com.baeldung.cloud.netflix.feign.service;
+
+import com.baeldung.cloud.netflix.feign.model.Post;
+
+import java.util.List;
+
+public interface JSONPlaceHolderService {
+
+ List getPosts();
+
+ Post getPostById(Long id);
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/impl/JSONPlaceHolderServiceImpl.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/impl/JSONPlaceHolderServiceImpl.java
new file mode 100644
index 0000000000..0cc8d296f0
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/impl/JSONPlaceHolderServiceImpl.java
@@ -0,0 +1,26 @@
+package com.baeldung.cloud.netflix.feign.service.impl;
+
+import com.baeldung.cloud.netflix.feign.client.JSONPlaceHolderClient;
+import com.baeldung.cloud.netflix.feign.model.Post;
+import com.baeldung.cloud.netflix.feign.service.JSONPlaceHolderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class JSONPlaceHolderServiceImpl implements JSONPlaceHolderService {
+
+ @Autowired
+ private JSONPlaceHolderClient jsonPlaceHolderClient;
+
+ @Override
+ public List getPosts() {
+ return jsonPlaceHolderClient.getPosts();
+ }
+
+ @Override
+ public Post getPostById(Long id) {
+ return jsonPlaceHolderClient.getPostById(id);
+ }
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/resources/application.properties b/spring-cloud/spring-cloud-netflix-feign/src/main/resources/application.properties
new file mode 100644
index 0000000000..5927ccb9c1
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/main/resources/application.properties
@@ -0,0 +1,3 @@
+spring.application.name=netflix-feign
+logging.level.com.baeldung.cloud.netflix.feign.client=DEBUG
+feign.hystrix.enabled=true
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/ExampleTestApplication.java b/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/ExampleTestApplication.java
new file mode 100644
index 0000000000..f3c8459f87
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/ExampleTestApplication.java
@@ -0,0 +1,21 @@
+package com.baeldung.cloud.netflix.feign;
+
+import com.baeldung.cloud.netflix.feign.config.ClientConfiguration;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@EnableAutoConfiguration
+@ContextConfiguration(classes = { ClientConfiguration.class })
+public class ExampleTestApplication {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/NetflixFeignUnitTest.java b/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/NetflixFeignUnitTest.java
new file mode 100644
index 0000000000..880948d6d1
--- /dev/null
+++ b/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/NetflixFeignUnitTest.java
@@ -0,0 +1,43 @@
+package com.baeldung.cloud.netflix.feign;
+
+import com.baeldung.cloud.netflix.feign.model.Post;
+import com.baeldung.cloud.netflix.feign.service.JSONPlaceHolderService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.List;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class NetflixFeignUnitTest {
+
+ @Autowired
+ private JSONPlaceHolderService jsonPlaceHolderService;
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+
+ @Test
+ public void whenGetPosts_thenListPostSizeGreaterThanZero() {
+
+ List posts = jsonPlaceHolderService.getPosts();
+
+ assertFalse(posts.isEmpty());
+ }
+
+ @Test
+ public void whenGetPostWithId_thenPostExist() {
+
+ Post post = jsonPlaceHolderService.getPostById(1L);
+
+ assertNotNull(post);
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-openfeign/README.md b/spring-cloud/spring-cloud-openfeign/README.md
index e5777732e4..735903db72 100644
--- a/spring-cloud/spring-cloud-openfeign/README.md
+++ b/spring-cloud/spring-cloud-openfeign/README.md
@@ -1,4 +1,4 @@
### Relevant Articles:
- [Introduction to Spring Cloud OpenFeign](https://www.baeldung.com/spring-cloud-openfeign)
-
+- [Differences Between Netflix Feign and OpenFeign](https://www.baeldung.com/netflix-feign-vs-openfeign)
diff --git a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java b/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java
index 0b16134e92..55c27dde2f 100644
--- a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java
+++ b/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java
@@ -2,6 +2,7 @@ package com.baeldung.cloud.openfeign.config;
import feign.Logger;
import feign.RequestInterceptor;
+import feign.auth.BasicAuthRequestInterceptor;
import feign.codec.ErrorDecoder;
import feign.okhttp.OkHttpClient;
import org.apache.http.entity.ContentType;
@@ -34,4 +35,9 @@ public class ClientConfiguration {
requestTemplate.header("Accept", ContentType.APPLICATION_JSON.getMimeType());
};
}
+
+ // @Bean - uncomment to use this interceptor and remove @Bean from the requestInterceptor()
+ public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
+ return new BasicAuthRequestInterceptor("ajeje", "brazof");
+ }
}
diff --git a/spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/OpenfeignUnitTest.java b/spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/OpenfeignManualTest.java
similarity index 100%
rename from spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/OpenfeignUnitTest.java
rename to spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/OpenfeignManualTest.java
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml
index 042f7657ab..8ba0fc5cad 100644
--- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml
@@ -18,6 +18,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-dependencies
@@ -65,7 +72,8 @@
org.springframework.boot
spring-boot-starter-data-redis
-
+
+
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml
index 5fb9364752..c64341f652 100644
--- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml
@@ -18,6 +18,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-dependencies
@@ -45,6 +52,7 @@
Camden.SR4
+
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml
index 5e35a7c0f5..85790bf895 100644
--- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml
@@ -18,6 +18,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-dependencies
@@ -53,6 +60,7 @@
Edgware.SR4
+
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml
index 7503418ad2..35d0e79543 100644
--- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml
@@ -18,6 +18,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-dependencies
@@ -75,6 +82,7 @@
3.0.1
0.6
+
diff --git a/spring-cloud/spring-cloud-ribbon-client/pom.xml b/spring-cloud/spring-cloud-ribbon-client/pom.xml
index e19d3beaad..fa9cee29a2 100644
--- a/spring-cloud/spring-cloud-ribbon-client/pom.xml
+++ b/spring-cloud/spring-cloud-ribbon-client/pom.xml
@@ -16,6 +16,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-dependencies
diff --git a/spring-cloud/spring-cloud-ribbon-retry/pom.xml b/spring-cloud/spring-cloud-ribbon-retry/pom.xml
index 27037d6710..99eb882421 100644
--- a/spring-cloud/spring-cloud-ribbon-retry/pom.xml
+++ b/spring-cloud/spring-cloud-ribbon-retry/pom.xml
@@ -23,6 +23,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
@@ -48,5 +55,6 @@
Hoxton.SR3
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-security/pom.xml b/spring-cloud/spring-cloud-security/pom.xml
index 498c88ac48..3a007c8df1 100644
--- a/spring-cloud/spring-cloud-security/pom.xml
+++ b/spring-cloud/spring-cloud-security/pom.xml
@@ -20,4 +20,6 @@
auth-server
+
+
diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml
index 669499efb7..52230dd1c1 100644
--- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml
+++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml
@@ -105,6 +105,7 @@
Greenwich.SR1
4.0.0
1.8.2
+
diff --git a/spring-cloud/spring-cloud-task/pom.xml b/spring-cloud/spring-cloud-task/pom.xml
index e2006ee9d3..21d8a4e42b 100644
--- a/spring-cloud/spring-cloud-task/pom.xml
+++ b/spring-cloud/spring-cloud-task/pom.xml
@@ -22,6 +22,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-task-dependencies
@@ -42,6 +49,7 @@
Hoxton.SR4
2.2.3.RELEASE
+
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml
index 118a9e2c11..321da7527a 100644
--- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml
@@ -35,7 +35,6 @@
org.springframework.boot
spring-boot-starter-web
- ${spring-boot-starter-web.version}
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml
index 9cf96df60e..77e8ef7c20 100644
--- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml
@@ -35,13 +35,13 @@
org.springframework.boot
spring-boot-starter-web
- ${spring-boot-starter-web.version}
+ ${spring-boot.version}
org.springframework.boot
spring-boot-starter-test
- ${spring-boot-starter-web.version}
+ ${spring-boot.version}
test
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml
index cd25f5f294..c3f6642351 100644
--- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml
@@ -41,7 +41,7 @@
org.springframework.boot
spring-boot-starter-test
- ${spring-boot-starter-web.version}
+ ${spring-boot.version}
test
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml
index 3d238d5d5f..ddffe540c5 100644
--- a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml
@@ -50,7 +50,6 @@
org.springframework.boot
spring-boot-starter-test
- ${spring-boot-starter-web.version}
test
diff --git a/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml b/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml
index 136461ccb9..4e092736a5 100644
--- a/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml
@@ -12,10 +12,18 @@
com.baeldung.spring.cloud
spring-cloud-zuul-fallback
1.0.0-SNAPSHOT
+ ../pom.xml
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
diff --git a/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml b/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml
index bafd4ffcd1..d2914b48bf 100644
--- a/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml
+++ b/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml
@@ -15,6 +15,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-starter-parent
diff --git a/spring-cloud/spring-cloud-zuul/pom.xml b/spring-cloud/spring-cloud-zuul/pom.xml
index b3c66dd1c6..b8db1f2fc7 100644
--- a/spring-cloud/spring-cloud-zuul/pom.xml
+++ b/spring-cloud/spring-cloud-zuul/pom.xml
@@ -24,6 +24,13 @@
+
+ org.junit
+ junit-bom
+ ${junit-jupiter.version}
+ pom
+ import
+
org.springframework.cloud
spring-cloud-dependencies
@@ -73,6 +80,7 @@
Hoxton.SR4
+
diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml
index 8873282d1e..b42d32b6b3 100644
--- a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml
+++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml
@@ -13,18 +13,6 @@
0.0.1-SNAPSHOT
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
com.marcosbarbero.cloud
diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerUnitTest.java b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerManualTest.java
similarity index 99%
rename from spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerUnitTest.java
rename to spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerManualTest.java
index d23ec836f9..4d3cede534 100644
--- a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerUnitTest.java
+++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerManualTest.java
@@ -26,7 +26,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@AutoConfigureTestDatabase
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-public class GreetingControllerUnitTest {
+public class GreetingControllerManualTest {
private static final String SIMPLE_GREETING = "/greeting/simple";
private static final String ADVANCED_GREETING = "/greeting/advanced";
diff --git a/spring-cucumber/pom.xml b/spring-cucumber/pom.xml
index 245d10e77b..a945797ee1 100644
--- a/spring-cucumber/pom.xml
+++ b/spring-cucumber/pom.xml
@@ -21,27 +21,27 @@
spring-boot-starter-web
- info.cukes
+ io.cucumber
cucumber-core
- ${cucumber.java.version}
+ ${cucumber.version}
test
- info.cukes
+ io.cucumber
cucumber-java
- ${cucumber.java.version}
+ ${cucumber.version}
test
- info.cukes
+ io.cucumber
cucumber-junit
- ${cucumber.java.version}
+ ${cucumber.version}
test
- info.cukes
+ io.cucumber
cucumber-spring
- ${cucumber.java.version}
+ ${cucumber.version}
test
@@ -53,7 +53,7 @@
- 1.2.5
+ 6.8.0
1.3.2
diff --git a/spring-cucumber/src/main/java/com/baeldung/BaeldungController.java b/spring-cucumber/src/main/java/com/baeldung/BaeldungController.java
index e74e773106..713c1022c5 100644
--- a/spring-cucumber/src/main/java/com/baeldung/BaeldungController.java
+++ b/spring-cucumber/src/main/java/com/baeldung/BaeldungController.java
@@ -4,18 +4,16 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
-import javax.servlet.http.HttpServletResponse;
-
@RestController
public class BaeldungController {
@GetMapping("/hello")
- public String sayHello(HttpServletResponse response) {
+ public String sayHello() {
return "hello";
}
@PostMapping("/baeldung")
- public String sayHelloPost(HttpServletResponse response) {
+ public String sayHelloPost() {
return "hello";
}
}
diff --git a/spring-cucumber/src/main/java/com/baeldung/VersionController.java b/spring-cucumber/src/main/java/com/baeldung/VersionController.java
index f673f0e31f..e46ca64a01 100644
--- a/spring-cucumber/src/main/java/com/baeldung/VersionController.java
+++ b/spring-cucumber/src/main/java/com/baeldung/VersionController.java
@@ -1,13 +1,12 @@
package com.baeldung;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class VersionController {
- @RequestMapping(method = { RequestMethod.GET }, value = { "/version" })
+ @GetMapping("/version")
public String getVersion() {
return "1.0";
}
diff --git a/spring-cucumber/src/test/java/com/baeldung/CucumberIntegrationTest.java b/spring-cucumber/src/test/java/com/baeldung/CucumberIntegrationTest.java
index f48ab410ca..2077a28146 100644
--- a/spring-cucumber/src/test/java/com/baeldung/CucumberIntegrationTest.java
+++ b/spring-cucumber/src/test/java/com/baeldung/CucumberIntegrationTest.java
@@ -1,11 +1,11 @@
package com.baeldung;
+import io.cucumber.junit.Cucumber;
+import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
-import cucumber.api.CucumberOptions;
-import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources")
-public class CucumberIntegrationTest extends SpringIntegrationTest{
+public class CucumberIntegrationTest extends SpringIntegrationTest {
}
\ No newline at end of file
diff --git a/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java b/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java
index 8655a02469..7b5c4e21ff 100644
--- a/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java
+++ b/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java
@@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import io.cucumber.spring.CucumberContextConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
@@ -13,9 +14,8 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
-//@RunWith(SpringJUnit4ClassRunner.class)
+@CucumberContextConfiguration
@SpringBootTest(classes = SpringDemoApplication.class, webEnvironment = WebEnvironment.DEFINED_PORT)
-@ContextConfiguration
public class SpringIntegrationTest {
static ResponseResults latestResponse = null;
diff --git a/spring-cucumber/src/test/java/com/baeldung/StepDefsIntegrationTest.java b/spring-cucumber/src/test/java/com/baeldung/StepDefsIntegrationTest.java
index e1b6e370c7..9611e95dcf 100644
--- a/spring-cucumber/src/test/java/com/baeldung/StepDefsIntegrationTest.java
+++ b/spring-cucumber/src/test/java/com/baeldung/StepDefsIntegrationTest.java
@@ -1,14 +1,14 @@
package com.baeldung;
+import io.cucumber.java.en.And;
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+import org.springframework.http.HttpStatus;
+
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-import cucumber.api.java.en.Given;
-import org.springframework.http.HttpStatus;
-
-import cucumber.api.java.en.And;
-import cucumber.api.java.en.Then;
-import cucumber.api.java.en.When;
public class StepDefsIntegrationTest extends SpringIntegrationTest {
diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml
index 46e40722f1..21324e6757 100644
--- a/spring-dispatcher-servlet/pom.xml
+++ b/spring-dispatcher-servlet/pom.xml
@@ -40,11 +40,6 @@
javax.servlet.jsp-api
${javax.servlet.jsp-api.version}
-
- org.codehaus.jackson
- jackson-mapper-asl
- ${jackson-mapper-asl.version}
-
javax.servlet
jstl
diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml
index 3c84e9c11e..50d377b73f 100644
--- a/spring-jersey/pom.xml
+++ b/spring-jersey/pom.xml
@@ -226,7 +226,7 @@
4.4.9
4.5.5
4.0.0
- 2.25.1
+ 2.27.2
3.10.0
1.5.10.RELEASE
diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml
index 95418645fa..550d49b5b2 100644
--- a/spring-jooq/pom.xml
+++ b/spring-jooq/pom.xml
@@ -206,7 +206,7 @@
1.0.0
1.5
1.0.0
- org.jooq.example.spring.Application
+ 1.4.198
\ No newline at end of file
diff --git a/spring-kafka/pom.xml b/spring-kafka/pom.xml
index 2b4a0914e6..235dd75966 100644
--- a/spring-kafka/pom.xml
+++ b/spring-kafka/pom.xml
@@ -1,9 +1,9 @@
-
+
4.0.0
spring-kafka
- 0.0.1-SNAPSHOT
spring-kafka
Intro to Kafka with Spring
@@ -15,25 +15,36 @@
-
org.springframework.boot
spring-boot-starter
-
org.springframework.kafka
spring-kafka
+ ${spring-kafka.version}
-
com.fasterxml.jackson.core
jackson-databind
+
+ org.springframework.kafka
+ spring-kafka-test
+ ${spring-kafka.version}
+ test
+
+
+ org.testcontainers
+ kafka
+ ${testcontainers-kafka.version}
+ test
+
- 2.3.7.RELEASE
+ 2.5.8.RELEASE
+ 1.15.0
\ No newline at end of file
diff --git a/spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaConsumer.java b/spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaConsumer.java
new file mode 100644
index 0000000000..48a194b4e3
--- /dev/null
+++ b/spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaConsumer.java
@@ -0,0 +1,39 @@
+package com.baeldung.kafka.embedded;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.springframework.kafka.annotation.KafkaListener;
+import org.springframework.stereotype.Component;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Component
+public class KafkaConsumer {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(KafkaConsumer.class);
+
+ private CountDownLatch latch = new CountDownLatch(1);
+ private String payload = null;
+
+ @KafkaListener(topics = "${test.topic}")
+ public void receive(ConsumerRecord, ?> consumerRecord) {
+ LOGGER.info("received payload='{}'", consumerRecord.toString());
+ setPayload(consumerRecord.toString());
+ latch.countDown();
+ }
+
+ public CountDownLatch getLatch() {
+ return latch;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ private void setPayload(String payload) {
+ this.payload = payload;
+ }
+
+}
diff --git a/spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaProducer.java b/spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaProducer.java
new file mode 100644
index 0000000000..d7cbd35011
--- /dev/null
+++ b/spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaProducer.java
@@ -0,0 +1,22 @@
+package com.baeldung.kafka.embedded;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.stereotype.Component;
+
+@Component
+public class KafkaProducer {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(KafkaProducer.class);
+
+ @Autowired
+ private KafkaTemplate kafkaTemplate;
+
+ public void send(String topic, String payload) {
+ LOGGER.info("sending payload='{}' to topic='{}'", payload, topic);
+ kafkaTemplate.send(topic, payload);
+ }
+
+}
diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/logging/RestTemplateConfigurationApplication.java b/spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaProducerConsumerApplication.java
similarity index 62%
rename from spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/logging/RestTemplateConfigurationApplication.java
rename to spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaProducerConsumerApplication.java
index 4fa14edda1..bf14251d75 100644
--- a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/logging/RestTemplateConfigurationApplication.java
+++ b/spring-kafka/src/main/java/com/baeldung/kafka/embedded/KafkaProducerConsumerApplication.java
@@ -1,4 +1,4 @@
-package com.baeldung.resttemplate.logging;
+package com.baeldung.kafka.embedded;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -6,9 +6,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableAutoConfiguration
-public class RestTemplateConfigurationApplication {
+public class KafkaProducerConsumerApplication {
public static void main(String[] args) {
- SpringApplication.run(RestTemplateConfigurationApplication.class, args);
+ SpringApplication.run(KafkaProducerConsumerApplication.class, args);
}
+
}
diff --git a/spring-kafka/src/test/java/com/baeldung/SpringContextManualTest.java b/spring-kafka/src/test/java/com/baeldung/SpringContextManualTest.java
deleted file mode 100644
index 0d2c19136f..0000000000
--- a/spring-kafka/src/test/java/com/baeldung/SpringContextManualTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-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.baeldung.spring.kafka.KafkaApplication;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = KafkaApplication.class)
-public class SpringContextManualTest {
-
- @Test
- public void whenSpringContextIsBootstrapped_thenNoExceptions() {
- }
-}
diff --git a/spring-kafka/src/test/java/com/baeldung/kafka/embedded/EmbeddedKafkaIntegrationTest.java b/spring-kafka/src/test/java/com/baeldung/kafka/embedded/EmbeddedKafkaIntegrationTest.java
new file mode 100644
index 0000000000..4c727795c4
--- /dev/null
+++ b/spring-kafka/src/test/java/com/baeldung/kafka/embedded/EmbeddedKafkaIntegrationTest.java
@@ -0,0 +1,52 @@
+package com.baeldung.kafka.embedded;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.kafka.test.context.EmbeddedKafka;
+import org.springframework.test.annotation.DirtiesContext;
+
+@SpringBootTest
+@DirtiesContext
+@EmbeddedKafka(partitions = 1, brokerProperties = { "listeners=PLAINTEXT://localhost:9092", "port=9092" })
+class EmbeddedKafkaIntegrationTest {
+
+ @Autowired
+ public KafkaTemplate template;
+
+ @Autowired
+ private KafkaConsumer consumer;
+
+ @Autowired
+ private KafkaProducer producer;
+
+ @Value("${test.topic}")
+ private String topic;
+
+ @Test
+ public void givenEmbeddedKafkaBroker_whenSendingtoDefaultTemplate_thenMessageReceived() throws Exception {
+ template.send(topic, "Sending with default template");
+ consumer.getLatch().await(10000, TimeUnit.MILLISECONDS);
+ assertThat(consumer.getLatch().getCount(), equalTo(0L));
+
+ assertThat(consumer.getPayload(), containsString("embedded-test-topic"));
+ }
+
+ @Test
+ public void givenEmbeddedKafkaBroker_whenSendingtoSimpleProducer_thenMessageReceived() throws Exception {
+ producer.send(topic, "Sending with our own simple KafkaProducer");
+ consumer.getLatch().await(10000, TimeUnit.MILLISECONDS);
+
+ assertThat(consumer.getLatch().getCount(), equalTo(0L));
+ assertThat(consumer.getPayload(), containsString("embedded-test-topic"));
+ }
+
+}
diff --git a/spring-kafka/src/test/java/com/baeldung/kafka/testcontainers/KafkaTestContainersLiveTest.java b/spring-kafka/src/test/java/com/baeldung/kafka/testcontainers/KafkaTestContainersLiveTest.java
new file mode 100644
index 0000000000..74d6f824b1
--- /dev/null
+++ b/spring-kafka/src/test/java/com/baeldung/kafka/testcontainers/KafkaTestContainersLiveTest.java
@@ -0,0 +1,127 @@
+package com.baeldung.kafka.testcontainers;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.kafka.clients.consumer.ConsumerConfig;
+import org.apache.kafka.clients.producer.ProducerConfig;
+import org.apache.kafka.common.serialization.StringDeserializer;
+import org.apache.kafka.common.serialization.StringSerializer;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.TestConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Import;
+import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
+import org.springframework.kafka.core.ConsumerFactory;
+import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
+import org.springframework.kafka.core.DefaultKafkaProducerFactory;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.kafka.core.ProducerFactory;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.testcontainers.containers.KafkaContainer;
+import org.testcontainers.utility.DockerImageName;
+
+import com.baeldung.kafka.embedded.KafkaConsumer;
+import com.baeldung.kafka.embedded.KafkaProducer;
+import com.baeldung.kafka.embedded.KafkaProducerConsumerApplication;
+
+/**
+ * This test class uses Testcontainers to instantiate and manage an external Apache
+ * Kafka broker hosted inside a Docker container.
+ *
+ * Therefore, one of the prerequisites for using Testcontainers is that Docker is installed on the host running this test
+ *
+ */
+@RunWith(SpringRunner.class)
+@Import(com.baeldung.kafka.testcontainers.KafkaTestContainersLiveTest.KafkaTestContainersConfiguration.class)
+@SpringBootTest(classes = KafkaProducerConsumerApplication.class)
+@DirtiesContext
+public class KafkaTestContainersLiveTest {
+
+ @ClassRule
+ public static KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:5.4.3"));
+
+ @Autowired
+ public KafkaTemplate template;
+
+ @Autowired
+ private KafkaConsumer consumer;
+
+ @Autowired
+ private KafkaProducer producer;
+
+ @Value("${test.topic}")
+ private String topic;
+
+ @Test
+ public void givenKafkaDockerContainer_whenSendingtoDefaultTemplate_thenMessageReceived() throws Exception {
+ template.send(topic, "Sending with default template");
+ consumer.getLatch().await(10000, TimeUnit.MILLISECONDS);
+
+ assertThat(consumer.getLatch().getCount(), equalTo(0L));
+ assertThat(consumer.getPayload(), containsString("embedded-test-topic"));
+ }
+
+ @Test
+ public void givenKafkaDockerContainer_whenSendingtoSimpleProducer_thenMessageReceived() throws Exception {
+ producer.send(topic, "Sending with own controller");
+ consumer.getLatch().await(10000, TimeUnit.MILLISECONDS);
+
+ assertThat(consumer.getLatch().getCount(), equalTo(0L));
+ assertThat(consumer.getPayload(), containsString("embedded-test-topic"));
+ }
+
+ @TestConfiguration
+ static class KafkaTestContainersConfiguration {
+
+ @Bean
+ ConcurrentKafkaListenerContainerFactory kafkaListenerContainerFactory() {
+ ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>();
+ factory.setConsumerFactory(consumerFactory());
+ return factory;
+ }
+
+ @Bean
+ public ConsumerFactory consumerFactory() {
+ return new DefaultKafkaConsumerFactory<>(consumerConfigs());
+ }
+
+ @Bean
+ public Map consumerConfigs() {
+ Map props = new HashMap<>();
+ props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafka.getBootstrapServers());
+ props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
+ props.put(ConsumerConfig.GROUP_ID_CONFIG, "baeldung");
+ props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
+ props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
+ return props;
+ }
+
+ @Bean
+ public ProducerFactory producerFactory() {
+ Map configProps = new HashMap<>();
+ configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafka.getBootstrapServers());
+ configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
+ configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
+ return new DefaultKafkaProducerFactory<>(configProps);
+ }
+
+ @Bean
+ public KafkaTemplate kafkaTemplate() {
+ return new KafkaTemplate<>(producerFactory());
+ }
+
+ }
+
+}
diff --git a/spring-kafka/src/test/resources/application.yml b/spring-kafka/src/test/resources/application.yml
new file mode 100644
index 0000000000..7d7997c6fd
--- /dev/null
+++ b/spring-kafka/src/test/resources/application.yml
@@ -0,0 +1,7 @@
+spring:
+ kafka:
+ consumer:
+ auto-offset-reset: earliest
+ group-id: baeldung
+test:
+ topic: embedded-test-topic
\ No newline at end of file
diff --git a/spring-kafka/src/test/resources/logback.xml b/spring-kafka/src/test/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-kafka/src/test/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-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java
index 4bd692f609..7f296ce6a7 100644
--- a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java
+++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java
@@ -1,37 +1,61 @@
package com.baeldung.spring.configuration;
+import freemarker.cache.ClassTemplateLoader;
+import freemarker.cache.TemplateLoader;
+import freemarker.template.Configuration;
import java.util.Properties;
-
+import org.springframework.beans.factory.annotation.Value;
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.context.support.ResourceBundleMessageSource;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
-import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
import org.thymeleaf.spring5.SpringTemplateEngine;
-import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
+import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
+import org.thymeleaf.templateresolver.ITemplateResolver;
-@Configuration
@ComponentScan(basePackages = { "com.baeldung.spring.mail" })
+@PropertySource(value={"classpath:application.properties"})
public class EmailConfiguration {
+
+ @Value("${spring.mail.host}")
+ private String mailServerHost;
+
+ @Value("${spring.mail.port}")
+ private Integer mailServerPort;
+
+ @Value("${spring.mail.username}")
+ private String mailServerUsername;
+
+ @Value("${spring.mail.password}")
+ private String mailServerPassword;
+
+ @Value("${spring.mail.properties.mail.smtp.auth}")
+ private String mailServerAuth;
+
+ @Value("${spring.mail.properties.mail.smtp.starttls.enable}")
+ private String mailServerStartTls;
+
+ @Value("${spring.mail.templates.path}")
+ private String mailTemplatesPath;
@Bean
public JavaMailSender getJavaMailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
- mailSender.setHost("smtp.gmail.com");
- mailSender.setPort(587);
+ mailSender.setHost(mailServerHost);
+ mailSender.setPort(mailServerPort);
- mailSender.setUsername("my.gmail@gmail.com");
- mailSender.setPassword("password");
+ mailSender.setUsername(mailServerUsername);
+ mailSender.setPassword(mailServerPassword);
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
- props.put("mail.smtp.auth", "true");
- props.put("mail.smtp.starttls.enable", "false");
+ props.put("mail.smtp.auth", mailServerAuth);
+ props.put("mail.smtp.starttls.enable", mailServerStartTls);
props.put("mail.debug", "true");
return mailSender;
@@ -45,44 +69,57 @@ public class EmailConfiguration {
}
@Bean
- public SpringTemplateEngine thymeleafTemplateEngine() {
+ public SpringTemplateEngine thymeleafTemplateEngine(ITemplateResolver templateResolver) {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
- templateEngine.setTemplateResolver(thymeleafTemplateResolver());
+ templateEngine.setTemplateResolver(templateResolver);
templateEngine.setTemplateEngineMessageSource(emailMessageSource());
return templateEngine;
}
@Bean
- public SpringResourceTemplateResolver thymeleafTemplateResolver() {
- SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
- templateResolver.setPrefix("/WEB-INF/views/mail/");
+ public ITemplateResolver thymeleafClassLoaderTemplateResolver() {
+ ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
+ templateResolver.setPrefix(mailTemplatesPath + "/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("HTML");
templateResolver.setCharacterEncoding("UTF-8");
return templateResolver;
}
+
+// @Bean
+// public ITemplateResolver thymeleafFilesystemTemplateResolver() {
+// FileTemplateResolver templateResolver = new FileTemplateResolver();
+// templateResolver.setPrefix(mailTemplatesPath + "/");
+// templateResolver.setSuffix(".html");
+// templateResolver.setTemplateMode("HTML");
+// templateResolver.setCharacterEncoding("UTF-8");
+// return templateResolver;
+// }
@Bean
- public FreeMarkerConfigurer freemarkerConfig() {
- FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
- freeMarkerConfigurer.setTemplateLoaderPath("/WEB-INF/views/mail");
+ public FreeMarkerConfigurer freemarkerClassLoaderConfig() {
+ Configuration configuration = new Configuration(Configuration.VERSION_2_3_27);
+ TemplateLoader templateLoader = new ClassTemplateLoader(this.getClass(), "/" + mailTemplatesPath);
+ configuration.setTemplateLoader(templateLoader);
+ FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
+ freeMarkerConfigurer.setConfiguration(configuration);
return freeMarkerConfigurer;
}
- @Bean
- public FreeMarkerViewResolver freemarkerViewResolver() {
- FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
- resolver.setCache(true);
- resolver.setPrefix("");
- resolver.setSuffix(".ftl");
- return resolver;
- }
-
+// @Bean
+// public FreeMarkerConfigurer freemarkerFilesystemConfig() throws IOException {
+// Configuration configuration = new Configuration(Configuration.VERSION_2_3_27);
+// TemplateLoader templateLoader = new FileTemplateLoader(new File(mailTemplatesPath));
+// configuration.setTemplateLoader(templateLoader);
+// FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
+// freeMarkerConfigurer.setConfiguration(configuration);
+// return freeMarkerConfigurer;
+// }
@Bean
public ResourceBundleMessageSource emailMessageSource() {
final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
- messageSource.setBasename("/mailMessages");
+ messageSource.setBasename("mailMessages");
return messageSource;
}
diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java
index 1eb7a5f8b4..a0c8907a87 100644
--- a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java
+++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java
@@ -112,7 +112,7 @@ public class EmailServiceImpl implements EmailService {
String to, String subject, Map templateModel)
throws IOException, TemplateException, MessagingException {
- Template freemarkerTemplate = freemarkerConfigurer.createConfiguration().getTemplate("template-freemarker.ftl");
+ Template freemarkerTemplate = freemarkerConfigurer.getConfiguration().getTemplate("template-freemarker.ftl");
String htmlBody = FreeMarkerTemplateUtils.processTemplateIntoString(freemarkerTemplate, templateModel);
sendHtmlMessage(to, subject, htmlBody);
diff --git a/spring-mvc-basics-2/src/main/resources/application.properties b/spring-mvc-basics-2/src/main/resources/application.properties
index 9a804c07d8..7ca8d33d5c 100644
--- a/spring-mvc-basics-2/src/main/resources/application.properties
+++ b/spring-mvc-basics-2/src/main/resources/application.properties
@@ -6,7 +6,7 @@ spring.mail.port=587
spring.mail.username=username
spring.mail.password=password
spring.mail.properties.mail.smtp.auth=true
-spring.mail.properties.mail.smtp.starttls.enable=true
+spring.mail.properties.mail.smtp.starttls.enable=false
# Amazon SES SMTP
#spring.mail.host=email-smtp.us-west-2.amazonaws.com
@@ -19,4 +19,14 @@ spring.mail.properties.mail.smtp.starttls.enable=true
#spring.mail.properties.mail.smtp.starttls.required=true
# path to attachment file
-attachment.invoice=path_to_file
\ No newline at end of file
+attachment.invoice=path_to_file
+
+
+#
+# Mail templates
+#
+
+# Templates directory inside main/resources or absolute filesystem path
+spring.mail.templates.path=mail-templates
+#spring.mail.templates.path=/path/to/templates
+
diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/template-freemarker.ftl b/spring-mvc-basics-2/src/main/resources/mail-templates/template-freemarker.ftl
similarity index 100%
rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/template-freemarker.ftl
rename to spring-mvc-basics-2/src/main/resources/mail-templates/template-freemarker.ftl
diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/template-thymeleaf.html b/spring-mvc-basics-2/src/main/resources/mail-templates/template-thymeleaf.html
similarity index 100%
rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/template-thymeleaf.html
rename to spring-mvc-basics-2/src/main/resources/mail-templates/template-thymeleaf.html
diff --git a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java
index 0154fb636a..409b6e1ab5 100644
--- a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java
+++ b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java
@@ -11,11 +11,7 @@ public class MaxSizeConstraintValidator implements ConstraintValidator values, ConstraintValidatorContext context) {
- boolean isValid = true;
- if (values.size() > 4) {
- isValid = false;
- }
- return isValid;
+ return values.size() <= 4;
}
}
diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java b/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java
index 8a5d1c71af..c89b043486 100644
--- a/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java
+++ b/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java
@@ -2,28 +2,35 @@ package com.baeldung.datetime;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.format.datetime.DateFormatter;
+import org.springframework.format.datetime.DateFormatterRegistrar;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.format.number.NumberFormatAnnotationFormatterFactory;
import org.springframework.format.support.DefaultFormattingConversionService;
import org.springframework.format.support.FormattingConversionService;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.time.format.DateTimeFormatter;
@Configuration
-class DateTimeConfig {
+public class DateTimeConfig extends WebMvcConfigurationSupport {
@Bean
- public FormattingConversionService conversionService() {
+ @Override
+ public FormattingConversionService mvcConversionService() {
DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(false);
conversionService.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
- DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
- registrar.setDateFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy"));
- registrar.setDateTimeFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss"));
- registrar.registerFormatters(conversionService);
+ DateTimeFormatterRegistrar dateTimeRegistrar = new DateTimeFormatterRegistrar();
+ dateTimeRegistrar.setDateFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy"));
+ dateTimeRegistrar.setDateTimeFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss"));
+ dateTimeRegistrar.registerFormatters(conversionService);
+
+ DateFormatterRegistrar dateRegistrar = new DateFormatterRegistrar();
+ dateRegistrar.setFormatter(new DateFormatter("dd.MM.yyyy"));
+ dateRegistrar.registerFormatters(conversionService);
return conversionService;
}
-
}
\ No newline at end of file
diff --git a/spring-rest-compress/README.md b/spring-rest-compress/README.md
deleted file mode 100644
index ce627d8595..0000000000
--- a/spring-rest-compress/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## Spring REST Compress
-
-This module contains articles about request compression with Spring
-
-### Relevant Articles:
-- [How to compress requests using the Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-compressing-requests)
diff --git a/spring-rest-compress/pom.xml b/spring-rest-compress/pom.xml
deleted file mode 100644
index 9ff0be9682..0000000000
--- a/spring-rest-compress/pom.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
- 4.0.0
- spring-rest-compress
- 0.0.1-SNAPSHOT
- spring-rest-compress
-
-
- com.baeldung
- parent-boot-2
- 0.0.1-SNAPSHOT
- ../parent-boot-2
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-tomcat
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-jetty
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
-
- commons-io
- commons-io
- ${commons-io.version}
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
- 1.8
- 2.6
-
-
-
diff --git a/spring-resttemplate-2/README.md b/spring-resttemplate-2/README.md
index e1e0ba40b0..37d8ac9740 100644
--- a/spring-resttemplate-2/README.md
+++ b/spring-resttemplate-2/README.md
@@ -8,3 +8,4 @@ This module contains articles about Spring RestTemplate
- [Proxies With RestTemplate](https://www.baeldung.com/java-resttemplate-proxy)
- [A Custom Media Type for a Spring REST API](https://www.baeldung.com/spring-rest-custom-media-type)
- [RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json)
+- [How to compress requests using the Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-compressing-requests)
diff --git a/spring-resttemplate-2/pom.xml b/spring-resttemplate-2/pom.xml
index b1d6f60c53..2aed154be6 100644
--- a/spring-resttemplate-2/pom.xml
+++ b/spring-resttemplate-2/pom.xml
@@ -20,7 +20,30 @@
org.springframework.boot
spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-jetty
+
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+
+ commons-io
+ commons-io
+ ${commons-io.version}
+
+
org.springframework.boot
spring-boot-starter-test
diff --git a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/CompressingClientHttpRequestInterceptor.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/CompressingClientHttpRequestInterceptor.java
similarity index 96%
rename from spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/CompressingClientHttpRequestInterceptor.java
rename to spring-resttemplate-2/src/main/java/com/baeldung/compress/CompressingClientHttpRequestInterceptor.java
index 78b77256af..e880e8f915 100644
--- a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/CompressingClientHttpRequestInterceptor.java
+++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/CompressingClientHttpRequestInterceptor.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.rest.compress;
+package com.baeldung.compress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/GzipUtils.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/GzipUtils.java
similarity index 83%
rename from spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/GzipUtils.java
rename to spring-resttemplate-2/src/main/java/com/baeldung/compress/GzipUtils.java
index b9731535b2..50c565d92c 100644
--- a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/GzipUtils.java
+++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/GzipUtils.java
@@ -1,14 +1,14 @@
-package com.baeldung.spring.rest.compress;
-
-import org.apache.commons.codec.Charsets;
-import org.apache.commons.io.IOUtils;
+package com.baeldung.compress;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
+import org.apache.commons.io.IOUtils;
+
public class GzipUtils {
/**
@@ -19,7 +19,7 @@ public class GzipUtils {
* @throws Exception
*/
public static byte[] compress(String text) throws Exception {
- return GzipUtils.compress(text.getBytes(Charsets.UTF_8));
+ return GzipUtils.compress(text.getBytes(StandardCharsets.UTF_8));
}
/**
@@ -46,7 +46,7 @@ public class GzipUtils {
*/
public static String decompress(byte[] body) throws IOException {
try (GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(body))) {
- return IOUtils.toString(gzipInputStream, Charsets.UTF_8);
+ return IOUtils.toString(gzipInputStream, StandardCharsets.UTF_8);
}
}
}
diff --git a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/JettyWebServerConfiguration.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/JettyWebServerConfiguration.java
similarity index 96%
rename from spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/JettyWebServerConfiguration.java
rename to spring-resttemplate-2/src/main/java/com/baeldung/compress/JettyWebServerConfiguration.java
index 8de8e5b523..3ac8c31ab3 100644
--- a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/JettyWebServerConfiguration.java
+++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/JettyWebServerConfiguration.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.rest.compress;
+package com.baeldung.compress;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
diff --git a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/Message.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/Message.java
similarity index 92%
rename from spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/Message.java
rename to spring-resttemplate-2/src/main/java/com/baeldung/compress/Message.java
index 24272a4fca..f43d06c2fc 100644
--- a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/Message.java
+++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/Message.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.rest.compress;
+package com.baeldung.compress;
public class Message {
diff --git a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/MessageController.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/MessageController.java
similarity index 96%
rename from spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/MessageController.java
rename to spring-resttemplate-2/src/main/java/com/baeldung/compress/MessageController.java
index 2fc2ca8272..ec574d9dec 100644
--- a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/MessageController.java
+++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/MessageController.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.rest.compress;
+package com.baeldung.compress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/RestTemplateConfiguration.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/RestTemplateConfiguration.java
similarity index 92%
rename from spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/RestTemplateConfiguration.java
rename to spring-resttemplate-2/src/main/java/com/baeldung/compress/RestTemplateConfiguration.java
index c1e3c89ae9..12b1e4249e 100644
--- a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/RestTemplateConfiguration.java
+++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/RestTemplateConfiguration.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.rest.compress;
+package com.baeldung.compress;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/SpringCompressRequestApplication.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/SpringCompressRequestApplication.java
similarity index 90%
rename from spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/SpringCompressRequestApplication.java
rename to spring-resttemplate-2/src/main/java/com/baeldung/compress/SpringCompressRequestApplication.java
index 9b1b71979d..9ff88ab257 100644
--- a/spring-rest-compress/src/main/java/com/baeldung/spring/rest/compress/SpringCompressRequestApplication.java
+++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/SpringCompressRequestApplication.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.rest.compress;
+package com.baeldung.compress;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java
index 8df3c13d7b..a7e65fc96c 100644
--- a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java
+++ b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java
@@ -1,7 +1,6 @@
package com.baeldung.resttemplate;
import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
diff --git a/spring-rest-compress/src/test/java/com/baeldung/spring/rest/compress/GzipUtilsUnitTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/compress/GzipUtilsUnitTest.java
similarity index 92%
rename from spring-rest-compress/src/test/java/com/baeldung/spring/rest/compress/GzipUtilsUnitTest.java
rename to spring-resttemplate-2/src/test/java/com/baeldung/compress/GzipUtilsUnitTest.java
index 431758d358..10c2eeb748 100644
--- a/spring-rest-compress/src/test/java/com/baeldung/spring/rest/compress/GzipUtilsUnitTest.java
+++ b/spring-resttemplate-2/src/test/java/com/baeldung/compress/GzipUtilsUnitTest.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.rest.compress;
+package com.baeldung.compress;
import org.junit.Test;
diff --git a/spring-rest-compress/src/test/java/com/baeldung/spring/rest/compress/MessageControllerUnitTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/compress/MessageControllerUnitTest.java
similarity index 97%
rename from spring-rest-compress/src/test/java/com/baeldung/spring/rest/compress/MessageControllerUnitTest.java
rename to spring-resttemplate-2/src/test/java/com/baeldung/compress/MessageControllerUnitTest.java
index 50b2b7ccd7..643e3f6881 100644
--- a/spring-rest-compress/src/test/java/com/baeldung/spring/rest/compress/MessageControllerUnitTest.java
+++ b/spring-resttemplate-2/src/test/java/com/baeldung/compress/MessageControllerUnitTest.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.rest.compress;
+package com.baeldung.compress;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/LoggingInterceptor.java b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/LoggingInterceptor.java
index 17ce390d8a..c699d9d9dc 100644
--- a/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/LoggingInterceptor.java
+++ b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/LoggingInterceptor.java
@@ -14,16 +14,18 @@ import org.springframework.http.client.ClientHttpResponse;
public class LoggingInterceptor implements ClientHttpRequestInterceptor {
- final static Logger log = LoggerFactory.getLogger(LoggingInterceptor.class);
+ final static Logger LOGGER = LoggerFactory.getLogger(LoggingInterceptor.class);
@Override
public ClientHttpResponse intercept(HttpRequest req, byte[] reqBody, ClientHttpRequestExecution ex) throws IOException {
- log.debug("Request body: {}", new String(reqBody, StandardCharsets.UTF_8));
+ LOGGER.debug("Request body: {}", new String(reqBody, StandardCharsets.UTF_8));
ClientHttpResponse response = ex.execute(req, reqBody);
- InputStreamReader isr = new InputStreamReader(response.getBody(), StandardCharsets.UTF_8);
- String body = new BufferedReader(isr).lines()
- .collect(Collectors.joining("\n"));
- log.debug("Response body: {}", body);
+ if (LOGGER.isDebugEnabled()) {
+ InputStreamReader isr = new InputStreamReader(response.getBody(), StandardCharsets.UTF_8);
+ String body = new BufferedReader(isr).lines()
+ .collect(Collectors.joining("\n"));
+ LOGGER.debug("Response body: {}", body);
+ }
return response;
}
}
diff --git a/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/RestTemplateLoggingLiveTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/RestTemplateLoggingLiveTest.java
index 99d0201eff..86ffa574a0 100644
--- a/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/RestTemplateLoggingLiveTest.java
+++ b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/RestTemplateLoggingLiveTest.java
@@ -1,18 +1,21 @@
package com.baeldung.resttemplate.logging;
-import static org.hamcrest.CoreMatchers.equalTo;
-
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.CollectionUtils;
import org.springframework.web.client.RestTemplate;
@@ -22,6 +25,7 @@ import org.springframework.web.client.RestTemplate;
public class RestTemplateLoggingLiveTest {
private static final String baseUrl = "http://localhost:8080/spring-rest";
+ private static final Logger LOGGER = LoggerFactory.getLogger(RestTemplateLoggingLiveTest.class);
@Test
public void givenHttpClientConfiguration_whenSendGetForRequestEntity_thenRequestResponseFullLog() {
@@ -30,13 +34,22 @@ public class RestTemplateLoggingLiveTest {
restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory());
final ResponseEntity response = restTemplate.postForEntity(baseUrl + "/persons", "my request body", String.class);
- assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
+ assertEquals(HttpStatus.OK, response.getStatusCode());
+ assertEquals("[\"Lucie\",\"Jackie\",\"Danesh\",\"Tao\"]", response.getBody());
}
@Test
public void givenLoggingInterceptorConfiguration_whenSendGetForRequestEntity_thenRequestResponseCustomLog() {
- RestTemplate restTemplate = new RestTemplate();
+ RestTemplate restTemplate = null;
+ if (LOGGER.isDebugEnabled()) {
+ ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(
+ new SimpleClientHttpRequestFactory());
+ restTemplate = new RestTemplate(factory);
+ } else {
+ restTemplate = new RestTemplate();
+ }
+
List interceptors = restTemplate.getInterceptors();
if (CollectionUtils.isEmpty(interceptors)) {
interceptors = new ArrayList<>();
@@ -45,6 +58,7 @@ public class RestTemplateLoggingLiveTest {
restTemplate.setInterceptors(interceptors);
final ResponseEntity response = restTemplate.postForEntity(baseUrl + "/persons", "my request body", String.class);
- assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
+ assertEquals(HttpStatus.OK, response.getStatusCode());
+ assertEquals("[\"Lucie\",\"Jackie\",\"Danesh\",\"Tao\"]", response.getBody());
}
}
diff --git a/spring-resttemplate-2/src/test/resources/application.properties b/spring-resttemplate-2/src/test/resources/application.properties
index 7bc9e56041..286ea95a4f 100644
--- a/spring-resttemplate-2/src/test/resources/application.properties
+++ b/spring-resttemplate-2/src/test/resources/application.properties
@@ -1,5 +1,5 @@
logging.level.org.springframework.web.client.RestTemplate=DEBUG
-logging.level.com.baeldung.resttemplate.logging.LoggingInterceptor=DEBUG
+logging.level.com.baeldung.resttemplate.logging=DEBUG
logging.level.org.apache.http=DEBUG
logging.level.httpclient.wire=DEBUG
logging.pattern.console=%20logger{20} - %msg%n
diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml
index d5c0c0dd6e..0fc2b49fa7 100644
--- a/spring-security-modules/pom.xml
+++ b/spring-security-modules/pom.xml
@@ -28,6 +28,7 @@
spring-security-web-login
spring-security-web-persisted-remember-me
spring-security-web-sockets
+ spring-security-legacy-oidc
spring-security-oidc
spring-security-okta
spring-security-web-react
diff --git a/spring-security-modules/spring-security-legacy-oidc/README.md b/spring-security-modules/spring-security-legacy-oidc/README.md
new file mode 100644
index 0000000000..9d47b35b21
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/README.md
@@ -0,0 +1,23 @@
+## Spring Security OpenID
+
+This module contains articles about OpenID with Spring Security
+
+### Relevant articles
+
+- [Spring Security and OpenID Connect (Legacy)](https://www.baeldung.com/spring-security-openid-connect-legacy)
+
+### OpenID Connect with Spring Security
+
+### Run the Project
+
+```
+mvn spring-boot:run
+```
+
+### Obtain Google App - Client ID, Secret
+
+- We need to get client id and client secret by creating a new project at [Google Developer Console](https://console.developers.google.com/project/_/apiui/credential?pli=1)
+- We can follow these instructions to register our client application on their platform
+
+- Once we have the client id and secret, we have to make sure we add them to the application.properties file.
+
diff --git a/spring-security-modules/spring-security-legacy-oidc/pom.xml b/spring-security-modules/spring-security-legacy-oidc/pom.xml
new file mode 100644
index 0000000000..a4ead0f6e0
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/pom.xml
@@ -0,0 +1,58 @@
+
+
+ 4.0.0
+ spring-security-legacy-oidc
+ spring-security-legacy-oidc
+ war
+ Spring OpenID Connect sample project
+
+
+ com.baeldung
+ parent-boot-2
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-2
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+ org.springframework.security.oauth
+ spring-security-oauth2
+ ${spring-security-oauth2.version}
+
+
+
+ org.springframework.security
+ spring-security-jwt
+ ${spring-security-jwt.version}
+
+
+
+ com.auth0
+ jwks-rsa
+ ${jwks-rsa.version}
+
+
+
+
+ 2.2.1.RELEASE
+ 1.0.9.RELEASE
+ 0.3.0
+
+
+
diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/GoogleOpenIdConnectConfig.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/GoogleOpenIdConnectConfig.java
new file mode 100644
index 0000000000..a9fdcfb286
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/GoogleOpenIdConnectConfig.java
@@ -0,0 +1,51 @@
+package com.baeldung.openid.oidc;
+
+import java.util.Arrays;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.oauth2.client.OAuth2ClientContext;
+import org.springframework.security.oauth2.client.OAuth2RestTemplate;
+import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails;
+import org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeResourceDetails;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;
+
+@Configuration
+@EnableOAuth2Client
+public class GoogleOpenIdConnectConfig {
+ @Value("${google.clientId}")
+ private String clientId;
+
+ @Value("${google.clientSecret}")
+ private String clientSecret;
+
+ @Value("${google.accessTokenUri}")
+ private String accessTokenUri;
+
+ @Value("${google.userAuthorizationUri}")
+ private String userAuthorizationUri;
+
+ @Value("${google.redirectUri}")
+ private String redirectUri;
+
+ @Bean
+ public OAuth2ProtectedResourceDetails googleOpenId() {
+ final AuthorizationCodeResourceDetails details = new AuthorizationCodeResourceDetails();
+ details.setClientId(clientId);
+ details.setClientSecret(clientSecret);
+ details.setAccessTokenUri(accessTokenUri);
+ details.setUserAuthorizationUri(userAuthorizationUri);
+ details.setScope(Arrays.asList("openid", "email"));
+ details.setPreEstablishedRedirectUri(redirectUri);
+ details.setUseCurrentUri(false);
+ return details;
+ }
+
+ @Bean
+ public OAuth2RestTemplate googleOpenIdTemplate(final OAuth2ClientContext clientContext) {
+ final OAuth2RestTemplate template = new OAuth2RestTemplate(googleOpenId(), clientContext);
+ return template;
+ }
+
+}
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/HomeController.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/HomeController.java
new file mode 100644
index 0000000000..3d2e776eca
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/HomeController.java
@@ -0,0 +1,22 @@
+package com.baeldung.openid.oidc;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+public class HomeController {
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
+ @RequestMapping("/")
+ @ResponseBody
+ public final String home() {
+ final String username = SecurityContextHolder.getContext().getAuthentication().getName();
+ logger.info(username);
+ return "Welcome, " + username;
+ }
+
+}
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectFilter.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectFilter.java
new file mode 100644
index 0000000000..c0b08bc548
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectFilter.java
@@ -0,0 +1,103 @@
+package com.baeldung.openid.oidc;
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.interfaces.RSAPublicKey;
+import java.util.Date;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.jwt.Jwt;
+import org.springframework.security.jwt.JwtHelper;
+import org.springframework.security.jwt.crypto.sign.RsaVerifier;
+import org.springframework.security.oauth2.client.OAuth2RestOperations;
+import org.springframework.security.oauth2.client.OAuth2RestTemplate;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
+import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
+
+import com.auth0.jwk.Jwk;
+import com.auth0.jwk.JwkProvider;
+import com.auth0.jwk.UrlJwkProvider;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class OpenIdConnectFilter extends AbstractAuthenticationProcessingFilter {
+ @Value("${google.clientId}")
+ private String clientId;
+
+ @Value("${google.issuer}")
+ private String issuer;
+
+ @Value("${google.jwkUrl}")
+ private String jwkUrl;
+
+ public OAuth2RestOperations restTemplate;
+
+ public OpenIdConnectFilter(String defaultFilterProcessesUrl) {
+ super(defaultFilterProcessesUrl);
+ setAuthenticationManager(new NoopAuthenticationManager());
+ }
+
+ @Override
+ public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
+
+ OAuth2AccessToken accessToken;
+ try {
+ accessToken = restTemplate.getAccessToken();
+ } catch (final OAuth2Exception e) {
+ throw new BadCredentialsException("Could not obtain access token", e);
+ }
+ try {
+ final String idToken = accessToken.getAdditionalInformation().get("id_token").toString();
+ String kid = JwtHelper.headers(idToken)
+ .get("kid");
+ final Jwt tokenDecoded = JwtHelper.decodeAndVerify(idToken, verifier(kid));
+ final Map authInfo = new ObjectMapper().readValue(tokenDecoded.getClaims(), Map.class);
+ verifyClaims(authInfo);
+ final OpenIdConnectUserDetails user = new OpenIdConnectUserDetails(authInfo, accessToken);
+ return new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities());
+ } catch (final Exception e) {
+ throw new BadCredentialsException("Could not obtain user details from token", e);
+ }
+
+ }
+
+ public void verifyClaims(Map claims) {
+ int exp = (int) claims.get("exp");
+ Date expireDate = new Date(exp * 1000L);
+ Date now = new Date();
+ if (expireDate.before(now) || !claims.get("iss").equals(issuer) || !claims.get("aud").equals(clientId)) {
+ throw new RuntimeException("Invalid claims");
+ }
+ }
+
+
+ private RsaVerifier verifier(String kid) throws Exception {
+ JwkProvider provider = new UrlJwkProvider(new URL(jwkUrl));
+ Jwk jwk = provider.get(kid);
+ return new RsaVerifier((RSAPublicKey) jwk.getPublicKey());
+ }
+
+ public void setRestTemplate(OAuth2RestTemplate restTemplate2) {
+ restTemplate = restTemplate2;
+
+ }
+
+ private static class NoopAuthenticationManager implements AuthenticationManager {
+
+ @Override
+ public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+ throw new UnsupportedOperationException("No authentication should be done with this AuthenticationManager");
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectUserDetails.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectUserDetails.java
new file mode 100644
index 0000000000..4ff61bcad9
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectUserDetails.java
@@ -0,0 +1,81 @@
+package com.baeldung.openid.oidc;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+public class OpenIdConnectUserDetails implements UserDetails {
+
+ private static final long serialVersionUID = 1L;
+
+ private String userId;
+ private String username;
+ private OAuth2AccessToken token;
+
+ public OpenIdConnectUserDetails(Map userInfo, OAuth2AccessToken token) {
+ this.userId = userInfo.get("sub");
+ this.username = userInfo.get("email");
+ this.token = token;
+ }
+
+ @Override
+ public String getUsername() {
+ return username;
+ }
+
+ @Override
+ public Collection extends GrantedAuthority> getAuthorities() {
+ return Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"));
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public OAuth2AccessToken getToken() {
+ return token;
+ }
+
+ public void setToken(OAuth2AccessToken token) {
+ this.token = token;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ @Override
+ public String getPassword() {
+ return null;
+ }
+
+ @Override
+ public boolean isAccountNonExpired() {
+ return true;
+ }
+
+ @Override
+ public boolean isAccountNonLocked() {
+ return true;
+ }
+
+ @Override
+ public boolean isCredentialsNonExpired() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SecurityConfig.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SecurityConfig.java
new file mode 100644
index 0000000000..fc5397a35b
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SecurityConfig.java
@@ -0,0 +1,48 @@
+package com.baeldung.openid.oidc;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.oauth2.client.OAuth2RestTemplate;
+import org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter;
+import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
+import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+ @Autowired
+ private OAuth2RestTemplate restTemplate;
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ web.ignoring().antMatchers("/resources/**");
+ }
+
+ @Bean
+ public OpenIdConnectFilter myFilter() {
+ final OpenIdConnectFilter filter = new OpenIdConnectFilter("/google-login");
+ filter.setRestTemplate(restTemplate);
+ return filter;
+ }
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ // @formatter:off
+ http
+ .addFilterAfter(new OAuth2ClientContextFilter(), AbstractPreAuthenticatedProcessingFilter.class)
+ .addFilterAfter(myFilter(), OAuth2ClientContextFilter.class)
+ .httpBasic().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/google-login"))
+ .and()
+ .authorizeRequests()
+ // .antMatchers("/","/index*").permitAll()
+ .anyRequest().authenticated()
+ ;
+
+ // @formatter:on
+ }
+}
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SpringOpenidApplication.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SpringOpenidApplication.java
new file mode 100644
index 0000000000..ec686f746d
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SpringOpenidApplication.java
@@ -0,0 +1,14 @@
+package com.baeldung.openid.oidc;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+
+@SpringBootApplication
+public class SpringOpenidApplication extends SpringBootServletInitializer {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringOpenidApplication.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/resources/application.properties b/spring-security-modules/spring-security-legacy-oidc/src/main/resources/application.properties
new file mode 100644
index 0000000000..e9ae90dd10
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/src/main/resources/application.properties
@@ -0,0 +1,8 @@
+server.port=8081
+google.clientId=475873350264-g1opb20lf2fc60h0o84rrkn972krgkvo.apps.googleusercontent.com
+google.clientSecret=GiA1Agf_aSt-bhTrnXjre-5Z
+google.accessTokenUri=https://www.googleapis.com/oauth2/v3/token
+google.userAuthorizationUri=https://accounts.google.com/o/oauth2/auth
+google.redirectUri=http://localhost:8081/google-login
+google.issuer=accounts.google.com
+google.jwkUrl=https://www.googleapis.com/oauth2/v2/certs
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/resources/logback.xml b/spring-security-modules/spring-security-legacy-oidc/src/main/resources/logback.xml
new file mode 100644
index 0000000000..3b8d0b9964
--- /dev/null
+++ b/spring-security-modules/spring-security-legacy-oidc/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-kafka/src/test/java/com/baeldung/SpringContextLiveTest.java b/spring-security-modules/spring-security-legacy-oidc/src/test/java/com/baeldung/openid/oidc/SpringContextTest.java
similarity index 64%
rename from spring-kafka/src/test/java/com/baeldung/SpringContextLiveTest.java
rename to spring-security-modules/spring-security-legacy-oidc/src/test/java/com/baeldung/openid/oidc/SpringContextTest.java
index 60262df9d4..0a21c5e93f 100644
--- a/spring-kafka/src/test/java/com/baeldung/SpringContextLiveTest.java
+++ b/spring-security-modules/spring-security-legacy-oidc/src/test/java/com/baeldung/openid/oidc/SpringContextTest.java
@@ -1,17 +1,15 @@
-package com.baeldung;
+package com.baeldung.openid.oidc;
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.baeldung.spring.kafka.KafkaApplication;
-
@RunWith(SpringRunner.class)
-@SpringBootTest(classes = KafkaApplication.class)
-public class SpringContextLiveTest {
+@SpringBootTest(classes = SpringOpenidApplication.class)
+public class SpringContextTest {
@Test
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
}
-}
+}
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml
index 3537c01e46..20a43eaf04 100644
--- a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml
+++ b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml
@@ -8,7 +8,7 @@
com.baeldung
- spring-security-sso
+ spring-security-oauth2-sso
1.0.0-SNAPSHOT
diff --git a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml
index a67cc4af83..f17ca171a5 100644
--- a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml
+++ b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml
@@ -7,7 +7,7 @@
com.baeldung
- spring-security-sso
+ spring-security-oauth2-sso
1.0.0-SNAPSHOT
@@ -91,5 +91,9 @@
+
+
+ com.baeldung.intro.Application
+
\ No newline at end of file
diff --git a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml
index 0645ba3593..514dd0d0f7 100644
--- a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml
+++ b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml
@@ -8,7 +8,7 @@
com.baeldung
- spring-security-sso
+ spring-security-oauth2-sso
1.0.0-SNAPSHOT
diff --git a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml
index d34317a4b0..5076b1878b 100644
--- a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml
+++ b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml
@@ -8,7 +8,7 @@
com.baeldung
- spring-security-sso
+ spring-security-oauth2-sso
1.0.0-SNAPSHOT
diff --git a/spring-security-modules/spring-security-oidc/README.md b/spring-security-modules/spring-security-oidc/README.md
index ca6053f70f..6a45824fcb 100644
--- a/spring-security-modules/spring-security-oidc/README.md
+++ b/spring-security-modules/spring-security-oidc/README.md
@@ -4,8 +4,8 @@ This module contains articles about OpenID with Spring Security
### Relevant articles
-- [Spring Security and OpenID Connect](https://www.baeldung.com/spring-security-openid-connect)
- [Spring Security and OpenID Connect (Legacy)](https://www.baeldung.com/spring-security-openid-connect-legacy)
+- [Spring Security and OpenID Connect](https://www.baeldung.com/spring-security-openid-connect)
### OpenID Connect with Spring Security
diff --git a/spring-security-modules/spring-security-web-login/README.md b/spring-security-modules/spring-security-web-login/README.md
index 5d92a8e1b4..9521a430c2 100644
--- a/spring-security-modules/spring-security-web-login/README.md
+++ b/spring-security-modules/spring-security-web-login/README.md
@@ -8,7 +8,6 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
### Relevant Articles:
- [Spring Security Form Login](https://www.baeldung.com/spring-security-login)
- [Spring Security Logout](https://www.baeldung.com/spring-security-logout)
-- [Spring Security Expressions – hasRole Example](https://www.baeldung.com/spring-security-expressions-basic)
- [Spring HTTP/HTTPS Channel Security](https://www.baeldung.com/spring-channel-security-https)
- [Spring Security – Customize the 403 Forbidden/Access Denied Page](https://www.baeldung.com/spring-security-custom-access-denied-page)
- [Spring Security – Redirect to the Previous URL After Login](https://www.baeldung.com/spring-security-redirect-login)
diff --git a/spring-security-modules/spring-security-web-rest/README.md b/spring-security-modules/spring-security-web-rest/README.md
index c13668798d..fd1f86f6b8 100644
--- a/spring-security-modules/spring-security-web-rest/README.md
+++ b/spring-security-modules/spring-security-web-rest/README.md
@@ -14,5 +14,4 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
- [Spring Security Context Propagation with @Async](https://www.baeldung.com/spring-security-async-principal-propagation)
- [Servlet 3 Async Support with Spring MVC and Spring Security](https://www.baeldung.com/spring-mvc-async-security)
- [Intro to Spring Security Expressions](https://www.baeldung.com/spring-security-expressions)
-- [Spring Security Expressions - hasRole Example](https://www.baeldung.com/spring-security-expressions-basic)
- [Error Handling for REST with Spring](https://www.baeldung.com/exception-handling-for-rest-with-spring)
diff --git a/spring-security-modules/spring-security-web-sockets/README.md b/spring-security-modules/spring-security-web-sockets/README.md
index 14ef0c8b99..76717e2fe6 100644
--- a/spring-security-modules/spring-security-web-sockets/README.md
+++ b/spring-security-modules/spring-security-web-sockets/README.md
@@ -5,7 +5,7 @@ This module contains articles about WebSockets with Spring Security
### Relevant Articles:
- [Intro to Security and WebSockets](https://www.baeldung.com/spring-security-websockets)
-- [Spring WebSockets: Build an User Chat](https://www.baeldung.com/spring-websockets-send-message-to-user)
+- [Spring WebSockets: Send Messages to a Specific User](https://www.baeldung.com/spring-websockets-send-message-to-user)
- [REST vs WebSockets](https://www.baeldung.com/rest-vs-websockets)
### Running This Project:
diff --git a/spring-swagger-codegen/spring-openapi-generator-api-client/pom.xml b/spring-swagger-codegen/spring-openapi-generator-api-client/pom.xml
index 7c6de543ae..3074849e4c 100644
--- a/spring-swagger-codegen/spring-openapi-generator-api-client/pom.xml
+++ b/spring-swagger-codegen/spring-openapi-generator-api-client/pom.xml
@@ -90,7 +90,7 @@
com.fasterxml.jackson.core
jackson-databind
- ${jackson-databind-version}
+ ${jackson-version}
com.fasterxml.jackson.jaxrs
@@ -264,8 +264,8 @@
1.5.22
4.3.9.RELEASE
- 2.10.1
- 2.10.1
+ 2.11.1
+
0.2.1
2.9.10
1.0.0
diff --git a/testing-modules/junit-4/README.md b/testing-modules/junit-4/README.md
index 6cc3981ed4..cf20c8da91 100644
--- a/testing-modules/junit-4/README.md
+++ b/testing-modules/junit-4/README.md
@@ -5,3 +5,4 @@
- [Introduction to JUnitParams](http://www.baeldung.com/junit-params)
- [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java)
- [Introduction to Lambda Behave](https://www.baeldung.com/lambda-behave)
+- [Conditionally Run or Ignore Tests in JUnit 4](https://www.baeldung.com/junit-conditional-assume)
diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/extensions/testwatcher/TestResultLoggerExtension.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/extensions/testwatcher/TestResultLoggerExtension.java
index a92c44a85b..1cbebd8d48 100644
--- a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/extensions/testwatcher/TestResultLoggerExtension.java
+++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/extensions/testwatcher/TestResultLoggerExtension.java
@@ -46,7 +46,7 @@ public class TestResultLoggerExtension implements TestWatcher, AfterAllCallback
@Override
public void testFailed(ExtensionContext context, Throwable cause) {
- LOG.info("Test Aborted for test {}: ", context.getDisplayName());
+ LOG.info("Test Failed for test {}: ", context.getDisplayName());
testResultsStatus.add(TestResultStatus.FAILED);
}
diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md
index e62f2dd345..984b79c29d 100644
--- a/testing-modules/junit-5/README.md
+++ b/testing-modules/junit-5/README.md
@@ -7,3 +7,4 @@
- [Testing an Abstract Class With JUnit](https://www.baeldung.com/junit-test-abstract-class)
- [Guide to Dynamic Tests in JUnit 5](https://www.baeldung.com/junit5-dynamic-tests)
- [Determine the Execution Time of JUnit Tests](https://www.baeldung.com/junit-test-execution-time)
+- [@BeforeAll and @AfterAll in Non-Static Methods](https://www.baeldung.com/java-beforeall-afterall-non-static)
diff --git a/testing-modules/junit5-annotations/pom.xml b/testing-modules/junit5-annotations/pom.xml
index 9e51d0ab55..7ffc17c69b 100644
--- a/testing-modules/junit5-annotations/pom.xml
+++ b/testing-modules/junit5-annotations/pom.xml
@@ -55,8 +55,8 @@
- 5.6.2
- 1.6.0
+ 5.7.0
+ 1.7.0
2.8.2
3.11.1
diff --git a/testing-modules/load-testing-comparison/pom.xml b/testing-modules/load-testing-comparison/pom.xml
index 1143ecb9ac..4c237aeb75 100644
--- a/testing-modules/load-testing-comparison/pom.xml
+++ b/testing-modules/load-testing-comparison/pom.xml
@@ -37,7 +37,6 @@
com.fasterxml.jackson.core
jackson-databind
- ${jackson.version}
org.springframework.boot
@@ -55,11 +54,6 @@
com.h2database
h2
-
- org.projectlombok
- lombok
- compile
-
@@ -77,7 +71,6 @@
org.springframework.boot
spring-boot-maven-plugin
- 2.0.5.RELEASE
@@ -122,10 +115,10 @@
1.8
1.8
UTF-8
- 2.11.12
- 2.2.5
- 3.2.2
- 2.2.1
+ 2.12.12
+ 3.4.0
+ 4.4.0
+ 3.1.0
5.0
diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java
deleted file mode 100644
index 2ea2c06a41..0000000000
--- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.baeldung.loadtesting;
-
-import com.baeldung.loadtesting.model.Transaction;
-import com.baeldung.loadtesting.repository.TransactionRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-@RestController
-@Deprecated
-public class TransactionController {
-
- @Autowired
- private TransactionRepository transactionRepository;
-
- @PostMapping(path="/addTransaction")
- public @ResponseBody
- String saveTransactions(@RequestBody Transaction trnsctn){
- transactionRepository.save(trnsctn);
- return "Saved Transaction.";
- }
-
- @GetMapping(path="/findAll/{rewardId}")
- public @ResponseBody Iterable getTransactions(@RequestParam Integer id){
- return transactionRepository.findByCustomerRewardsId(id);
- }
-}
diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java
index 2c6742fbaf..4d92c93fcb 100644
--- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java
+++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java
@@ -4,11 +4,11 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-
-import lombok.Data;
+import javax.persistence.Index;
+import javax.persistence.Table;
@Entity
-@Data
+@Table(indexes = {@Index(columnList="customerId")})
public class CustomerRewardsAccount {
@Id
@@ -19,4 +19,18 @@ public class CustomerRewardsAccount {
public Integer getCustomerId(){
return this.customerId;
}
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public void setCustomerId(Integer customerId) {
+ this.customerId = customerId;
+ }
+
+
}
diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java
index 312f52f4ab..6e2fb39cc6 100644
--- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java
+++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java
@@ -1,16 +1,17 @@
package com.baeldung.loadtesting.model;
-import lombok.Data;
-
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
import java.util.Date;
import java.util.Calendar;
@Entity
-@Data
+@Table(indexes = {@Index(columnList="customerRewardsId")})
public class Transaction {
@Id
@@ -27,4 +28,34 @@ public class Transaction {
public void setTransactionDate(Date transactionDate){
this.transactionDate = transactionDate;
}
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getCustomerRewardsId() {
+ return customerRewardsId;
+ }
+
+ public void setCustomerRewardsId(Integer customerRewardsId) {
+ this.customerRewardsId = customerRewardsId;
+ }
+
+ public Integer getCustomerId() {
+ return customerId;
+ }
+
+ public void setCustomerId(Integer customerId) {
+ this.customerId = customerId;
+ }
+
+ public Date getTransactionDate() {
+ return transactionDate;
+ }
+
+
}
diff --git a/testing-modules/load-testing-comparison/src/main/resources/application.properties b/testing-modules/load-testing-comparison/src/main/resources/application.properties
new file mode 100644
index 0000000000..e2c8cb1879
--- /dev/null
+++ b/testing-modules/load-testing-comparison/src/main/resources/application.properties
@@ -0,0 +1,7 @@
+spring.h2.console.enabled=true
+spring.datasource.url=jdbc:h2:mem:testdb
+spring.datasource.driverClassName=org.h2.Driver
+spring.datasource.username=sa
+spring.datasource.password=
+spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
+
diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala
index f9b3837759..e8cc608e42 100644
--- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala
+++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala
@@ -7,46 +7,41 @@ import scala.concurrent.duration._
class RewardsScenario extends Simulation {
- def randCustId() = Random.nextInt(99)
+ def randCustId() = java.util.concurrent.ThreadLocalRandom.current().nextInt()
val httpProtocol = http.baseUrl("http://localhost:8080")
- .acceptHeader("text/html,application/json;q=0.9,*/*;q=0.8")
- .doNotTrackHeader("1")
- .acceptLanguageHeader("en-US,en;q=0.5")
- .acceptEncodingHeader("gzip, deflate")
- .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0")
val scn = scenario("RewardsScenario")
- .repeat(10){
+ .repeat(1000){
+
exec(http("transactions_add")
.post("/transactions/add/")
- .body(StringBody("""{ "customerRewardsId":null,"customerId":""""+ randCustId() + """","transactionDate":null }""")).asJson
+ .body(StringBody(_ => s"""{"customerRewardsId":null,"customerId":${randCustId()},"transactionDate":null}""")).asJson
.check(jsonPath("$.id").saveAs("txnId"))
.check(jsonPath("$.transactionDate").saveAs("txtDate"))
.check(jsonPath("$.customerId").saveAs("custId")))
- .pause(1)
.exec(http("get_reward")
.get("/rewards/find/${custId}")
- .check(jsonPath("$.id").saveAs("rwdId")))
- .pause(1)
+ .check(jsonPath("$.id").optional.saveAs("rwdId")))
.doIf("${rwdId.isUndefined()}"){
exec(http("rewards_add")
.post("/rewards/add")
- .body(StringBody("""{ "customerId": "${custId}" }""")).asJson
+ .body(StringBody("""{"customerId":${custId}}""")).asJson
.check(jsonPath("$.id").saveAs("rwdId")))
}
- .exec(http("transactions_add")
+ .exec(http("transactions_update")
.post("/transactions/add/")
- .body(StringBody("""{ "customerRewardsId":"${rwdId}","customerId":"${custId}","transactionDate":"${txtDate}" }""")).asJson)
- .pause(1)
+ .body(StringBody("""{"customerRewardsId":${rwdId},"customerId":${custId},"transactionDate":"${txtDate}" }""")).asJson)
- .exec(http("get_reward")
+ .exec(http("get_transactions")
.get("/transactions/findAll/${rwdId}"))
+
+ .exec(_.removeAll("txnId", "txtDate", "custId", "rwdId"))
}
setUp(
scn.inject(atOnceUsers(100))
).protocols(httpProtocol)
-}
\ No newline at end of file
+}
diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx
index 97640dfac7..cbb036b77b 100644
--- a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx
+++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx
@@ -16,7 +16,7 @@
continue
false
- 10
+ 1000
100
0
@@ -200,7 +200,7 @@
- 10000
+ 9223372036854775806
1
false
diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties
index 68adf90856..ca5969cb7a 100644
--- a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties
+++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties
@@ -1,5 +1,5 @@
grinder.script = grinder.py
grinder.threads = 100
grinder.processes = 1
-grinder.runs = 10
+grinder.runs = 1000
grinder.logDirectory = /logs
diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py
index 025f90d38b..a71f101b41 100644
--- a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py
+++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py
@@ -24,6 +24,7 @@ random=java.util.Random()
class TestRunner:
def __call__(self):
+
customerId = str(random.nextInt());
result = request1.POST("http://localhost:8080/transactions/add", "{"'"customerRewardsId"'":null,"'"customerId"'":"+ customerId + ","'"transactionDate"'":null}")
@@ -37,4 +38,5 @@ class TestRunner:
rwdId = parseJsonString(result.getText(), "id")
result = request1.POST("http://localhost:8080/transactions/add", "{"'"id"'":" + txnId + ","'"customerRewardsId"'":" + rwdId + ","'"customerId"'":"+ customerId + ","'"transactionDate"'":null}")
- result = request1.GET("http://localhost:8080/transactions/findAll/" + rwdId)
\ No newline at end of file
+ result = request1.GET("http://localhost:8080/transactions/findAll/" + rwdId)
+
diff --git a/testing-modules/mockito-2/pom.xml b/testing-modules/mockito-2/pom.xml
index 340af89c82..055debe615 100644
--- a/testing-modules/mockito-2/pom.xml
+++ b/testing-modules/mockito-2/pom.xml
@@ -30,7 +30,6 @@
2.21.0
- 2.10.3
diff --git a/testing-modules/rest-testing/pom.xml b/testing-modules/rest-testing/pom.xml
index 1e8a27afa5..b3966c1b6a 100644
--- a/testing-modules/rest-testing/pom.xml
+++ b/testing-modules/rest-testing/pom.xml
@@ -65,13 +65,13 @@
- info.cukes
+ io.cucumber
cucumber-java
${cucumber.version}
test
- info.cukes
+ io.cucumber
cucumber-junit
${cucumber.version}
@@ -105,56 +105,44 @@
true
-
-
-
- maven-failsafe-plugin
- ${maven-failsafe-plugin.version}
-
- classes
- 4
-
-
-
-
- integration-test
- verify
-
-
-
-
-
- com.github.temyers
- cucumber-jvm-parallel-plugin
- 5.0.0
-
-
- generateRunners
- generate-test-sources
-
- generateRunners
-
-
-
- com.baeldung.rest.cucumber
-
- src/test/resources/Feature/
- SCENARIO
-
-
-
-
-
-
+
+
+ parallel
+
+
+
+ maven-failsafe-plugin
+ ${maven-failsafe-plugin.version}
+
+
+ CucumberIntegrationTest.java
+
+ methods
+ 2
+
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+
+
+
+
19.0
2.9.0
- 1.2.5
+ 6.8.0
2.21.0
0.6.1
diff --git a/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature b/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature
deleted file mode 100644
index 99dd8249fe..0000000000
--- a/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature
+++ /dev/null
@@ -1,10 +0,0 @@
-Feature: Testing a REST API
- Users should be able to submit GET and POST requests to a web service, represented by WireMock
-
- Scenario: Data Upload to a web service
- When users upload data on a project
- Then the server should handle it and return a success status
-
- Scenario: Data retrieval from a web service
- When users want to get information on the Cucumber project
- Then the requested data is returned
\ No newline at end of file
diff --git a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java
index f80178a43d..33e2c62301 100644
--- a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java
+++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java
@@ -1,8 +1,8 @@
package com.baeldung.rest.cucumber;
+import io.cucumber.junit.Cucumber;
+import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
-import cucumber.api.CucumberOptions;
-import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "classpath:Feature")
diff --git a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java
index 35a913ae25..f1fcb48f01 100644
--- a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java
+++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java
@@ -20,6 +20,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
@@ -29,8 +31,6 @@ import org.apache.http.impl.client.HttpClients;
import com.github.tomakehurst.wiremock.WireMockServer;
-import cucumber.api.java.en.Then;
-import cucumber.api.java.en.When;
public class StepDefinition {
@@ -66,7 +66,8 @@ public class StepDefinition {
wireMockServer.stop();
}
- @When("^users want to get information on the (.+) project$")
+// @When("^users want to get information on the '(.+)' project$")
+ @When("users want to get information on the {string} project")
public void usersGetInformationOnAProject(String projectName) throws IOException {
wireMockServer.start();
@@ -86,11 +87,11 @@ public class StepDefinition {
wireMockServer.stop();
}
- @Then("^the server should handle it and return a success status$")
+ @Then("the server should handle it and return a success status")
public void theServerShouldReturnASuccessStatus() {
}
- @Then("^the requested data is returned$")
+ @Then("the requested data is returned")
public void theRequestedDataIsReturned() {
}
diff --git a/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature b/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature
index 99dd8249fe..f8bbd809de 100644
--- a/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature
+++ b/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature
@@ -6,5 +6,5 @@ Feature: Testing a REST API
Then the server should handle it and return a success status
Scenario: Data retrieval from a web service
- When users want to get information on the Cucumber project
+ When users want to get information on the 'Cucumber' project
Then the requested data is returned
\ No newline at end of file
diff --git a/vavr/src/test/java/com/baeldung/vavr/VavrUnitTest.java b/vavr/src/test/java/com/baeldung/vavr/VavrUnitTest.java
index 7beb75632e..b1a9405605 100644
--- a/vavr/src/test/java/com/baeldung/vavr/VavrUnitTest.java
+++ b/vavr/src/test/java/com/baeldung/vavr/VavrUnitTest.java
@@ -93,6 +93,37 @@ public class VavrUnitTest {
assertEquals("JavaVavr 4", transformed);
}
+ @Test
+ public void editTupleValueForNewTupleInstance(){
+ final Tuple2 java9 = Tuple.of("Java", 8);
+ final Tuple2 transformed = java9.update2(9);
+ int num = transformed._2();
+ assertEquals(9,num);
+ }
+
+ @Test
+ public void editTupleValueForSameInstance(){
+ Tuple2 java9 = Tuple.of("Java", 8);
+ java9 = java9.update2(9);
+ final int num = java9._2();
+ assertEquals(9,num);
+ }
+
+ @Test
+ public void getNumberOfElementTuple(){
+ Tuple2 java8 = Tuple.of("Java", 8);
+ Tuple3 java8Triple = Tuple.of("Java", 8, 1.8);
+ Tuple3 java8TripleWnull = Tuple.of("Java", null, 1.8);
+
+ int num = java8.arity();
+ int numTriple = java8Triple.arity();
+ int numTripleWnull = java8TripleWnull.arity();
+ assertEquals(2,num);
+ assertEquals(3,numTriple);
+ assertEquals(3,numTripleWnull);
+ }
+
+
/*
* Functions
*/