diff --git a/.gitignore b/.gitignore index 349efbcb67..9c100eaded 100644 --- a/.gitignore +++ b/.gitignore @@ -39,7 +39,6 @@ target/ spring-openid/src/main/resources/application.properties .recommenders/ /spring-hibernate4/nbproject/ -spring-security-openid/src/main/resources/application.properties spring-all/*.log diff --git a/README.md b/README.md index 4cad075cc3..5307efa008 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +**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-miscellaneous-3/README.md b/algorithms-miscellaneous-3/README.md index 23a10258a3..00b785c1b2 100644 --- a/algorithms-miscellaneous-3/README.md +++ b/algorithms-miscellaneous-3/README.md @@ -15,5 +15,4 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [Creating a Triangle with for Loops in Java](https://www.baeldung.com/java-print-triangle) - [Efficient Word Frequency Calculator in Java](https://www.baeldung.com/java-word-frequency) - [The K-Means Clustering Algorithm in Java](https://www.baeldung.com/java-k-means-clustering-algorithm) -- [Creating a Custom Annotation in Java](https://www.baeldung.com/java-custom-annotation) - More articles: [[<-- prev]](/algorithms-miscellaneous-2) [[next -->]](/algorithms-miscellaneous-4) diff --git a/algorithms-miscellaneous-5/README.md b/algorithms-miscellaneous-5/README.md index 27ab303210..3c49b5f01c 100644 --- a/algorithms-miscellaneous-5/README.md +++ b/algorithms-miscellaneous-5/README.md @@ -10,4 +10,6 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [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) +- [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher) +- [Overview of Combinatorial Problems in Java](https://www.baeldung.com/java-combinatorial-algorithms) - More articles: [[<-- prev]](/../algorithms-miscellaneous-4) diff --git a/algorithms-miscellaneous-5/pom.xml b/algorithms-miscellaneous-5/pom.xml index 2f530958e3..95036da775 100644 --- a/algorithms-miscellaneous-5/pom.xml +++ b/algorithms-miscellaneous-5/pom.xml @@ -34,6 +34,11 @@ tradukisto ${tradukisto.version} + + com.google.guava + guava + 28.1-jre + org.assertj diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/Follower.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/Follower.java new file mode 100644 index 0000000000..e142f10eb4 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/Follower.java @@ -0,0 +1,20 @@ +package com.baeldung.algorithms.greedy; + +import lombok.Getter; + +public class Follower { + + @Getter String username; + @Getter long count; + + public Follower(String username, long count) { + super(); + this.username = username; + this.count = count; + } + + @Override + public String toString() { + return "User: " + username + ", Followers: " + count + "\n\r" ; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/FollowersPath.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/FollowersPath.java new file mode 100644 index 0000000000..2319c14af8 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/FollowersPath.java @@ -0,0 +1,44 @@ +package com.baeldung.algorithms.greedy; + +import java.util.ArrayList; +import java.util.List; + +public class FollowersPath { + + private List accounts; + private long count; + + public FollowersPath() { + super(); + this.accounts = new ArrayList<>(); + } + + public List getAccounts() { + return accounts; + } + public long getCount() { + return count; + } + + public void addFollower(String username, long count) { + accounts.add(new Follower(username, count)); + } + + public void addCount(long count) { + this.count += count; + } + + @Override + public String toString() { + String details = ""; + for(Follower a : accounts) { + details+=a.toString() + ", "; + } + + return "Total: " + count + ", \n\r" + + " Details: { " + "\n\r" + + details + "\n\r" + + " }"; + } + +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/GreedyAlgorithm.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/GreedyAlgorithm.java new file mode 100644 index 0000000000..51f0e3fa6a --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/GreedyAlgorithm.java @@ -0,0 +1,43 @@ +package com.baeldung.algorithms.greedy; + +import java.util.List; + +public class GreedyAlgorithm { + + int currentLevel = 0; + final int maxLevel = 3; + SocialConnector sc; + FollowersPath fp; + + public GreedyAlgorithm(SocialConnector sc) { + super(); + this.sc = sc; + this.fp = new FollowersPath(); + } + + public long findMostFollowersPath(String account) { + long max = 0; + SocialUser toFollow = null; + + List followers = sc.getFollowers(account); + for (SocialUser el : followers) { + long followersCount = el.getFollowersCount(); + if (followersCount > max) { + toFollow = el; + max = followersCount; + } + } + + if (currentLevel < maxLevel - 1) { + currentLevel++; + max += findMostFollowersPath(toFollow.getUsername()); + return max; + } else { + return max; + } + } + + public FollowersPath getFollowers() { + return fp; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/NonGreedyAlgorithm.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/NonGreedyAlgorithm.java new file mode 100644 index 0000000000..af274a385e --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/NonGreedyAlgorithm.java @@ -0,0 +1,43 @@ +package com.baeldung.algorithms.greedy; + +import java.util.List; + +public class NonGreedyAlgorithm { + + int currentLevel = 0; + final int maxLevel = 3; + SocialConnector tc; + + public NonGreedyAlgorithm(SocialConnector tc, int level) { + super(); + this.tc = tc; + this.currentLevel = level; + } + + public long findMostFollowersPath(String account) { + List followers = tc.getFollowers(account); + long total = currentLevel > 0 ? followers.size() : 0; + + if (currentLevel < maxLevel ) { + currentLevel++; + + long[] count = new long[followers.size()]; + int i = 0; + for (SocialUser el : followers) { + NonGreedyAlgorithm sub = new NonGreedyAlgorithm(tc, currentLevel); + count[i] = sub.findMostFollowersPath(el.getUsername()); + i++; + } + + long max = 0; + for (; i > 0; i--) { + if (count[i-1] > max ) + max = count[i-1]; + } + + return total + max; + } + + return total; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/SocialConnector.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/SocialConnector.java new file mode 100644 index 0000000000..508e18c105 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/SocialConnector.java @@ -0,0 +1,36 @@ +package com.baeldung.algorithms.greedy; + +import java.util.ArrayList; +import java.util.List; + +import lombok.Getter; +import lombok.Setter; + +public class SocialConnector { + private boolean isCounterEnabled = true; + private int counter = 4; + @Getter @Setter List users; + + public SocialConnector() { + users = new ArrayList<>(); + } + + public boolean switchCounter() { + this.isCounterEnabled = !this.isCounterEnabled; + return this.isCounterEnabled; + } + + public List getFollowers(String account) { + if (counter < 0) + throw new IllegalStateException ("API limit reached"); + else { + if(this.isCounterEnabled) counter--; + for(SocialUser user : users) { + if (user.getUsername().equals(account)) { + return user.getFollowers(); + } + } + } + return new ArrayList<>(); + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/SocialUser.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/SocialUser.java new file mode 100644 index 0000000000..bc8679da79 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/greedy/SocialUser.java @@ -0,0 +1,38 @@ +package com.baeldung.algorithms.greedy; + +import java.util.ArrayList; +import java.util.List; + +import lombok.Getter; + +public class SocialUser { + + @Getter private String username; + @Getter private List followers; + + public SocialUser(String username) { + super(); + this.username = username; + this.followers = new ArrayList<>(); + } + + public SocialUser(String username, List followers) { + super(); + this.username = username; + this.followers = followers; + } + + public long getFollowersCount() { + return followers.size(); + } + + public void addFollowers(List followers) { + this.followers.addAll(followers); + } + + @Override + public boolean equals(Object obj) { + return ((SocialUser) obj).getUsername().equals(username); + } + +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStream.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStream.java new file mode 100644 index 0000000000..9d3b699956 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStream.java @@ -0,0 +1,42 @@ +package com.baeldung.algorithms.integerstreammedian; + +import java.util.PriorityQueue; +import java.util.Queue; + +import static java.util.Comparator.reverseOrder; + +public class MedianOfIntegerStream { + + private Queue minHeap, maxHeap; + + MedianOfIntegerStream() { + minHeap = new PriorityQueue<>(); + maxHeap = new PriorityQueue<>(reverseOrder()); + } + + void add(int num) { + if (!minHeap.isEmpty() && num < minHeap.peek()) { + maxHeap.offer(num); + if (maxHeap.size() > minHeap.size() + 1) { + minHeap.offer(maxHeap.poll()); + } + } else { + minHeap.offer(num); + if (minHeap.size() > maxHeap.size() + 1) { + maxHeap.offer(minHeap.poll()); + } + } + } + + double getMedian() { + int median; + if (minHeap.size() < maxHeap.size()) { + median = maxHeap.peek(); + } else if (minHeap.size() > maxHeap.size()) { + median = minHeap.peek(); + } else { + median = (minHeap.peek() + maxHeap.peek()) / 2; + } + return median; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStream2.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStream2.java new file mode 100644 index 0000000000..8aa7e6f6af --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStream2.java @@ -0,0 +1,36 @@ +package com.baeldung.algorithms.integerstreammedian; + +import java.util.PriorityQueue; +import java.util.Queue; + +import static java.util.Comparator.reverseOrder; + +public class MedianOfIntegerStream2 { + + private Queue minHeap, maxHeap; + + MedianOfIntegerStream2() { + minHeap = new PriorityQueue<>(); + maxHeap = new PriorityQueue<>(reverseOrder()); + } + + void add(int num) { + if (minHeap.size() == maxHeap.size()) { + maxHeap.offer(num); + minHeap.offer(maxHeap.poll()); + } else { + minHeap.offer(num); + maxHeap.offer(minHeap.poll()); + } + } + + double getMedian() { + int median; + if (minHeap.size() > maxHeap.size()) { + median = minHeap.peek(); + } else { + median = (minHeap.peek() + maxHeap.peek()) / 2; + } + return median; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/CycleDetector.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/CycleDetector.java new file mode 100644 index 0000000000..dec0bcdd85 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/CycleDetector.java @@ -0,0 +1,72 @@ +package com.baeldung.algorithms.kruskal; + +import java.util.ArrayList; +import java.util.List; + +public class CycleDetector { + + List nodes; + + public CycleDetector(int totalNodes) { + initDisjointSets(totalNodes); + } + + public boolean detectCycle(Integer u, Integer v) { + Integer rootU = pathCompressionFind(u); + Integer rootV = pathCompressionFind(v); + if (rootU.equals(rootV)) { + return true; + } + unionByRank(rootU, rootV); + return false; + } + + private void initDisjointSets(int totalNodes) { + nodes = new ArrayList<>(totalNodes); + for (int i = 0; i < totalNodes; i++) { + nodes.add(new DisjointSetInfo(i)); + } + } + + private Integer find(Integer node) { + Integer parent = nodes.get(node).getParentNode(); + if (parent.equals(node)) { + return node; + } else { + return find(parent); + } + } + + private Integer pathCompressionFind(Integer node) { + DisjointSetInfo setInfo = nodes.get(node); + Integer parent = setInfo.getParentNode(); + if (parent.equals(node)) { + return node; + } else { + Integer parentNode = find(parent); + setInfo.setParentNode(parentNode); + return parentNode; + } + } + + private void union(Integer rootU, Integer rootV) { + DisjointSetInfo setInfoU = nodes.get(rootU); + setInfoU.setParentNode(rootV); + } + + private void unionByRank(int rootU, int rootV) { + DisjointSetInfo setInfoU = nodes.get(rootU); + DisjointSetInfo setInfoV = nodes.get(rootV); + int rankU = setInfoU.getRank(); + int rankV = setInfoV.getRank(); + if (rankU < rankV) { + setInfoU.setParentNode(rootV); + } else { + setInfoV.setParentNode(rootU); + if (rankU == rankV) { + setInfoU.setRank(rankU + 1); + } + } + } + +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/DisjointSetInfo.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/DisjointSetInfo.java new file mode 100644 index 0000000000..ecdc42587a --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/DisjointSetInfo.java @@ -0,0 +1,28 @@ +package com.baeldung.algorithms.kruskal; + +public class DisjointSetInfo { + + private Integer parentNode; + private int rank; + + DisjointSetInfo(Integer nodeNumber) { + setParentNode(nodeNumber); + setRank(1); + } + + public Integer getParentNode() { + return parentNode; + } + + public void setParentNode(Integer parentNode) { + this.parentNode = parentNode; + } + + public int getRank() { + return rank; + } + + public void setRank(int rank) { + this.rank = rank; + } +} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/Kruskal.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/Kruskal.java new file mode 100644 index 0000000000..da405679d1 --- /dev/null +++ b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/kruskal/Kruskal.java @@ -0,0 +1,53 @@ +package com.baeldung.algorithms.kruskal; + +import com.google.common.graph.EndpointPair; +import com.google.common.graph.MutableValueGraph; +import com.google.common.graph.ValueGraph; +import com.google.common.graph.ValueGraphBuilder; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Set; + +public class Kruskal { + + public ValueGraph minSpanningTree(ValueGraph graph) { + + return spanningTree(graph, true); + } + + public ValueGraph maxSpanningTree(ValueGraph graph) { + return spanningTree(graph, false); + } + + private ValueGraph spanningTree(ValueGraph graph, boolean minSpanningTree) { + Set> edges = graph.edges(); + List> edgeList = new ArrayList<>(edges); + + if (minSpanningTree) { + edgeList.sort(Comparator.comparing(e -> graph.edgeValue(e).get())); + } else { + edgeList.sort(Collections.reverseOrder(Comparator.comparing(e -> graph.edgeValue(e).get()))); + } + + int totalNodes = graph.nodes().size(); + CycleDetector cycleDetector = new CycleDetector(totalNodes); + int edgeCount = 0; + + MutableValueGraph spanningTree = ValueGraphBuilder.undirected().build(); + for (EndpointPair edge : edgeList) { + if (cycleDetector.detectCycle(edge.nodeU(), edge.nodeV())) { + continue; + } + spanningTree.putEdgeValue(edge.nodeU(), edge.nodeV(), graph.edgeValue(edge).get()); + edgeCount++; + if (edgeCount == totalNodes - 1) { + break; + } + } + return spanningTree; + } + +} diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/greedy/GreedyAlgorithmUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/greedy/GreedyAlgorithmUnitTest.java new file mode 100644 index 0000000000..a503b006de --- /dev/null +++ b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/greedy/GreedyAlgorithmUnitTest.java @@ -0,0 +1,58 @@ +package com.baeldung.algorithms.greedy; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class GreedyAlgorithmUnitTest { + + private SocialConnector prepareNetwork() { + SocialConnector sc = new SocialConnector(); + SocialUser root = new SocialUser("root"); + SocialUser child1 = new SocialUser("child1"); + SocialUser child2 = new SocialUser("child2"); + SocialUser child3 = new SocialUser("child3"); + SocialUser child21 = new SocialUser("child21"); + SocialUser child211 = new SocialUser("child211"); + SocialUser child2111 = new SocialUser("child2111"); + SocialUser child31 = new SocialUser("child31"); + SocialUser child311 = new SocialUser("child311"); + SocialUser child3111 = new SocialUser("child3111"); + child211.addFollowers(Arrays.asList(new SocialUser[]{child2111})); + child311.addFollowers(Arrays.asList(new SocialUser[]{child3111})); + child21.addFollowers(Arrays.asList(new SocialUser[]{child211})); + child31.addFollowers(Arrays.asList(new SocialUser[]{child311, + new SocialUser("child312"), new SocialUser("child313"), new SocialUser("child314")})); + child1.addFollowers(Arrays.asList(new SocialUser[]{new SocialUser("child11"), new SocialUser("child12")})); + child2.addFollowers(Arrays.asList(new SocialUser[]{child21, new SocialUser("child22"), new SocialUser("child23")})); + child3.addFollowers(Arrays.asList(new SocialUser[]{child31})); + root.addFollowers(Arrays.asList(new SocialUser[]{child1, child2, child3})); + sc.setUsers(Arrays.asList(new SocialUser[]{root, child1, child2, child3, child21, child31, child311, child211})); + return sc; + } + + @Test + public void greedyAlgorithmTest() { + GreedyAlgorithm ga = new GreedyAlgorithm(prepareNetwork()); + assertEquals(ga.findMostFollowersPath("root"), 5); + } + + @Test + public void nongreedyAlgorithmTest() { + NonGreedyAlgorithm nga = new NonGreedyAlgorithm(prepareNetwork(), 0); + Assertions.assertThrows(IllegalStateException.class, () -> { + nga.findMostFollowersPath("root"); + }); + } + + @Test + public void nongreedyAlgorithmUnboundedTest() { + SocialConnector sc = prepareNetwork(); + sc.switchCounter(); + NonGreedyAlgorithm nga = new NonGreedyAlgorithm(sc, 0); + assertEquals(nga.findMostFollowersPath("root"), 6); + } +} \ No newline at end of file diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStreamUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStreamUnitTest.java new file mode 100644 index 0000000000..bcea4ebba8 --- /dev/null +++ b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/integerstreammedian/MedianOfIntegerStreamUnitTest.java @@ -0,0 +1,41 @@ +package com.baeldung.algorithms.integerstreammedian; + +import org.junit.Test; + +import java.util.LinkedHashMap; +import java.util.Map; + +import static org.junit.Assert.assertEquals; + +public class MedianOfIntegerStreamUnitTest { + + @Test + public void givenStreamOfIntegers_whenAnElementIsRead_thenMedianChangesWithApproach1() { + MedianOfIntegerStream mis = new MedianOfIntegerStream(); + for (Map.Entry e : testcaseFixture().entrySet()) { + mis.add(e.getKey()); + assertEquals(e.getValue(), (Double) mis.getMedian()); + } + } + + @Test + public void givenStreamOfIntegers_whenAnElementIsRead_thenMedianChangesWithApproach2() { + MedianOfIntegerStream2 mis = new MedianOfIntegerStream2(); + for (Map.Entry e : testcaseFixture().entrySet()) { + mis.add(e.getKey()); + assertEquals(e.getValue(), (Double) mis.getMedian()); + } + } + + private Map testcaseFixture() { + return new LinkedHashMap() {{ + put(1, 1d); + put(7, 4d); + put(5, 5d); + put(8, 6d); + put(3, 5d); + put(9, 6d); + put(4, 5d); + }}; + } +} diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/kruskal/KruskalUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/kruskal/KruskalUnitTest.java new file mode 100644 index 0000000000..a7206c6cd0 --- /dev/null +++ b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/kruskal/KruskalUnitTest.java @@ -0,0 +1,67 @@ +package com.baeldung.algorithms.kruskal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import com.google.common.graph.MutableValueGraph; +import com.google.common.graph.ValueGraph; +import com.google.common.graph.ValueGraphBuilder; +import com.baeldung.algorithms.kruskal.Kruskal; + +public class KruskalUnitTest { + + private MutableValueGraph graph; + + @Before + public void setup() { + graph = ValueGraphBuilder.undirected().build(); + graph.putEdgeValue(0, 1, 8.0); + graph.putEdgeValue(0, 2, 5.0); + graph.putEdgeValue(1, 2, 9.0); + graph.putEdgeValue(1, 3, 11.0); + graph.putEdgeValue(2, 3, 15.0); + graph.putEdgeValue(2, 4, 10.0); + graph.putEdgeValue(3, 4, 7.0); + } + + @Test + public void givenGraph_whenMinimumSpanningTree_thenOutputCorrectResult() { + final Kruskal kruskal = new Kruskal(); + ValueGraph spanningTree = kruskal.minSpanningTree(graph); + + assertTrue(spanningTree.hasEdgeConnecting(0, 1)); + assertTrue(spanningTree.hasEdgeConnecting(0, 2)); + assertTrue(spanningTree.hasEdgeConnecting(2, 4)); + assertTrue(spanningTree.hasEdgeConnecting(3, 4)); + assertEquals(graph.edgeValue(0, 1), spanningTree.edgeValue(0, 1)); + assertEquals(graph.edgeValue(0, 2), spanningTree.edgeValue(0, 2)); + assertEquals(graph.edgeValue(2, 4), spanningTree.edgeValue(2, 4)); + assertEquals(graph.edgeValue(3, 4), spanningTree.edgeValue(3, 4)); + + assertFalse(spanningTree.hasEdgeConnecting(1, 2)); + assertFalse(spanningTree.hasEdgeConnecting(1, 3)); + assertFalse(spanningTree.hasEdgeConnecting(2, 3)); + } + + @Test + public void givenGraph_whenMaximumSpanningTree_thenOutputCorrectResult() { + final Kruskal kruskal = new Kruskal(); + ValueGraph spanningTree = kruskal.maxSpanningTree(graph); + + assertTrue(spanningTree.hasEdgeConnecting(0, 1)); + assertTrue(spanningTree.hasEdgeConnecting(1, 3)); + assertTrue(spanningTree.hasEdgeConnecting(2, 3)); + assertTrue(spanningTree.hasEdgeConnecting(2, 4)); + assertEquals(graph.edgeValue(0, 1), spanningTree.edgeValue(0, 1)); + assertEquals(graph.edgeValue(1, 3), spanningTree.edgeValue(1, 3)); + assertEquals(graph.edgeValue(2, 3), spanningTree.edgeValue(2, 3)); + assertEquals(graph.edgeValue(2, 4), spanningTree.edgeValue(2, 4)); + + assertFalse(spanningTree.hasEdgeConnecting(0, 2)); + assertFalse(spanningTree.hasEdgeConnecting(1, 2)); + assertFalse(spanningTree.hasEdgeConnecting(3, 4)); + } +} diff --git a/algorithms-searching/README.md b/algorithms-searching/README.md index d86c3e3de8..9b85995235 100644 --- a/algorithms-searching/README.md +++ b/algorithms-searching/README.md @@ -9,3 +9,4 @@ This module contains articles about searching algorithms. - [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) +- [Range Search Algorithm in Java](https://www.baeldung.com/java-range-search) diff --git a/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/Point.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/Point.java new file mode 100644 index 0000000000..f61ee87f7d --- /dev/null +++ b/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/Point.java @@ -0,0 +1,24 @@ +package com.baeldung.algorithms.quadtree; + +public class Point { + private float x; + private float y; + + public Point(float x, float y) { + this.x = x; + this.y = y; + } + + public float getX() { + return x; + } + + public float getY() { + return y; + } + + @Override + public String toString() { + return "[" + x + " , " + y + "]"; + } +} diff --git a/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/QuadTree.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/QuadTree.java new file mode 100644 index 0000000000..bb3cf029b1 --- /dev/null +++ b/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/QuadTree.java @@ -0,0 +1,109 @@ +package com.baeldung.algorithms.quadtree; + +import java.util.ArrayList; +import java.util.List; + +public class QuadTree { + private static final int MAX_POINTS = 3; + private Region area; + private List points = new ArrayList<>(); + private List quadTrees = new ArrayList<>(); + private StringBuilder searchTraversePath; + + public QuadTree(Region area) { + this.area = area; + } + + public boolean addPoint(Point point) { + if (this.area.containsPoint(point)) { + if (this.points.size() < MAX_POINTS) { + this.points.add(point); + return true; + } else { + if (this.quadTrees.size() == 0) { + createQuadrants(); + } + return addPointToOneQuadrant(point); + } + } + return false; + } + + private boolean addPointToOneQuadrant(Point point) { + boolean isPointAdded; + for (int i = 0; i < 4; i++) { + isPointAdded = this.quadTrees.get(i) + .addPoint(point); + if (isPointAdded) + return true; + } + return false; + } + + private void createQuadrants() { + Region region; + for (int i = 0; i < 4; i++) { + region = this.area.getQuadrant(i); + quadTrees.add(new QuadTree(region)); + } + } + + public List search(Region searchRegion, List matches, String depthIndicator) { + searchTraversePath = new StringBuilder(); + if (matches == null) { + matches = new ArrayList(); + searchTraversePath.append(depthIndicator) + .append("Search Boundary =") + .append(searchRegion) + .append("\n"); + } + if (!this.area.doesOverlap(searchRegion)) { + return matches; + } else { + for (Point point : points) { + if (searchRegion.containsPoint(point)) { + searchTraversePath.append(depthIndicator) + .append("Found match " + point) + .append("\n"); + matches.add(point); + } + } + if (this.quadTrees.size() > 0) { + for (int i = 0; i < 4; i++) { + searchTraversePath.append(depthIndicator) + .append("Q") + .append(i) + .append("-->") + .append(quadTrees.get(i).area) + .append("\n"); + quadTrees.get(i) + .search(searchRegion, matches, depthIndicator + "\t"); + this.searchTraversePath.append(quadTrees.get(i) + .printSearchTraversePath()); + } + } + } + return matches; + } + + public String printTree(String depthIndicator) { + String str = ""; + if (depthIndicator == "") { + str += "Root-->" + area.toString() + "\n"; + } + + for (Point point : points) { + str += depthIndicator + point.toString() + "\n"; + } + for (int i = 0; i < quadTrees.size(); i++) { + str += depthIndicator + "Q" + String.valueOf(i) + "-->" + quadTrees.get(i).area.toString() + "\n"; + str += quadTrees.get(i) + .printTree(depthIndicator + "\t"); + } + return str; + } + + public String printSearchTraversePath() { + return searchTraversePath.toString(); + } +} diff --git a/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/Region.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/Region.java new file mode 100644 index 0000000000..600711c4ae --- /dev/null +++ b/algorithms-searching/src/main/java/com/baeldung/algorithms/quadtree/Region.java @@ -0,0 +1,85 @@ +package com.baeldung.algorithms.quadtree; + +public class Region { + private float x1; + private float y1; + private float x2; + private float y2; + + public Region(float x1, float y1, float x2, float y2) { + if (x1 >= x2 || y1 >= y2) + throw new IllegalArgumentException("(x1,y1) should be lesser than (x2,y2)"); + this.x1 = x1; + this.y1 = y1; + this.x2 = x2; + this.y2 = y2; + } + + public Region getQuadrant(int quadrantIndex) { + float quadrantWidth = (this.x2 - this.x1) / 2; + float quadrantHeight = (this.y2 - this.y1) / 2; + + // 0=SW, 1=NW, 2=NE, 3=SE + switch (quadrantIndex) { + case 0: + return new Region(x1, y1, x1 + quadrantWidth, y1 + quadrantHeight); + case 1: + return new Region(x1, y1 + quadrantHeight, x1 + quadrantWidth, y2); + case 2: + return new Region(x1 + quadrantWidth, y1 + quadrantHeight, x2, y2); + case 3: + return new Region(x1 + quadrantWidth, y1, x2, y1 + quadrantHeight); + } + return null; + } + + public boolean containsPoint(Point point) { + // Consider left and top side to be inclusive for points on border + return point.getX() >= this.x1 + && point.getX() < this.x2 + && point.getY() >= this.y1 + && point.getY() < this.y2; + } + + public boolean doesOverlap(Region testRegion) { + // Is test region completely to left of my region? + if (testRegion.getX2() < this.getX1()) { + return false; + } + // Is test region completely to right of my region? + if (testRegion.getX1() > this.getX2()) { + return false; + } + // Is test region completely above my region? + if (testRegion.getY1() > this.getY2()) { + return false; + } + // Is test region completely below my region? + if (testRegion.getY2() < this.getY1()) { + return false; + } + return true; + } + + @Override + public String toString() { + return "[Region (x1=" + x1 + ", y1=" + y1 + "), (x2=" + x2 + ", y2=" + y2 + ")]"; + } + + public float getX1() { + return x1; + } + + public float getY1() { + return y1; + } + + public float getX2() { + return x2; + } + + public float getY2() { + return y2; + } + +} diff --git a/algorithms-searching/src/test/java/com/baeldung/algorithms/quadtree/QuadTreeSearchUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/quadtree/QuadTreeSearchUnitTest.java new file mode 100644 index 0000000000..0b58ae9f14 --- /dev/null +++ b/algorithms-searching/src/test/java/com/baeldung/algorithms/quadtree/QuadTreeSearchUnitTest.java @@ -0,0 +1,60 @@ +package com.baeldung.algorithms.quadtree; + +import org.junit.Assert; + +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class QuadTreeSearchUnitTest { + + private static final Logger LOGGER = LoggerFactory.getLogger(QuadTreeSearchUnitTest.class); + + private static QuadTree quadTree; + + @BeforeClass + public static void setUp() { + Region area = new Region(0, 0, 400, 400); + quadTree = new QuadTree(area); + + float[][] points = new float[][] { { 21, 25 }, { 55, 53 }, { 70, 318 }, { 98, 302 }, + { 49, 229 }, { 135, 229 }, { 224, 292 }, { 206, 321 }, { 197, 258 }, { 245, 238 } }; + + for (int i = 0; i < points.length; i++) { + Point point = new Point(points[i][0], points[i][1]); + quadTree.addPoint(point); + } + LOGGER.info("\n" + quadTree.printTree("")); + LOGGER.info("=============================================="); + } + + @Test + public void givenQuadTree_whenSearchingForRange_thenReturn1MatchingItem() { + Region searchArea = new Region(200, 200, 250, 250); + List result = quadTree.search(searchArea, null, ""); + LOGGER.info(result.toString()); + LOGGER.info(quadTree.printSearchTraversePath()); + + Assert.assertEquals(1, result.size()); + Assert.assertArrayEquals(new float[] { 245, 238 }, + new float[]{result.get(0).getX(), result.get(0).getY() }, 0); + } + + @Test + public void givenQuadTree_whenSearchingForRange_thenReturn2MatchingItems() { + Region searchArea = new Region(0, 0, 100, 100); + List result = quadTree.search(searchArea, null, ""); + LOGGER.info(result.toString()); + LOGGER.info(quadTree.printSearchTraversePath()); + + Assert.assertEquals(2, result.size()); + Assert.assertArrayEquals(new float[] { 21, 25 }, + new float[]{result.get(0).getX(), result.get(0).getY() }, 0); + Assert.assertArrayEquals(new float[] { 55, 53 }, + new float[]{result.get(1).getX(), result.get(1).getY() }, 0); + + } +} diff --git a/apache-fop/src/main/webapp/WEB-INF/web.xml b/apache-fop/src/main/webapp/WEB-INF/web.xml index 935beae648..31187b8064 100644 --- a/apache-fop/src/main/webapp/WEB-INF/web.xml +++ b/apache-fop/src/main/webapp/WEB-INF/web.xml @@ -16,7 +16,7 @@ contextConfigLocation - org.baeldung.config + com.baeldung.config diff --git a/apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java b/apache-fop/src/test/java/com/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java similarity index 99% rename from apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java rename to apache-fop/src/test/java/com/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java index 5e2da6fd1e..bfc34d83b5 100644 --- a/apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java +++ b/apache-fop/src/test/java/com/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java; +package com.baeldung.java; import java.io.BufferedOutputStream; import java.io.File; diff --git a/apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldLiveTest.java b/apache-fop/src/test/java/com/baeldung/java/ApacheFOPHeroldLiveTest.java similarity index 99% rename from apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldLiveTest.java rename to apache-fop/src/test/java/com/baeldung/java/ApacheFOPHeroldLiveTest.java index 8496222394..af36f46d02 100644 --- a/apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldLiveTest.java +++ b/apache-fop/src/test/java/com/baeldung/java/ApacheFOPHeroldLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java; +package com.baeldung.java; import java.io.BufferedOutputStream; import java.io.BufferedReader; diff --git a/apache-olingo/olingo2/pom.xml b/apache-olingo/olingo2/pom.xml index fdbc9b4390..4689fa0ca9 100644 --- a/apache-olingo/olingo2/pom.xml +++ b/apache-olingo/olingo2/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.baeldung.examples.olingo2 + com.baeldung.examples.olingo2 olingo2 olingo2 Sample Olingo 2 Project diff --git a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java similarity index 95% rename from apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java rename to apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java index 65a0428154..55155732c8 100644 --- a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java +++ b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java @@ -1,4 +1,4 @@ -package org.baeldung.examples.olingo2; +package com.baeldung.examples.olingo2; import java.util.List; import java.util.Map; @@ -9,10 +9,8 @@ import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.FlushModeType; import javax.persistence.LockModeType; -import javax.persistence.Persistence; import javax.persistence.Query; import javax.persistence.StoredProcedureQuery; -import javax.persistence.SynchronizationType; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaDelete; @@ -25,11 +23,8 @@ import org.apache.olingo.odata2.api.processor.ODataContext; import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; import org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory; import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; -import org.baeldung.examples.olingo2.JerseyConfig.EntityManagerFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.orm.jpa.EntityManagerFactoryUtils; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.stereotype.Component; /** @@ -58,7 +53,7 @@ public class CarsODataJPAServiceFactory extends ODataJPAServiceFactory { ODataJPAContext ctx = getODataJPAContext(); ODataContext octx = ctx.getODataContext(); HttpServletRequest request = (HttpServletRequest)octx.getParameter(ODataContext.HTTP_SERVLET_REQUEST_OBJECT); - EntityManager em = (EntityManager)request.getAttribute(EntityManagerFilter.EM_REQUEST_ATTRIBUTE); + EntityManager em = (EntityManager)request.getAttribute(JerseyConfig.EntityManagerFilter.EM_REQUEST_ATTRIBUTE); // Here we're passing the EM that was created by the EntityManagerFilter (see JerseyConfig) ctx.setEntityManager(new EntityManagerWrapper(em)); diff --git a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/JerseyConfig.java b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java similarity index 97% rename from apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/JerseyConfig.java rename to apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java index 78caf99861..02e5ce5adf 100644 --- a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/JerseyConfig.java +++ b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java @@ -1,11 +1,10 @@ - package org.baeldung.examples.olingo2; + package com.baeldung.examples.olingo2; import java.io.IOException; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; -import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.ApplicationPath; import javax.ws.rs.Path; diff --git a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/Olingo2SampleApplication.java b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java similarity index 80% rename from apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/Olingo2SampleApplication.java rename to apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java index fa58612088..f76e0e00e3 100644 --- a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/Olingo2SampleApplication.java +++ b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java @@ -1,8 +1,7 @@ -package org.baeldung.examples.olingo2; +package com.baeldung.examples.olingo2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication diff --git a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/domain/CarMaker.java b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarMaker.java similarity index 98% rename from apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/domain/CarMaker.java rename to apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarMaker.java index e66d266062..d56a42374c 100644 --- a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/domain/CarMaker.java +++ b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarMaker.java @@ -1,4 +1,4 @@ -package org.baeldung.examples.olingo2.domain; +package com.baeldung.examples.olingo2.domain; import java.util.List; diff --git a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/domain/CarModel.java b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarModel.java similarity index 98% rename from apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/domain/CarModel.java rename to apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarModel.java index f9f563e01e..6bbaa3ad0c 100644 --- a/apache-olingo/olingo2/src/main/java/org/baeldung/examples/olingo2/domain/CarModel.java +++ b/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarModel.java @@ -1,4 +1,4 @@ -package org.baeldung.examples.olingo2.domain; +package com.baeldung.examples.olingo2.domain; import javax.persistence.Entity; import javax.persistence.FetchType; diff --git a/apache-olingo/olingo2/src/test/java/org/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java b/apache-olingo/olingo2/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java similarity index 89% rename from apache-olingo/olingo2/src/test/java/org/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java rename to apache-olingo/olingo2/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java index 7cb685e3e9..74033a49cd 100644 --- a/apache-olingo/olingo2/src/test/java/org/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java +++ b/apache-olingo/olingo2/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.examples.olingo2; +package com.baeldung.examples.olingo2; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/apache-rocketmq/README.md b/apache-rocketmq/README.md new file mode 100644 index 0000000000..be53f95790 --- /dev/null +++ b/apache-rocketmq/README.md @@ -0,0 +1,5 @@ +## Apache RocketMQ + +This module contains articles about Apache RocketMQ + +### Relevant Articles: diff --git a/apache-rocketmq/pom.xml b/apache-rocketmq/pom.xml new file mode 100644 index 0000000000..59c204dddf --- /dev/null +++ b/apache-rocketmq/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + apache-rocketmq + 1.0-SNAPSHOT + apache-rocketmq + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.apache.rocketmq + rocketmq-spring-boot-starter + 2.0.4 + + + + + 1.6.0 + + diff --git a/apache-rocketmq/src/main/java/com/baeldung/rocketmq/consumer/CartEventConsumer.java b/apache-rocketmq/src/main/java/com/baeldung/rocketmq/consumer/CartEventConsumer.java new file mode 100644 index 0000000000..06e88076d0 --- /dev/null +++ b/apache-rocketmq/src/main/java/com/baeldung/rocketmq/consumer/CartEventConsumer.java @@ -0,0 +1,34 @@ +package com.baeldung.rocketmq.consumer; + +import com.baeldung.rocketmq.event.CartItemEvent; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.stereotype.Service; + +@SpringBootApplication +public class CartEventConsumer { + + public static void main(String[] args) { + SpringApplication.run(CartEventConsumer.class, args); + } + + @Service + @RocketMQMessageListener(topic = "cart-item-add-topic", consumerGroup = "cart-consumer_cart-item-add-topic") + public class CardItemAddConsumer implements RocketMQListener { + public void onMessage(CartItemEvent addItemEvent) { + System.out.println("Adding item: " + addItemEvent); + // logic + } + } + + @Service + @RocketMQMessageListener(topic = "cart-item-removed-topic", consumerGroup = "cart-consumer_cart-item-removed-topic") + public class CardItemRemoveConsumer implements RocketMQListener { + public void onMessage(CartItemEvent removeItemEvent) { + System.out.println("Removing item: " + removeItemEvent); + // logic + } + } +} diff --git a/apache-rocketmq/src/main/java/com/baeldung/rocketmq/event/CartItemEvent.java b/apache-rocketmq/src/main/java/com/baeldung/rocketmq/event/CartItemEvent.java new file mode 100644 index 0000000000..a9d7b4a436 --- /dev/null +++ b/apache-rocketmq/src/main/java/com/baeldung/rocketmq/event/CartItemEvent.java @@ -0,0 +1,32 @@ +package com.baeldung.rocketmq.event; + +public class CartItemEvent { + private String itemId; + private int quantity; + + public CartItemEvent(String itemId, int quantity) { + this.itemId = itemId; + this.quantity = quantity; + } + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + @Override + public String toString() { + return "CartItemEvent{" + "itemId='" + itemId + '\'' + ", quantity=" + quantity + '}'; + } +} diff --git a/apache-rocketmq/src/main/java/com/baeldung/rocketmq/producer/CartEventProducer.java b/apache-rocketmq/src/main/java/com/baeldung/rocketmq/producer/CartEventProducer.java new file mode 100644 index 0000000000..dba6ee7a46 --- /dev/null +++ b/apache-rocketmq/src/main/java/com/baeldung/rocketmq/producer/CartEventProducer.java @@ -0,0 +1,26 @@ +package com.baeldung.rocketmq.producer; + + +import com.baeldung.rocketmq.event.CartItemEvent; +import org.apache.rocketmq.spring.core.RocketMQTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CartEventProducer implements CommandLineRunner { + + @Autowired + private RocketMQTemplate rocketMQTemplate; + + public static void main(String[] args) { + SpringApplication.run(CartEventProducer.class, args); + } + + public void run(String... args) throws Exception { + rocketMQTemplate.convertAndSend("cart-item-add-topic", new CartItemEvent("bike", 1)); + rocketMQTemplate.convertAndSend("cart-item-add-topic", new CartItemEvent("computer", 2)); + rocketMQTemplate.convertAndSend("cart-item-removed-topic", new CartItemEvent("bike", 1)); + } +} diff --git a/apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java b/apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java new file mode 100644 index 0000000000..e5fa6e361a --- /dev/null +++ b/apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java @@ -0,0 +1,21 @@ +package com.baeldung.rocketmq.transaction; + +import org.apache.rocketmq.spring.annotation.RocketMQTransactionListener; +import org.apache.rocketmq.spring.core.RocketMQLocalTransactionListener; +import org.apache.rocketmq.spring.core.RocketMQLocalTransactionState; +import org.springframework.messaging.Message; + +@RocketMQTransactionListener(txProducerGroup = "test-transaction") +class TransactionListenerImpl implements RocketMQLocalTransactionListener { + @Override + public RocketMQLocalTransactionState executeLocalTransaction(Message msg, Object arg) { + // ... local transaction process, return ROLLBACK, COMMIT or UNKNOWN + return RocketMQLocalTransactionState.UNKNOWN; + } + + @Override + public RocketMQLocalTransactionState checkLocalTransaction(Message msg) { + // ... check transaction status and return ROLLBACK, COMMIT or UNKNOWN + return RocketMQLocalTransactionState.COMMIT; + } +} diff --git a/apache-rocketmq/src/main/resources/application.properties b/apache-rocketmq/src/main/resources/application.properties new file mode 100644 index 0000000000..68d4ceaacd --- /dev/null +++ b/apache-rocketmq/src/main/resources/application.properties @@ -0,0 +1,9 @@ +rocketmq.name-server=127.0.0.1:9876 +rocketmq.producer.group=my-group +rocketmq.producer.send-message-timeout=300000 +rocketmq.producer.compress-message-body-threshold=4096 +rocketmq.producer.max-message-size=4194304 +rocketmq.producer.retry-times-when-send-async-failed=0 +rocketmq.producer.retry-next-server=true +rocketmq.producer.retry-times-when-send-failed=2 + diff --git a/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy b/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy index 65591cae8d..0612ecb955 100644 --- a/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy +++ b/core-groovy-2/src/main/groovy/com/baeldung/metaprogramming/extension/BasicExtensions.groovy @@ -2,10 +2,13 @@ package com.baeldung.metaprogramming.extension import com.baeldung.metaprogramming.Employee +import java.time.LocalDate +import java.time.Year + class BasicExtensions { static int getYearOfBirth(Employee self) { - return (new Date().getYear() + 1900) - self.age; + return Year.now().value - self.age } static String capitalize(String self) { diff --git a/core-groovy-2/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy b/core-groovy-2/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy index 8066b10f9b..4a8631eb95 100644 --- a/core-groovy-2/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy +++ b/core-groovy-2/src/test/groovy/com/baeldung/metaprogramming/MetaprogrammingUnitTest.groovy @@ -1,6 +1,9 @@ package com.baeldung.metaprogramming -import groovy.time.TimeCategory + +import java.time.LocalDate +import java.time.Period +import java.time.Year class MetaprogrammingUnitTest extends GroovyTestCase { @@ -51,14 +54,16 @@ class MetaprogrammingUnitTest extends GroovyTestCase { void testJavaMetaClass() { String.metaClass.capitalize = { String str -> - str.substring(0, 1).toUpperCase() + str.substring(1); + str.substring(0, 1).toUpperCase() + str.substring(1) } assert "norman".capitalize() == "Norman" } void testEmployeeExtension() { - Employee emp = new Employee(age: 28) - assert emp.getYearOfBirth() == 1991 + def age = 28 + def expectedYearOfBirth = Year.now() - age + Employee emp = new Employee(age: age) + assert emp.getYearOfBirth() == expectedYearOfBirth.value } void testJavaClassesExtensions() { @@ -115,4 +120,4 @@ class MetaprogrammingUnitTest extends GroovyTestCase { Employee employee = new Employee(1, "Norman", "Lewis", 28) employee.logEmp() } -} \ No newline at end of file +} diff --git a/core-java-lambdas/README.md b/core-java-lambdas/README.md deleted file mode 100644 index 5b94953e68..0000000000 --- a/core-java-lambdas/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Java 9 java.lang.Module API](https://www.baeldung.com/java-lambda-effectively-final-local-variables) diff --git a/core-java-modules/core-java-11/README.md b/core-java-modules/core-java-11/README.md index 93a2c6faf5..7ca81e901a 100644 --- a/core-java-modules/core-java-11/README.md +++ b/core-java-modules/core-java-11/README.md @@ -12,3 +12,4 @@ This module contains articles about Java 11 core features - [An Introduction to Epsilon GC: A No-Op Experimental Garbage Collector](https://www.baeldung.com/jvm-epsilon-gc-garbage-collector) - [Guide to jlink](https://www.baeldung.com/jlink) - [Negate a Predicate Method Reference with Java 11](https://www.baeldung.com/java-negate-predicate-method-reference) +- [Benchmark JDK Collections vs Eclipse Collections](https://www.baeldung.com/jdk-collections-vs-eclipse-collections) diff --git a/core-java-modules/core-java-11/src/test/java/com/baeldung/patternreuse/PatternJava11UnitTest.java b/core-java-modules/core-java-11/src/test/java/com/baeldung/patternreuse/PatternJava11UnitTest.java new file mode 100644 index 0000000000..e334d2c843 --- /dev/null +++ b/core-java-modules/core-java-11/src/test/java/com/baeldung/patternreuse/PatternJava11UnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.patternreuse; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class PatternJava11UnitTest { + + @Test + public void givenPreCompiledPattern_whenCallAsMatchPredicate_thenReturnMatchPredicateToMatchesPattern() { + List namesToValidate = Arrays.asList("Fabio Silva", "Fabio Luis Silva"); + Pattern firstLastNamePreCompiledPattern = Pattern.compile("[a-zA-Z]{3,} [a-zA-Z]{3,}"); + + Predicate patternAsMatchPredicate = firstLastNamePreCompiledPattern.asMatchPredicate(); + List validatedNames = namesToValidate.stream() + .filter(patternAsMatchPredicate) + .collect(Collectors.toList()); + + assertTrue(validatedNames.contains("Fabio Silva")); + assertFalse(validatedNames.contains("Fabio Luis Silva")); + } +} diff --git a/core-java-modules/core-java-14/pom.xml b/core-java-modules/core-java-14/pom.xml new file mode 100644 index 0000000000..48ec627416 --- /dev/null +++ b/core-java-modules/core-java-14/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + com.baeldung + core-java-14 + 1.0.0-SNAPSHOT + core-java-14 + jar + http://maven.apache.org + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source.version} + ${maven.compiler.target.version} + + + --enable-preview + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + --enable-preview + + + + + + + 14 + 14 + + + \ No newline at end of file diff --git a/core-java-modules/core-java-14/src/main/java/com/baeldung/serial/MySerialClass.java b/core-java-modules/core-java-14/src/main/java/com/baeldung/serial/MySerialClass.java new file mode 100644 index 0000000000..6a013d7b59 --- /dev/null +++ b/core-java-modules/core-java-14/src/main/java/com/baeldung/serial/MySerialClass.java @@ -0,0 +1,50 @@ +package com.baeldung.serial; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamException; +import java.io.ObjectStreamField; +import java.io.Serial; +import java.io.Serializable; + +/** + * Class showcasing the usage of the Java 14 @Serial annotation. + * + * @author Donato Rimenti + */ +public class MySerialClass implements Serializable { + + @Serial + private static final ObjectStreamField[] serialPersistentFields = null; + + @Serial + private static final long serialVersionUID = 1; + + @Serial + private void writeObject(ObjectOutputStream stream) throws IOException { + // ... + } + + @Serial + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { + // ... + } + + @Serial + private void readObjectNoData() throws ObjectStreamException { + // ... + } + + @Serial + private Object writeReplace() throws ObjectStreamException { + // ... + return null; + } + + @Serial + private Object readResolve() throws ObjectStreamException { + // ... + return null; + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-arrays-2/pom.xml b/core-java-modules/core-java-arrays-2/pom.xml index 3f6b7094bb..532f0a6144 100644 --- a/core-java-modules/core-java-arrays-2/pom.xml +++ b/core-java-modules/core-java-arrays-2/pom.xml @@ -19,6 +19,16 @@ org.apache.commons commons-lang3 ${commons-lang3.version} + + + org.openjdk.jmh + jmh-core + ${jmh.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} @@ -37,9 +47,34 @@ true + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.0 + + + package + + shade + + + benchmarks + + + org.openjdk.jmh.Main + + + + + + + + 1.19 3.9 diff --git a/core-java-modules/core-java-arrays-2/src/main/java/com/baeldung/arraysort/ArraySortingBenchmark.java b/core-java-modules/core-java-arrays-2/src/main/java/com/baeldung/arraysort/ArraySortingBenchmark.java new file mode 100644 index 0000000000..640d729020 --- /dev/null +++ b/core-java-modules/core-java-arrays-2/src/main/java/com/baeldung/arraysort/ArraySortingBenchmark.java @@ -0,0 +1,72 @@ +package com.baeldung.arraysort; + +import java.util.Arrays; +import java.util.Random; +import java.util.concurrent.TimeUnit; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5) +@Measurement(iterations = 10) +@Fork(2) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +public class ArraySortingBenchmark { + + @State(Scope.Benchmark) + public static class ArrayContainer { + + @Param({ "1000", "10000", "100000", "1000000" }) + int arraySize; + + // initial unsorted array + int[] unsortedArray; + + //cloned array to sort + int[] arrayToSort; + + @Setup(Level.Trial) + public void createUnSortedArray() { + unsortedArray = new int[arraySize]; + for (int i = 0; i < arraySize; i++) { + unsortedArray[i] = new Random().nextInt(1000); + } + } + + @Setup(Level.Invocation) + public void createUnSortedArrayCopy() { + arrayToSort = unsortedArray.clone(); + } + + int[] getArrayToSort() { + return arrayToSort; + } + } + + @Benchmark + public void benchmark_arrays_parallel_sort(ArrayContainer d, Blackhole b) { + int[] arr = d.getArrayToSort(); + Arrays.parallelSort(arr); + b.consume(arr); + } + + @Benchmark + public void benchmark_arrays_sort(ArrayContainer d, Blackhole b) { + int[] arr = d.getArrayToSort(); + Arrays.sort(arr); + b.consume(arr); + } + +} diff --git a/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arraysort/SortComparisonUnitTest.java b/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arraysort/SortComparisonUnitTest.java new file mode 100644 index 0000000000..d1aba5a886 --- /dev/null +++ b/core-java-modules/core-java-arrays-2/src/test/java/com/baeldung/arraysort/SortComparisonUnitTest.java @@ -0,0 +1,185 @@ +package com.baeldung.arraysort; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; + +import java.util.Arrays; +import java.util.Random; + +import org.junit.After; +import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +/** + * Time taken by JUnit test cases can be seen in JUnit Runner + * @author rchaudhary23 + * + */ + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class SortComparisonUnitTest { + + private int[] sizeOfArrays = { 1000, 10000, 100000, 1000000 }; + + private int[] _1000_elements_array; + private int[] _10000_elements_array; + private int[] _100000_elements_array; + private int[] _1000000_elements_array; + + @Before + public void setUp() throws Exception { + + _1000_elements_array = new int[sizeOfArrays[0]]; + _10000_elements_array = new int[sizeOfArrays[1]]; + _100000_elements_array = new int[sizeOfArrays[2]]; + _1000000_elements_array = new int[sizeOfArrays[3]]; + + Random random = new Random(); + for (int i = 0; i < sizeOfArrays[0]; i++) { + _1000_elements_array[i] = random.nextInt(sizeOfArrays[0]) + random.nextInt(sizeOfArrays[0]); + } + + for (int i = 0; i < sizeOfArrays[1]; i++) { + _10000_elements_array[i] = random.nextInt(sizeOfArrays[1]) + random.nextInt(sizeOfArrays[1]); + } + + for (int i = 0; i < sizeOfArrays[2]; i++) { + _100000_elements_array[i] = random.nextInt(sizeOfArrays[2]) + random.nextInt(sizeOfArrays[2]); + } + + for (int i = 0; i < sizeOfArrays[3]; i++) { + _1000000_elements_array[i] = random.nextInt(sizeOfArrays[3]) + random.nextInt(sizeOfArrays[3]); + } + + } + + @Test + public void givenArrayOfIntegers_whenUsingArraysSortMethod_thenSortFullArrayInAscendingOrder() { + + int[] array = { 10, 4, 6, 2, 1, 9, 7, 8, 3, 5 }; + int[] expected = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + Arrays.sort(array); + + assertArrayEquals(expected, array); + + } + + @Test + public void givenArrayOfIntegers_whenUsingArraysSortMethodWithRange_thenSortRangeOfArrayInAscendingOrder() { + int[] array = { 10, 4, 6, 2, 1, 9, 7, 8, 3, 5 }; + int[] expected = { 10, 4, 1, 2, 6, 7, 8, 9, 3, 5 }; + + Arrays.sort(array, 2, 8); + + assertArrayEquals(expected, array); + } + + @Test + public void givenArrayOfIntegers_whenUsingArraysParallelSortMethod_thenSortFullArrayInAscendingOrder() { + int[] array = { 10, 4, 6, 2, 1, 9, 7, 8, 3, 5 }; + int[] expected = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + Arrays.parallelSort(array); + + assertArrayEquals(expected, array); + } + + @Test + public void givenArrayOfIntegers_whenUsingArraysParallelSortMethodWithRange_thenSortRangeOfArrayInAscendingOrder() { + int[] array = { 10, 4, 6, 2, 1, 9, 7, 8, 3, 5 }; + int[] expected = { 10, 4, 1, 2, 6, 7, 8, 9, 3, 5 }; + + Arrays.parallelSort(array, 2, 8); + + assertArrayEquals(expected, array); + } + + @Test + public void givenIntegerArrayOf1000Elements_whenUsingArraysSortMethod_thenSortFullArrayInAscendingOrder() { + int[] sequentialDataSet = Arrays.copyOf(_1000_elements_array, _1000_elements_array.length); + Arrays.sort(sequentialDataSet); + + assertNotNull(sequentialDataSet); + assertNotSame(Arrays.copyOf(_1000_elements_array, _1000_elements_array.length), sequentialDataSet); + + } + + @Test + public void givenIntegerArrayOf1000Elements_whenUsingArraysParallelSortMethod_thenSortFullArrayInAscendingOrder() { + int[] parallelDataSet = Arrays.copyOf(_1000_elements_array, _1000_elements_array.length); + Arrays.parallelSort(parallelDataSet); + + assertNotNull(parallelDataSet); + assertNotSame(Arrays.copyOf(_1000_elements_array, _1000_elements_array.length), parallelDataSet); + + } + + @Test + public void givenIntegerArrayOf10000Elements_whenUsingArraysSortMethod_thenSortFullArrayInAscendingOrder() { + int[] sequentialDataSet = Arrays.copyOf(_10000_elements_array, _10000_elements_array.length); + Arrays.sort(sequentialDataSet); + + assertNotNull(sequentialDataSet); + assertNotSame(Arrays.copyOf(_10000_elements_array, _10000_elements_array.length), sequentialDataSet); + } + + @Test + public void givenIntegerArrayOf10000Elements_whenUsingArraysParallelSortMethod_thenSortFullArrayInAscendingOrder() { + int[] parallelDataSet = Arrays.copyOf(_10000_elements_array, _10000_elements_array.length); + Arrays.parallelSort(parallelDataSet); + + assertNotNull(parallelDataSet); + assertNotSame(Arrays.copyOf(_10000_elements_array, _10000_elements_array.length), parallelDataSet); + } + + @Test + public void givenIntegerArrayOf100000Elements_whenUsingArraysSortMethod_thenSortFullArrayInAscendingOrder() { + int[] sequentialDataSet = Arrays.copyOf(_100000_elements_array, _100000_elements_array.length); + Arrays.sort(sequentialDataSet); + + assertNotNull(sequentialDataSet); + assertNotSame(Arrays.copyOf(_100000_elements_array, _100000_elements_array.length), sequentialDataSet); + } + + @Test + public void givenIntegerArrayOf100000Elements_whenUsingArraysParallelSortMethod_thenSortFullArrayInAscendingOrder() { + int[] parallelDataSet = Arrays.copyOf(_100000_elements_array, _100000_elements_array.length); + Arrays.parallelSort(parallelDataSet); + + assertNotNull(parallelDataSet); + assertNotSame(Arrays.copyOf(_100000_elements_array, _100000_elements_array.length), parallelDataSet); + } + + @Test + public void givenIntegerArrayOf1000000Elements_whenUsingArraysSortMethod_thenSortFullArrayInAscendingOrder() { + int[] sequentialDataSet = Arrays.copyOf(_1000000_elements_array, _1000000_elements_array.length); + Arrays.sort(sequentialDataSet); + + assertNotNull(sequentialDataSet); + assertNotSame(Arrays.copyOf(_1000000_elements_array, _1000000_elements_array.length), sequentialDataSet); + } + + @Test + public void givenIntegerArrayOf1000000Elements_whenUsingArraysParallelSortMethod_thenSortFullArrayInAscendingOrder() { + int[] parallelDataSet = Arrays.copyOf(_1000000_elements_array, _1000000_elements_array.length); + Arrays.parallelSort(parallelDataSet); + + assertNotNull(parallelDataSet); + assertNotSame(Arrays.copyOf(_1000000_elements_array, _1000000_elements_array.length), parallelDataSet); + } + + @After + public void tearDown() throws Exception { + sizeOfArrays = null; + _1000_elements_array = null; + _10000_elements_array = null; + _100000_elements_array = null; + _1000000_elements_array = null; + } +} + + diff --git a/core-java-modules/core-java-collections-list-3/src/main/java/com/baeldung/list/duplicatescounter/DuplicatesCounter.java b/core-java-modules/core-java-collections-list-3/src/main/java/com/baeldung/list/duplicatescounter/DuplicatesCounter.java index b5138eed7d..e0c0b723e0 100644 --- a/core-java-modules/core-java-collections-list-3/src/main/java/com/baeldung/list/duplicatescounter/DuplicatesCounter.java +++ b/core-java-modules/core-java-collections-list-3/src/main/java/com/baeldung/list/duplicatescounter/DuplicatesCounter.java @@ -24,11 +24,21 @@ public class DuplicatesCounter { return resultMap; } - public static Map countByClassicalLoopWithMapCompute(List inputList) { + public static Map countByForEachLoopWithGetOrDefault(List inputList) { Map resultMap = new HashMap<>(); - for (T element : inputList) { - resultMap.compute(element, (k, v) -> v == null ? 1 : v + 1); - } + inputList.forEach(e -> resultMap.put(e, resultMap.getOrDefault(e, 0L) + 1L)); + return resultMap; + } + + public static Map countByForEachLoopWithMapCompute(List inputList) { + Map resultMap = new HashMap<>(); + inputList.forEach(e -> resultMap.compute(e, (k, v) -> v == null ? 1L : v + 1L)); + return resultMap; + } + + public static Map countByForEachLoopWithMapMerge(List inputList) { + Map resultMap = new HashMap<>(); + inputList.forEach(e -> resultMap.merge(e, 1L, Long::sum)); return resultMap; } diff --git a/core-java-modules/core-java-collections-list-3/src/test/java/com/baeldung/list/duplicatescounter/DuplicatesCounterUnitTest.java b/core-java-modules/core-java-collections-list-3/src/test/java/com/baeldung/list/duplicatescounter/DuplicatesCounterUnitTest.java index be9ccded9b..8d6825c590 100644 --- a/core-java-modules/core-java-collections-list-3/src/test/java/com/baeldung/list/duplicatescounter/DuplicatesCounterUnitTest.java +++ b/core-java-modules/core-java-collections-list-3/src/test/java/com/baeldung/list/duplicatescounter/DuplicatesCounterUnitTest.java @@ -11,7 +11,6 @@ import static org.assertj.core.data.MapEntry.entry; class DuplicatesCounterUnitTest { - private static List INPUT_LIST = Lists.list( "expect1", "expect2", "expect2", @@ -24,10 +23,21 @@ class DuplicatesCounterUnitTest { verifyResult(result); } + @Test + void givenInput_whenCountByForEachLoopWithGetOrDefault_thenGetResultMap() { + Map result = DuplicatesCounter.countByForEachLoopWithGetOrDefault(INPUT_LIST); + verifyResult(result); + } @Test - void givenInput_whenCountByClassicalLoopWithMapCompute_thenGetResultMap() { - Map result = DuplicatesCounter.countByClassicalLoopWithMapCompute(INPUT_LIST); + void givenInput_whenCountByForEachLoopWithMapCompute_thenGetResultMap() { + Map result = DuplicatesCounter.countByForEachLoopWithMapCompute(INPUT_LIST); + verifyResult(result); + } + + @Test + void givenInput_whenCountByForEachLoopWithMapMerge_thenGetResultMap() { + Map result = DuplicatesCounter.countByForEachLoopWithMapMerge(INPUT_LIST); verifyResult(result); } diff --git a/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/date/comparison/DateComparisonUtils.java b/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/date/comparison/DateComparisonUtils.java index ae8d21c29c..fea268964a 100644 --- a/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/date/comparison/DateComparisonUtils.java +++ b/core-java-modules/core-java-date-operations/src/main/java/com/baeldung/date/comparison/DateComparisonUtils.java @@ -1,8 +1,10 @@ package com.baeldung.date.comparison; import java.text.SimpleDateFormat; +import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; +import java.time.temporal.ChronoUnit; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; @@ -23,6 +25,14 @@ public class DateComparisonUtils { return localDate1.isEqual(localDate2); } + public static boolean isSameDayUsingInstant(Date date1, Date date2) { + Instant instant1 = date1.toInstant() + .truncatedTo(ChronoUnit.DAYS); + Instant instant2 = date2.toInstant() + .truncatedTo(ChronoUnit.DAYS); + return instant1.equals(instant2); + } + public static boolean isSameDayUsingSimpleDateFormat(Date date1, Date date2) { SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); return fmt.format(date1) diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/date/comparison/DateComparisonUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/date/comparison/DateComparisonUtilsUnitTest.java index db55aadcca..faa2b18c91 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/date/comparison/DateComparisonUtilsUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/date/comparison/DateComparisonUtilsUnitTest.java @@ -1,13 +1,13 @@ package com.baeldung.date.comparison; -import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import org.junit.Test; public class DateComparisonUtilsUnitTest { @@ -23,6 +23,7 @@ public class DateComparisonUtilsUnitTest { @Test public void givenDatesWithDifferentTime_whenIsSameDay_thenReturnsTrue() { assertTrue(DateComparisonUtils.isSameDayUsingLocalDate(day1Morning, day1Evening)); + assertTrue(DateComparisonUtils.isSameDayUsingInstant(day1Morning, day1Evening)); assertTrue(DateComparisonUtils.isSameDayUsingSimpleDateFormat(day1Morning, day1Evening)); assertTrue(DateComparisonUtils.isSameDayUsingCalendar(day1Morning, day1Evening)); assertTrue(DateComparisonUtils.isSameDayUsingApacheCommons(day1Morning, day1Evening)); @@ -35,6 +36,9 @@ public class DateComparisonUtilsUnitTest { assertFalse(DateComparisonUtils.isSameDayUsingLocalDate(day1Morning, day2Morning)); assertFalse(DateComparisonUtils.isSameDayUsingLocalDate(day1Evening, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingInstant(day1Morning, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingInstant(day1Evening, day2Morning)); + assertFalse(DateComparisonUtils.isSameDayUsingSimpleDateFormat(day1Morning, day2Morning)); assertFalse(DateComparisonUtils.isSameDayUsingSimpleDateFormat(day1Evening, day2Morning)); diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/DateUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/DateUtilsUnitTest.java index 8711455265..9bc2a17f28 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/DateUtilsUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/DateUtilsUnitTest.java @@ -9,12 +9,6 @@ import static org.junit.Assert.assertEquals; public class DateUtilsUnitTest { - @Test - public void givenTimeMillis_thenDateIsReturned() { - Date now = DateUtils.getNow(); - assertEquals(DateUtils.getDate(now.getTime()), now); - } - @Test public void givenDateAndPattern_thenDateIsCorrectlyReturned() throws ParseException { long milliseconds = new Date(2020 - 1900, 0, 1).getTime(); diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/DateUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/DateUtilsUnitTest.java index 945086c86f..9ccaa9a845 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/DateUtilsUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/DateUtilsUnitTest.java @@ -9,11 +9,6 @@ import org.junit.Test; public class DateUtilsUnitTest { - @Test - public void givenCurrentDate_thenTodayIsReturned() { - assertEquals(DateUtils.getNow().toLocalDate(), LocalDate.now()); - } - @Test(expected = IllegalArgumentException.class) public void givenDateAsString_whenPatternIsNotRespected_thenExceptionIsThrown() { DateUtils.getDate("2020 01 01"); diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/TimestampUtilsUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/TimestampUtilsUnitTest.java index 2faf8fab0e..836d0d55e7 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/TimestampUtilsUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/datetime/sql/TimestampUtilsUnitTest.java @@ -1,22 +1,13 @@ package com.baeldung.datetime.sql; -import static org.junit.Assert.assertEquals; - import org.junit.Test; -import com.baeldung.datetime.sql.TimestampUtils; - import java.text.ParseException; -import java.util.Date; + +import static org.junit.Assert.assertEquals; public class TimestampUtilsUnitTest { - @Test - public void givenCurrentTimestamp_thenNowIsReturned() { - assertEquals(TimestampUtils.getNow() - .getTime(), new Date().getTime()); - } - @Test(expected = IllegalArgumentException.class) public void givenTimestampAsString_whenPatternIsNotRespected_thenExceptionIsThrown() { TimestampUtils.getTimestamp("2020/01/01 10:11-12"); diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyDefaultTimezoneUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/jvmtimezone/ModifyDefaultTimezoneUnitTest.java similarity index 79% rename from core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyDefaultTimezoneUnitTest.java rename to core-java-modules/core-java-date-operations/src/test/java/com/baeldung/jvmtimezone/ModifyDefaultTimezoneUnitTest.java index 05d36d2c6c..7a266b46c3 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyDefaultTimezoneUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/jvmtimezone/ModifyDefaultTimezoneUnitTest.java @@ -1,9 +1,8 @@ -package com.baeldung.timezone; +package com.baeldung.jvmtimezone; import org.junit.Test; import java.util.Calendar; -import java.util.Date; import java.util.TimeZone; import static org.junit.Assert.assertEquals; @@ -13,9 +12,7 @@ public class ModifyDefaultTimezoneUnitTest { @Test public void givenDefaultTimezoneSet_thenDateTimezoneIsCorrect() { TimeZone.setDefault(TimeZone.getTimeZone("Portugal")); - Date date = new Date(); Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); assertEquals(calendar.getTimeZone(), TimeZone.getTimeZone("Portugal")); } diff --git a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyTimezonePropertyUnitTest.java b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/jvmtimezone/ModifyTimezonePropertyUnitTest.java similarity index 79% rename from core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyTimezonePropertyUnitTest.java rename to core-java-modules/core-java-date-operations/src/test/java/com/baeldung/jvmtimezone/ModifyTimezonePropertyUnitTest.java index 8f65f520f8..ec0d183e78 100644 --- a/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/timezone/ModifyTimezonePropertyUnitTest.java +++ b/core-java-modules/core-java-date-operations/src/test/java/com/baeldung/jvmtimezone/ModifyTimezonePropertyUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.timezone; +package com.baeldung.jvmtimezone; import org.junit.After; import org.junit.Before; @@ -14,7 +14,7 @@ public class ModifyTimezonePropertyUnitTest { @Before public void setup() { - System.setProperty("user.timezone", "IST"); + System.setProperty("user.timezone", "Asia/Kolkata"); TimeZone.setDefault(null); } @@ -25,10 +25,8 @@ public class ModifyTimezonePropertyUnitTest { @Test public void givenTimezonePropertySet_thenDateTimezoneIsCorrect() { - Date date = new Date(); Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - assertEquals(calendar.getTimeZone(), TimeZone.getTimeZone("IST")); + assertEquals(calendar.getTimeZone(), TimeZone.getTimeZone("Asia/Kolkata")); } } \ No newline at end of file diff --git a/java-dates/src/main/java/com/baeldung/datetime/UseDateTimeFormatter.java b/core-java-modules/core-java-datetime-java8/src/main/java/com/baeldung/datetime/UseDateTimeFormatter.java similarity index 100% rename from java-dates/src/main/java/com/baeldung/datetime/UseDateTimeFormatter.java rename to core-java-modules/core-java-datetime-java8/src/main/java/com/baeldung/datetime/UseDateTimeFormatter.java diff --git a/java-dates/src/main/java/com/baeldung/datetime/UseOffsetDateTime.java b/core-java-modules/core-java-datetime-java8/src/main/java/com/baeldung/datetime/UseOffsetDateTime.java similarity index 100% rename from java-dates/src/main/java/com/baeldung/datetime/UseOffsetDateTime.java rename to core-java-modules/core-java-datetime-java8/src/main/java/com/baeldung/datetime/UseOffsetDateTime.java diff --git a/java-dates/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java b/core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java similarity index 100% rename from java-dates/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java rename to core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java diff --git a/java-dates/src/test/java/com/baeldung/datetime/UseOffsetDateTimeUnitTest.java b/core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseOffsetDateTimeUnitTest.java similarity index 100% rename from java-dates/src/test/java/com/baeldung/datetime/UseOffsetDateTimeUnitTest.java rename to core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseOffsetDateTimeUnitTest.java diff --git a/java-dates/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java b/core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java similarity index 100% rename from java-dates/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java rename to core-java-modules/core-java-datetime-java8/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java diff --git a/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/exceptions/CatchingThrowable.java b/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/exceptions/CatchingThrowable.java new file mode 100644 index 0000000000..20b06cdd26 --- /dev/null +++ b/core-java-modules/core-java-exceptions-2/src/main/java/com/baeldung/exceptions/CatchingThrowable.java @@ -0,0 +1,38 @@ +package com.baeldung.exceptions; + +import java.util.Set; +import java.util.UUID; + +public class CatchingThrowable { + + class CapacityException extends Exception { + CapacityException(String message) { + super(message); + } + } + + class StorageAPI { + + public void addIDsToStorage(int capacity, Set storage) throws CapacityException { + if (capacity < 1) { + throw new CapacityException("Capacity of less than 1 is not allowed"); + } + int count = 0; + while (count < capacity) { + storage.add(UUID.randomUUID().toString()); + count++; + } + } + + // other methods go here ... + } + + public void add(StorageAPI api, int capacity, Set storage) { + try { + api.addIDsToStorage(capacity, storage); + } catch (Throwable throwable) { + // do something here + } + } + +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyExample.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyExample.java new file mode 100644 index 0000000000..bb0bad8cf4 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyExample.java @@ -0,0 +1,14 @@ +package com.baeldung.finallykeyword; + +public class FinallyExample { + + public void printCount(String count) { + try { + System.out.println("The count is " + Integer.parseInt(count)); + } catch (NumberFormatException e) { + System.out.println("No count"); + } finally { + System.out.println("In finally"); + } + } +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyExecutedCases.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyExecutedCases.java new file mode 100644 index 0000000000..68a3763da0 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyExecutedCases.java @@ -0,0 +1,53 @@ +package com.baeldung.finallykeyword; + +public class FinallyExecutedCases { + + public void noExceptionFinally() { + try { + System.out.println("Inside try"); + } finally { + System.out.println("Inside finally"); + } + } + + public void unhandledException() throws Exception { + try { + System.out.println("Inside try"); + throw new Exception(); + } finally { + System.out.println("Inside finally"); + } + } + + public void handledException() { + try { + System.out.println("Inside try"); + throw new Exception(); + } catch (Exception e) { + System.out.println("Inside catch"); + } finally { + System.out.println("Inside finally"); + } + } + + public String returnFromTry() { + try { + System.out.println("Inside try"); + return "from try"; + } finally { + System.out.println("Inside finally"); + } + } + + public String returnFromCatch() { + try { + System.out.println("Inside try"); + throw new Exception(); + } catch (Exception e) { + System.out.println("Inside catch"); + return "from catch"; + } finally { + System.out.println("Inside finally"); + } + } +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyNotExecutedCases.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyNotExecutedCases.java new file mode 100644 index 0000000000..92c0ea729d --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/FinallyNotExecutedCases.java @@ -0,0 +1,54 @@ +package com.baeldung.finallykeyword; + +public class FinallyNotExecutedCases { + + public void callingSystemExit() { + try { + System.out.println("Inside try"); + System.exit(1); + } finally { + System.out.println("Inside finally"); + } + } + + public void callingRuntimeHalt() { + try { + System.out.println("Inside try"); + Runtime.getRuntime() + .halt(1); + } finally { + System.out.println("Inside finally"); + } + } + + public void infiniteLoop() { + try { + System.out.println("Inside try"); + while (true) { + } + } finally { + System.out.println("Inside finally"); + } + } + + public void daemonThread() throws InterruptedException { + Runnable runnable = () -> { + try { + System.out.println("Inside try"); + } finally { + try { + Thread.sleep(1000); + System.out.println("Inside finally"); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }; + Thread regular = new Thread(runnable); + Thread daemon = new Thread(runnable); + daemon.setDaemon(true); + regular.start(); + Thread.sleep(300); + daemon.start(); + } +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/PitfallsWhenUsingFinally.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/PitfallsWhenUsingFinally.java new file mode 100644 index 0000000000..f1a56441f2 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/finallykeyword/PitfallsWhenUsingFinally.java @@ -0,0 +1,33 @@ +package com.baeldung.finallykeyword; + +public class PitfallsWhenUsingFinally { + + public String disregardsUnCaughtException() { + try { + System.out.println("Inside try"); + throw new RuntimeException(); + } finally { + System.out.println("Inside finally"); + return "from finally"; + } + } + + public String ignoringOtherReturns() { + try { + System.out.println("Inside try"); + return "from try"; + } finally { + System.out.println("Inside finally"); + return "from finally"; + } + } + + public String throwsException() { + try { + System.out.println("Inside try"); + return "from try"; + } finally { + throw new RuntimeException(); + } + } +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/Coordinates.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/Coordinates.java new file mode 100644 index 0000000000..4a292b9b18 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/Coordinates.java @@ -0,0 +1,49 @@ +package com.baeldung.methodmultiplereturnvalues; + +public class Coordinates { + + private double longitude; + private double latitude; + private String placeName; + + public Coordinates() {} + + public Coordinates(double longitude, double latitude, String placeName) { + this.longitude = longitude; + this.latitude = latitude; + this.placeName = placeName; + } + + public double calculateDistance(Coordinates c) { + + double s1 = Math.abs(this.longitude - c.longitude); + double s2 = Math.abs(this.latitude - c.latitude); + + return Math.hypot(s1, s2); + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public String getPlaceName() { + return placeName; + } + + public void setPlaceName(String placeName) { + this.placeName = placeName; + } + +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingArrays.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingArrays.java new file mode 100644 index 0000000000..9763422618 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingArrays.java @@ -0,0 +1,27 @@ +package com.baeldung.methodmultiplereturnvalues; + +class MultipleReturnValuesUsingArrays { + + + static double[] getCoordinatesDoubleArray() { + + double[] coordinates = new double[2]; + + coordinates[0] = 10; + coordinates[1] = 12.5; + + return coordinates; + } + + + static Number[] getCoordinatesNumberArray() { + + Number[] coordinates = new Number[2]; + + coordinates[0] = 10; //Integer + coordinates[1] = 12.5; //Double + + return coordinates; + } + +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingCollections.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingCollections.java new file mode 100644 index 0000000000..ccd5a4b74e --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingCollections.java @@ -0,0 +1,30 @@ +package com.baeldung.methodmultiplereturnvalues; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +class MultipleReturnValuesUsingCollections { + + static List getCoordinatesList() { + + List coordinates = new ArrayList<>(); + + coordinates.add(10); + coordinates.add(12.5); + + return coordinates; + } + + static Map getCoordinatesMap() { + + Map coordinates = new HashMap<>(); + + coordinates.put("longitude", 10); + coordinates.put("latitude", 12.5); + + return coordinates; + } + +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingContainer.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingContainer.java new file mode 100644 index 0000000000..617f0df17c --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingContainer.java @@ -0,0 +1,14 @@ +package com.baeldung.methodmultiplereturnvalues; + +class MultipleReturnValuesUsingContainer { + + static Coordinates getCoordinates() { + + double longitude = 10; + double latitude = 12.5; + String placeName = "home"; + + return new Coordinates(longitude, latitude, placeName); + } + +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingTuples.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingTuples.java new file mode 100644 index 0000000000..59984f777e --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingTuples.java @@ -0,0 +1,17 @@ +package com.baeldung.methodmultiplereturnvalues; + +import java.util.List; + +class MultipleReturnValuesUsingTuples { + + static Tuple2 getMostDistantPoint(List coordinatesList, + Coordinates target) { + + return coordinatesList.stream() + .map(coor -> new Tuple2<>(coor, coor.calculateDistance(target))) + .max((d1, d2) -> Double.compare(d1.getSecond(), d2.getSecond())) + .get(); + + } + +} diff --git a/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/Tuple2.java b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/Tuple2.java new file mode 100644 index 0000000000..57ef20d572 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/main/java/com/baeldung/methodmultiplereturnvalues/Tuple2.java @@ -0,0 +1,31 @@ +package com.baeldung.methodmultiplereturnvalues; + +public class Tuple2 { + + private K first; + private V second; + + public Tuple2() {} + + public Tuple2(K first, V second) { + this.first = first; + this.second = second; + } + + public K getFirst() { + return first; + } + + public V getSecond() { + return second; + } + + public void setFirst(K first) { + this.first = first; + } + + public void setSecond(V second) { + this.second = second; + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/finallykeyword/PitfallsWhenUsingFinallyUnitTest.java b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/finallykeyword/PitfallsWhenUsingFinallyUnitTest.java new file mode 100644 index 0000000000..7e7a7241ec --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/finallykeyword/PitfallsWhenUsingFinallyUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.finallykeyword; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class PitfallsWhenUsingFinallyUnitTest { + + PitfallsWhenUsingFinally instance = new PitfallsWhenUsingFinally(); + + @Test + public void testIgnoresException() { + String result = instance.disregardsUnCaughtException(); + assertEquals("from finally", result); + } + + @Test + public void testIgnoresOtherReturns() { + String result = instance.ignoringOtherReturns(); + assertEquals("from finally", result); + } + + @Test(expected = RuntimeException.class) + public void testThrowsException() { + instance.throwsException(); + } +} diff --git a/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingArraysUnitTest.java b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingArraysUnitTest.java new file mode 100644 index 0000000000..0cf90a8879 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingArraysUnitTest.java @@ -0,0 +1,25 @@ +package com.baeldung.methodmultiplereturnvalues; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; + +class MultipleReturnValuesUsingArraysUnitTest { + + @Test + void whenUsingArrayOfDoubles_thenMultipleDoubleFieldsAreReturned() { + + double[] coordinates = MultipleReturnValuesUsingArrays.getCoordinatesDoubleArray(); + assertEquals(10, coordinates[0]); + assertEquals(12.5, coordinates[1]); + } + + @Test + void whenUsingArrayOfNumbers_thenMultipleNumberFieldsAreReturned() { + + Number[] coordinates = MultipleReturnValuesUsingArrays.getCoordinatesNumberArray(); + assertEquals(10, coordinates[0]); + assertEquals(12.5, coordinates[1]); + + } + +} diff --git a/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingCollectionsUnitTest.java b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingCollectionsUnitTest.java new file mode 100644 index 0000000000..8038601986 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingCollectionsUnitTest.java @@ -0,0 +1,25 @@ +package com.baeldung.methodmultiplereturnvalues; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +class MultipleReturnValuesUsingCollectionsUnitTest { + + @Test + void whenUsingList_thenMultipleFieldsAreReturned() { + + List coordinates = MultipleReturnValuesUsingCollections.getCoordinatesList(); + assertEquals(Integer.valueOf(10), coordinates.get(0)); + assertEquals(Double.valueOf(12.5), coordinates.get(1)); + } + + @Test + void whenUsingMap_thenMultipleFieldsAreReturned() { + + Map coordinates = MultipleReturnValuesUsingCollections.getCoordinatesMap(); + assertEquals(Integer.valueOf(10), coordinates.get("longitude")); + assertEquals(Double.valueOf(12.5), coordinates.get("latitude")); + } +} diff --git a/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingContainerUnitTest.java b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingContainerUnitTest.java new file mode 100644 index 0000000000..f7fd9bd108 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingContainerUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.methodmultiplereturnvalues; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; + +class MultipleReturnValuesUsingContainerUnitTest { + + @Test + void whenUsingContainerClass_thenMultipleFieldsAreReturned() { + + Coordinates coordinates = MultipleReturnValuesUsingContainer.getCoordinates(); + + assertEquals(10, coordinates.getLongitude()); + assertEquals(12.5, coordinates.getLatitude()); + assertEquals("home", coordinates.getPlaceName()); + } +} diff --git a/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingTuplesUnitTest.java b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingTuplesUnitTest.java new file mode 100644 index 0000000000..52f30286bc --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/methodmultiplereturnvalues/MultipleReturnValuesUsingTuplesUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.methodmultiplereturnvalues; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Test; + +class MultipleReturnValuesUsingTuplesUnitTest { + + @Test + void whenUsingTuple_thenMultipleFieldsAreReturned() { + + List coordinatesList = new ArrayList<>(); + coordinatesList.add(new Coordinates(1, 1, "home")); + coordinatesList.add(new Coordinates(2, 2, "school")); + coordinatesList.add(new Coordinates(3, 3, "hotel")); + + Coordinates target = new Coordinates(5, 5, "gym"); + + Tuple2 mostDistantPoint = MultipleReturnValuesUsingTuples.getMostDistantPoint(coordinatesList, target); + + assertEquals(1, mostDistantPoint.getFirst().getLongitude()); + assertEquals(1, mostDistantPoint.getFirst().getLatitude()); + assertEquals("home", mostDistantPoint.getFirst().getPlaceName()); + assertEquals(5.66, BigDecimal.valueOf(mostDistantPoint.getSecond()).setScale(2, RoundingMode.HALF_UP).doubleValue()); + + } + +} diff --git a/core-java-modules/core-java-lang-math/README.md b/core-java-modules/core-java-lang-math/README.md index aec339574b..c72b69fcad 100644 --- a/core-java-modules/core-java-lang-math/README.md +++ b/core-java-modules/core-java-lang-math/README.md @@ -7,3 +7,5 @@ - [Java 8 Unsigned Arithmetic Support](https://www.baeldung.com/java-unsigned-arithmetic) - [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) - [The strictfp Keyword in Java](https://www.baeldung.com/java-strictfp) +- [Basic Calculator in Java](https://www.baeldung.com/java-basic-calculator) +- [Overflow and Underflow in Java](https://www.baeldung.com/java-overflow-underflow) diff --git a/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/powerset/PowerSetUtility.java b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/powerset/PowerSetUtility.java new file mode 100644 index 0000000000..fd4c1933f6 --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/powerset/PowerSetUtility.java @@ -0,0 +1,320 @@ +package com.baeldung.powerset; + +import com.google.common.collect.Sets; + +import javax.annotation.Nullable; +import java.util.AbstractSet; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; + +public class PowerSetUtility { + + private Map map = new HashMap<>(); + private List reverseMap = new ArrayList<>(); + + //Lazy Load PowerSet class + private static class PowerSet extends AbstractSet> { + private Map map = new HashMap<>(); + private List reverseMap = new ArrayList<>(); + private Set set; + + public PowerSet(Set set) { + this.set = set; + initializeMap(); + } + + abstract class ListIterator implements Iterator { + + protected int position = 0; + private int size; + + public ListIterator(int size) { + this.size = size; + } + + @Override + public boolean hasNext() { + return position < size; + } + } + + static class Subset extends AbstractSet { + private Map map; + private List reverseMap; + private int mask; + + public Subset(Map map, List reverseMap, int mask) { + this.map = map; + this.reverseMap = reverseMap; + this.mask = mask; + } + + @Override + public Iterator iterator() { + return new Iterator() { + int remainingSetBits = mask; + + @Override + public boolean hasNext() { + return remainingSetBits != 0; + } + + @Override + public E next() { + int index = Integer.numberOfTrailingZeros(remainingSetBits); + if (index == 32) { + throw new NoSuchElementException(); + } + remainingSetBits &= ~(1 << index); + return reverseMap.get(index); + } + }; + } + + @Override + public int size() { + return Integer.bitCount(mask); + } + + @Override + public boolean contains(@Nullable Object o) { + Integer index = map.get(o); + return index != null && (mask & (1 << index)) != 0; + } + } + + @Override + public Iterator> iterator() { + return new ListIterator>(this.size()) { + @Override + public Set next() { + return new Subset<>(map, reverseMap, position++); + } + }; + } + + @Override + public int size() { + return (1 << this.set.size()); + } + + @Override + public boolean contains(@Nullable Object obj) { + if (obj instanceof Set) { + Set set = (Set) obj; + return reverseMap.containsAll(set); + } + return false; + } + + @Override + public boolean equals(@Nullable Object obj) { + if (obj instanceof PowerSet) { + PowerSet that = (PowerSet) obj; + return set.equals(that.set);//Set equals check to have the same element regardless of the order of the items + } + return super.equals(obj); + } + + + private void initializeMap() { + int mapId = 0; + for (E c : this.set) { + map.put(c, mapId++); + reverseMap.add(c); + } + } + } + + public Set> lazyLoadPowerSet(Set set) { + return new PowerSet<>(set); + } + + public Set> recursivePowerSet(Set set) { + if (set.isEmpty()) { + Set> ret = new HashSet<>(); + ret.add(set); + return ret; + } + + T element = set.iterator().next(); + Set subSetWithoutElement = getSubSetWithoutElement(set, element); + Set> powerSetSubSetWithoutElement = recursivePowerSet(subSetWithoutElement); + + Set> powerSetSubSetWithElement = addElementToAll(powerSetSubSetWithoutElement, element); + + Set> powerSet = new HashSet<>(); + powerSet.addAll(powerSetSubSetWithoutElement); + powerSet.addAll(powerSetSubSetWithElement); + return powerSet; + } + + public Set> recursivePowerSetIndexRepresentation(Collection set) { + initializeMap(set); + Set> powerSetIndices = recursivePowerSetIndexRepresentation(0, set.size()); + return unMapIndex(powerSetIndices); + } + + private List> iterativePowerSetByLoopOverNumbersWithReverseLexicographicalOrder(int n) { + List> powerSet = new ArrayList<>(); + for (int i = 0; i < (1 << n); i++) { + List subset = new ArrayList<>(n); + for (int j = 0; j < n; j++) + subset.add(((1 << j) & i) > 0); + powerSet.add(subset); + } + return powerSet; + } + + private List> iterativePowerSetByLoopOverNumbersWithGrayCodeOrder(int n) { + List> powerSet = new ArrayList<>(); + for (int i = 0; i < (1 << n); i++) { + List subset = new ArrayList<>(n); + for (int j = 0; j < n; j++) { + int grayEquivalent = i ^ (i >> 1); + subset.add(((1 << j) & grayEquivalent) > 0); + } + powerSet.add(subset); + } + return powerSet; + } + + public Set> recursivePowerSetBinaryRepresentation(Collection set) { + initializeMap(set); + Set> powerSetBoolean = recursivePowerSetBinaryRepresentation(0, set.size()); + return unMapBinary(powerSetBoolean); + } + + public List> iterativePowerSetByLoopOverNumbers(Set set) { + initializeMap(set); + List> sets = iterativePowerSetByLoopOverNumbersWithReverseLexicographicalOrder(set.size()); + return unMapListBinary(sets); + } + + public List> iterativePowerSetByLoopOverNumbersMinimalChange(Set set) { + initializeMap(set); + List> sets = iterativePowerSetByLoopOverNumbersWithGrayCodeOrder(set.size()); + return unMapListBinary(sets); + } + + public static int getRankInLexicographicalOrder(List subset) { + int rank = 0; + for (int i = 0; i < subset.size(); i++) + if (subset.get(i)) + rank += (1 << (subset.size() - i - 1)); + return rank; + } + + public static List getSubsetForRankInLexicographicalOrder(int rank, int sizeOfSet) { + Boolean[] subset = new Boolean[sizeOfSet]; + for(int j = 0; j < sizeOfSet; j++) { + subset[sizeOfSet - j - 1] = ((rank & (1 << j)) > 0); + } + return Arrays.asList(subset); + } + + private Set> recursivePowerSetIndexRepresentation(int idx, int n) { + if (idx == n) { + Set> empty = new HashSet<>(); + empty.add(new HashSet<>()); + return empty; + } + Set> powerSetSubset = recursivePowerSetIndexRepresentation(idx + 1, n); + Set> powerSet = new HashSet<>(powerSetSubset); + for (Set s : powerSetSubset) { + HashSet subSetIdxInclusive = new HashSet<>(s); + subSetIdxInclusive.add(idx); + powerSet.add(subSetIdxInclusive); + } + return powerSet; + } + + private Set> recursivePowerSetBinaryRepresentation(int idx, int n) { + if (idx == n) { + Set> powerSetOfEmptySet = new HashSet<>(); + powerSetOfEmptySet.add(Arrays.asList(new Boolean[n])); + return powerSetOfEmptySet; + } + Set> powerSetSubset = recursivePowerSetBinaryRepresentation(idx + 1, n); + Set> powerSet = new HashSet<>(); + for (List s : powerSetSubset) { + List subSetIdxExclusive = new ArrayList<>(s); + subSetIdxExclusive.set(idx, false); + powerSet.add(subSetIdxExclusive); + List subSetIdxInclusive = new ArrayList<>(s); + subSetIdxInclusive.set(idx, true); + powerSet.add(subSetIdxInclusive); + } + return powerSet; + } + + private void initializeMap(Collection collection) { + int mapId = 0; + for (T c : collection) { + map.put(c, mapId++); + reverseMap.add(c); + } + } + + private Set> unMapIndex(Set> sets) { + Set> ret = new HashSet<>(); + for (Set s : sets) { + HashSet subset = new HashSet<>(); + for (Integer i : s) + subset.add(reverseMap.get(i)); + ret.add(subset); + } + return ret; + } + + private Set> unMapBinary(Collection> sets) { + Set> ret = new HashSet<>(); + for (List s : sets) { + HashSet subset = new HashSet<>(); + for (int i = 0; i < s.size(); i++) + if (s.get(i)) + subset.add(reverseMap.get(i)); + ret.add(subset); + } + return ret; + } + + private List> unMapListBinary(Collection> sets) { + List> ret = new ArrayList<>(); + for (List s : sets) { + List subset = new ArrayList<>(); + for (int i = 0; i < s.size(); i++) + if (s.get(i)) + subset.add(reverseMap.get(i)); + ret.add(subset); + } + return ret; + } + + private Set> addElementToAll(Set> powerSetSubSetWithoutElement, T element) { + Set> powerSetSubSetWithElement = new HashSet<>(); + for (Set subsetWithoutElement : powerSetSubSetWithoutElement) { + Set subsetWithElement = new HashSet<>(subsetWithoutElement); + subsetWithElement.add(element); + powerSetSubSetWithElement.add(subsetWithElement); + } + return powerSetSubSetWithElement; + } + + private Set getSubSetWithoutElement(Set set, T element) { + Set subsetWithoutElement = new HashSet<>(); + for (T s : set) { + if (!s.equals(element)) + subsetWithoutElement.add(s); + } + return subsetWithoutElement; + } +} diff --git a/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/powerset/PowerSetUtilityUnitTest.java b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/powerset/PowerSetUtilityUnitTest.java new file mode 100644 index 0000000000..0a20c36692 --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/powerset/PowerSetUtilityUnitTest.java @@ -0,0 +1,225 @@ +package com.baeldung.powerset; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; +import org.hamcrest.collection.IsCollectionWithSize; +import org.junit.Test; +import org.junit.jupiter.api.Assertions; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; + +public class PowerSetUtilityUnitTest { + + @Test + public void givenSet_WhenGuavaLibraryGeneratePowerSet_ThenItContainsAllSubsets() { + ImmutableSet set = ImmutableSet.of("APPLE", "ORANGE", "MANGO"); + Set> powerSet = Sets.powerSet(set); + Assertions.assertEquals((1 << set.size()), powerSet.size()); + MatcherAssert.assertThat(powerSet, Matchers.containsInAnyOrder( + ImmutableSet.of(), + ImmutableSet.of("APPLE"), + ImmutableSet.of("ORANGE"), + ImmutableSet.of("APPLE", "ORANGE"), + ImmutableSet.of("MANGO"), + ImmutableSet.of("APPLE", "MANGO"), + ImmutableSet.of("ORANGE", "MANGO"), + ImmutableSet.of("APPLE", "ORANGE", "MANGO") + )); + } + + @Test + public void givenSet_WhenPowerSetIsLazyLoadGenerated_ThenItContainsAllSubsets() { + Set set = RandomSetOfStringGenerator.generateRandomSet(); + Set> powerSet = new PowerSetUtility().lazyLoadPowerSet(set); + + //To make sure that the size of power set is (2 power n) + MatcherAssert.assertThat(powerSet, IsCollectionWithSize.hasSize((1 << set.size()))); + //To make sure that number of occurrence of each element is (2 power n-1) + Map counter = new HashMap<>(); + for (Set subset : powerSet) { + for (String name : subset) { + int num = counter.getOrDefault(name, 0); + counter.put(name, num + 1); + } + } + counter.forEach((k, v) -> Assertions.assertEquals((1 << (set.size() - 1)), v.intValue())); + } + + @Test + public void givenSet_WhenPowerSetIsCalculated_ThenItContainsAllSubsets() { + Set set = RandomSetOfStringGenerator.generateRandomSet(); + + Set> powerSet = new PowerSetUtility().recursivePowerSet(set); + + //To make sure that the size of power set is (2 power n) + MatcherAssert.assertThat(powerSet, IsCollectionWithSize.hasSize((1 << set.size()))); + //To make sure that number of occurrence of each element is (2 power n-1) + Map counter = new HashMap<>(); + for (Set subset : powerSet) { + for (String name : subset) { + int num = counter.getOrDefault(name, 0); + counter.put(name, num + 1); + } + } + counter.forEach((k, v) -> Assertions.assertEquals((1 << (set.size() - 1)), v.intValue())); + } + + @Test + public void givenSet_WhenPowerSetIsCalculatedRecursiveByIndexRepresentation_ThenItContainsAllSubsets() { + Set set = RandomSetOfStringGenerator.generateRandomSet(); + + Set> powerSet = new PowerSetUtility().recursivePowerSetIndexRepresentation(set); + + //To make sure that the size of power set is (2 power n) + MatcherAssert.assertThat(powerSet, IsCollectionWithSize.hasSize((1 << set.size()))); + //To make sure that number of occurrence of each element is (2 power n-1) + Map counter = new HashMap<>(); + for (Set subset : powerSet) { + for (String name : subset) { + int num = counter.getOrDefault(name, 0); + counter.put(name, num + 1); + } + } + counter.forEach((k, v) -> Assertions.assertEquals((1 << (set.size() - 1)), v.intValue())); + } + + @Test + public void givenSet_WhenPowerSetIsCalculatedRecursiveByBinaryRepresentation_ThenItContainsAllSubsets() { + Set set = RandomSetOfStringGenerator.generateRandomSet(); + + Set> powerSet = new PowerSetUtility().recursivePowerSetBinaryRepresentation(set); + + //To make sure that the size of power set is (2 power n) + MatcherAssert.assertThat(powerSet, IsCollectionWithSize.hasSize((1 << set.size()))); + //To make sure that number of occurrence of each element is (2 power n-1) + Map counter = new HashMap<>(); + for (Set subset : powerSet) { + for (String name : subset) { + int num = counter.getOrDefault(name, 0); + counter.put(name, num + 1); + } + } + counter.forEach((k, v) -> Assertions.assertEquals((1 << (set.size() - 1)), v.intValue())); + } + + @Test + public void givenSet_WhenPowerSetIsCalculatedIterativePowerSetByLoopOverNumbers_ThenItContainsAllSubsets() { + Set set = RandomSetOfStringGenerator.generateRandomSet(); + + List> powerSet = new PowerSetUtility().iterativePowerSetByLoopOverNumbers(set); + + //To make sure that the size of power set is (2 power n) + MatcherAssert.assertThat(powerSet, IsCollectionWithSize.hasSize((1 << set.size()))); + //To make sure that number of occurrence of each element is (2 power n-1) + Map counter = new HashMap<>(); + for (List subset : powerSet) { + for (String name : subset) { + int num = counter.getOrDefault(name, 0); + counter.put(name, num + 1); + } + } + counter.forEach((k, v) -> Assertions.assertEquals((1 << (set.size() - 1)), v.intValue())); + //To make sure that one subset is not generated twice + Assertions.assertEquals(powerSet.size(), new HashSet<>(powerSet).size()); + //To make sure that each element in each subset is occurred once + for (List subset : powerSet) { + Assertions.assertEquals(subset.size(), new HashSet<>(subset).size()); + } + } + + @Test + public void givenSet_WhenPowerSetIsCalculatedIterativePowerSetByLoopOverNumbersMinimalChange_ThenItContainsAllSubsetsInGrayOrder() { + + Set set = RandomSetOfStringGenerator.generateRandomSet(); + List> powerSet = new PowerSetUtility().iterativePowerSetByLoopOverNumbersMinimalChange(set); + + //To make sure that the size of power set is (2 power n) + MatcherAssert.assertThat(powerSet, IsCollectionWithSize.hasSize((1 << set.size()))); + //To make sure that number of occurrence of each element is (2 power n-1) + Map counter = new HashMap<>(); + for (List subset : powerSet) { + for (String name : subset) { + int num = counter.getOrDefault(name, 0); + counter.put(name, num + 1); + } + } + counter.forEach((k, v) -> Assertions.assertEquals((1 << (set.size() - 1)), v.intValue())); + //To make sure that one subset is not generated twice + Assertions.assertEquals(powerSet.size(), new HashSet<>(powerSet).size()); + //To make sure that each element in each subset is occurred once + for (List subset : powerSet) { + Assertions.assertEquals(subset.size(), new HashSet<>(subset).size()); + } + //To make sure that difference of consecutive subsets is exactly 1 + for(int i=1; i 0); + } + Assertions.assertEquals(i, PowerSetUtility.getRankInLexicographicalOrder(Arrays.asList(subset))); + } + } + + @Test + public void givenRanking_WhenPowerSetIsInLexicographicalOrder_ReturnTheSubset() { + int n = new Random().nextInt(5) + 5; //a number in [5, 10) + List> powerSet = new ArrayList<>(); + for(int i = 0; i < (1 << n); i++) { + powerSet.add(PowerSetUtility.getSubsetForRankInLexicographicalOrder(i, n)); + } + //To make sure that the size of power set is (2 power n) + MatcherAssert.assertThat(powerSet, IsCollectionWithSize.hasSize((1 << n))); + //To make sure that number of occurrence of each index is (2 power n-1) + Map counter = new HashMap<>(); + for (List subset : powerSet) { + for (int i = 0; i < subset.size(); i++) { + if(subset.get(i)) { + int num = counter.getOrDefault(i, 0); + counter.put(i, num + 1); + } + } + } + counter.forEach((k, v) -> Assertions.assertEquals((1 << (n - 1)), v.intValue())); + //To make sure that one subset is not generated twice + Assertions.assertEquals(powerSet.size(), new HashSet<>(powerSet).size()); + } + + static class RandomSetOfStringGenerator { + private static List fruits = Arrays.asList("Apples", "Avocados", "Banana", "Blueberry", "Cherry", "Clementine", "Cucumber", "Date", "Fig", + "Grapefruit"/*, "Grape", "Kiwi", "Lemon", "Mango", "Mulberry", "Melon", "Nectarine", "Olive", "Orange"*/); + + static Set generateRandomSet() { + Set set = new HashSet<>(); + Random random = new Random(); + int size = random.nextInt(fruits.size()); + while (set.size() != size) { + set.add(fruits.get(random.nextInt(fruits.size()))); + } + return set; + } + } +} diff --git a/core-java-modules/core-java-lang-operators/README.md b/core-java-modules/core-java-lang-operators/README.md index 1fe524948c..3af2c8885b 100644 --- a/core-java-modules/core-java-lang-operators/README.md +++ b/core-java-modules/core-java-lang-operators/README.md @@ -11,4 +11,5 @@ This module contains articles about Java operators - [Java Compound Operators](https://www.baeldung.com/java-compound-operators) - [The XOR Operator in Java](https://www.baeldung.com/java-xor-operator) - [Java Bitwise Operators](https://www.baeldung.com/java-bitwise-operators) +- [Bitwise & vs Logical && Operators](https://www.baeldung.com/bitwise-vs-logical-operators/) diff --git a/core-java-modules/core-java-lang-operators/src/test/java/com/baeldung/andoperators/BitwiseAndLogicalANDOperatorsUnitTest.java b/core-java-modules/core-java-lang-operators/src/test/java/com/baeldung/andoperators/BitwiseAndLogicalANDOperatorsUnitTest.java new file mode 100644 index 0000000000..6158c2870d --- /dev/null +++ b/core-java-modules/core-java-lang-operators/src/test/java/com/baeldung/andoperators/BitwiseAndLogicalANDOperatorsUnitTest.java @@ -0,0 +1,71 @@ +package com.baeldung.andoperators; + +import org.junit.jupiter.api.Test; + +import static org.junit.Assert.*; + +public class BitwiseAndLogicalANDOperatorsUnitTest { + + @Test + public void givenTwoTrueBooleans_whenBitwiseAndOperator_thenTrue() { + boolean trueBool = true; + boolean anotherTrueBool = true; + boolean trueANDTrue = trueBool & anotherTrueBool; + assertTrue(trueANDTrue); + } + + @Test + public void givenOneFalseAndOneTrueBooleans_whenBitwiseAndOperator_thenFalse() { + boolean trueBool = true; + boolean falseBool = false; + boolean trueANDFalse = trueBool & falseBool; + assertFalse(trueANDFalse); + } + + @Test + public void givenTwoFalseBooleans_whenBitwiseAndOperator_thenFalse() { + boolean falseBool = false; + boolean anotherFalseBool = false; + boolean falseANDFalse = falseBool & anotherFalseBool; + assertFalse(falseANDFalse); + } + + @Test + public void givenTwoIntegers_whenBitwiseAndOperator_thenNewDecimalNumber() { + int six = 6; + int five = 5; + int shouldBeFour = six & five; + assertEquals(4, shouldBeFour); + } + + @Test + public void givenTwoTrueBooleans_whenLogicalAndOperator_thenTrue() { + boolean trueBool = true; + boolean anotherTrueBool = true; + boolean trueANDTrue = trueBool && anotherTrueBool; + assertTrue(trueANDTrue); + } + + @Test + public void givenOneFalseAndOneTrueBooleans_whenLogicalAndOperator_thenFalse() { + boolean trueBool = true; + boolean falseBool = false; + boolean trueANDFalse = trueBool && falseBool; + assertFalse(trueANDFalse); + } + + @Test + public void givenTwoFalseBooleans_whenLogicalAndOperator_thenFalse() { + boolean falseBool = false; + boolean anotherFalseBool = false; + boolean falseANDFalse = falseBool && anotherFalseBool; + assertFalse(falseANDFalse); + } + + @Test + public void givenTwoFalseExpressions_whenLogicalAndOperator_thenShortCircuitFalse() { + boolean shortCircuitResult = (2<1) && (4<5); + assertFalse(shortCircuitResult); + } + +} diff --git a/core-java-modules/core-java-lang-syntax-2/src/main/java/com/baeldung/core/operators/notoperator/NotOperator.java b/core-java-modules/core-java-lang-syntax-2/src/main/java/com/baeldung/core/operators/notoperator/NotOperator.java new file mode 100644 index 0000000000..4e0cf98ff2 --- /dev/null +++ b/core-java-modules/core-java-lang-syntax-2/src/main/java/com/baeldung/core/operators/notoperator/NotOperator.java @@ -0,0 +1,99 @@ +package com.baeldung.core.operators.notoperator; + +/** + * Examples used in the article `Using the Not Operator in If Conditions in Java`. + */ +public class NotOperator { + + public static void ifElseStatementExample() { + boolean isValid = true; + + if (isValid) { + System.out.println("Valid"); + } else { + System.out.println("Invalid"); + } + } + + public static void checkIsValidIsFalseWithEmptyIfBlock() { + boolean isValid = true; + + if (isValid) { + + } else { + System.out.println("Invalid"); + } + } + + public static void checkIsValidIsFalseWithJustTheIfBlock() { + boolean isValid = true; + + if (isValid == false) { + System.out.println("Invalid"); + } + } + + public static void checkIsValidIsFalseWithTheNotOperator() { + boolean isValid = true; + + if (!isValid) { + System.out.println("Invalid"); + } + } + + public static void notOperatorWithBooleanValueAsOperand() { + System.out.println(!true); // prints false + System.out.println(!false); // prints true + System.out.println(!!false); // prints false + } + + public static void applyNotOperatorToAnExpression_example1() { + int count = 2; + + System.out.println(!(count > 2)); // prints true + System.out.println(!(count <= 2)); // prints false + } + + public static void applyNotOperatorToAnExpression_LogicalOperators() { + boolean x = true; + boolean y = false; + + System.out.println(!(x && y)); // prints true + System.out.println(!(x || y)); // prints false + } + + public static void precedence_example() { + boolean x = true; + boolean y = false; + + System.out.println(!x && y); // prints false + System.out.println(!(x && y)); // prints true + } + + public static void pitfalls_ComplexConditionsExample() { + int count = 9; + int total = 100; + + if (!(count >= 10 || total >= 1000)) { + System.out.println("Some more work to do"); + } + } + + public static void pitfalls_simplifyComplexConditionsByReversingLogicExample() { + int count = 9; + int total = 100; + + if (count < 10 && total < 1000) { + System.out.println("Some more work to do"); + } + } + + public static void exitEarlyExample() { + boolean isValid = false; + + if(!isValid) { + throw new IllegalArgumentException("Invalid input"); + } + // Code to execute when isValid == true goes here + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/CombiningUnitTest.java b/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/CombiningUnitTest.java new file mode 100644 index 0000000000..c98eef5ed1 --- /dev/null +++ b/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/CombiningUnitTest.java @@ -0,0 +1,57 @@ +package com.baeldung.branchprediction; + +import java.util.stream.LongStream; + +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CombiningUnitTest { + private static final Logger LOG = LoggerFactory.getLogger(CombiningUnitTest.class); + + public static final int TOP = 10000000; + public static final double FRACTION = 0.1; + + @Test + public void combined() { + long[] first = LongStream.range(0, TOP) + .map(n -> Math.random() < FRACTION ? 0 : n) + .toArray(); + long[] second = LongStream.range(0, TOP) + .map(n -> Math.random() < FRACTION ? 0 : n) + .toArray(); + + long count = 0; + long start = System.currentTimeMillis(); + for (int i = 0; i < TOP; i++) { + if (first[i] * second[i] != 0) { + ++count; + } + } + long end = System.currentTimeMillis(); + + LOG.info("Counted {}/{} numbers using combined mode in {}ms", count, TOP, end - start); + + } + + @Test + public void separate() { + long[] first = LongStream.range(0, TOP) + .map(n -> Math.random() < FRACTION ? 0 : n) + .toArray(); + long[] second = LongStream.range(0, TOP) + .map(n -> Math.random() < FRACTION ? 0 : n) + .toArray(); + + long count = 0; + long start = System.currentTimeMillis(); + for (int i = 0; i < TOP; i++) { + if (first[i] != 0 && second[i] != 0) { + ++count; + } + } + long end = System.currentTimeMillis(); + + LOG.info("Counted {}/{} numbers using separate mode in {}ms", count, TOP, end - start); + } +} diff --git a/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/IfUnitTest.java b/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/IfUnitTest.java new file mode 100644 index 0000000000..6f80624502 --- /dev/null +++ b/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/IfUnitTest.java @@ -0,0 +1,92 @@ +package com.baeldung.branchprediction; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.LongStream; + +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class IfUnitTest { + private static final Logger LOG = LoggerFactory.getLogger(IfUnitTest.class); + + public static final int TOP = 10000000; + + @Test + public void majorBranchSorted() { + test(TOP, 0.9, false); + } + + @Test + public void minorBranchSorted() { + test(TOP, 0.1, false); + } + + @Test + public void equalBranchSorted() { + test(TOP, 0.5, false); + } + + @Test + public void allBranchSorted() { + test(TOP, 1, false); + } + + @Test + public void noneBranchSorted() { + test(TOP, 0, false); + } + + @Test + public void majorBranchShuffled() { + test(TOP, 0.9, true); + } + + @Test + public void minorBranchShuffled() { + test(TOP, 0.1, true); + } + + @Test + public void equalBranchShuffled() { + test(TOP, 0.5, true); + } + + @Test + public void allBranchShuffled() { + test(TOP, 1, true); + } + + @Test + public void noneBranchShuffled() { + test(TOP, 0, true); + } + + private void test(long top, double cutoffPercentage, boolean shuffle) { + List numbers = LongStream.range(0, top) + .boxed() + .collect(Collectors.toList()); + if (shuffle) { + Collections.shuffle(numbers); + } + + long cutoff = (long)(top * cutoffPercentage); + long low = 0; + long high = 0; + + long start = System.currentTimeMillis(); + for (Long number : numbers) { + if (number < cutoff) { + ++low; + } else { + ++high; + } + } + long end = System.currentTimeMillis(); + + LOG.info("Counted {}/{} {} numbers in {}ms", low, high, shuffle ? "shuffled" : "sorted", end - start); + + } +} diff --git a/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/SortingUnitTest.java b/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/SortingUnitTest.java new file mode 100644 index 0000000000..6af40bd57a --- /dev/null +++ b/core-java-modules/core-java-perf/src/test/java/com/baeldung/branchprediction/SortingUnitTest.java @@ -0,0 +1,60 @@ +package com.baeldung.branchprediction; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.LongStream; + +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SortingUnitTest { + private static final Logger LOG = LoggerFactory.getLogger(SortingUnitTest.class); + public static final int BIG = 10000000; + public static final int SMALL = 100000; + + @Test + public void sortedBig() { + test(BIG, false); + } + + @Test + public void shuffledBig() { + test(BIG, true); + } + + @Test + public void sortedSmall() { + test(SMALL, false); + } + + @Test + public void shuffledSmall() { + test(SMALL, true); + } + + private void test(long top, boolean shuffle) { + List numbers = LongStream.range(0, top) + .boxed() + .collect(Collectors.toList()); + + if (shuffle) { + Collections.shuffle(numbers); + } + + long cutoff = top / 2; + long count = 0; + + long start = System.currentTimeMillis(); + for (Long number : numbers) { + if (number < cutoff) { + ++count; + } + } + long end = System.currentTimeMillis(); + + LOG.info("Counted {}/{} {} numbers in {}ms", + count, top, shuffle ? "shuffled" : "sorted", end - start); + } +} diff --git a/core-java-modules/core-java-security-manager/README.md b/core-java-modules/core-java-security-manager/README.md deleted file mode 100644 index a4abe7f80a..0000000000 --- a/core-java-modules/core-java-security-manager/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: - -- [Intro to the Java SecurityManager](https://www.baeldung.com/java-security-manager) diff --git a/core-java-modules/core-java-security-manager/pom.xml b/core-java-modules/core-java-security-manager/pom.xml deleted file mode 100644 index 52f1554ace..0000000000 --- a/core-java-modules/core-java-security-manager/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - core-java-security-manager - 0.1.0-SNAPSHOT - core-java-security-manager - jar - - - com.baeldung.core-java-modules - core-java-modules - 1.0.0-SNAPSHOT - - - diff --git a/core-java-modules/core-java-security-manager/src/test/java/com/baeldung/security/manager/SecurityManagerUnitTest.java b/core-java-modules/core-java-security-manager/src/test/java/com/baeldung/security/manager/SecurityManagerUnitTest.java deleted file mode 100644 index a845f233b5..0000000000 --- a/core-java-modules/core-java-security-manager/src/test/java/com/baeldung/security/manager/SecurityManagerUnitTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.security.manager; - -import org.junit.Test; - -import java.net.URL; -import java.security.AccessControlException; -import java.util.concurrent.Callable; - -public class SecurityManagerUnitTest { - - @Test(expected = AccessControlException.class) - public void whenSecurityManagerIsActive_thenNetworkIsNotAccessibleByDefault() throws Exception { - doTest(() -> { - new URL("http://www.google.com").openConnection().connect(); - return null; - }); - } - - @Test(expected = AccessControlException.class) - public void whenUnauthorizedClassTriesToAccessProtectedOperation_thenAnExceptionIsThrown() throws Exception { - doTest(() -> { - new Service().operation(); - return null; - }); - } - - private void doTest(Callable action) throws Exception { - System.setSecurityManager(new SecurityManager()); - try { - action.call(); - } finally { - System.setSecurityManager(null); - } - } -} diff --git a/core-java-modules/core-java-security/README.md b/core-java-modules/core-java-security/README.md index 7386d04e8e..ff9b1eef14 100644 --- a/core-java-modules/core-java-security/README.md +++ b/core-java-modules/core-java-security/README.md @@ -15,4 +15,5 @@ This module contains articles about core Java Security - [The Java SecureRandom Class](https://www.baeldung.com/java-secure-random) - [An Introduction to Java SASL](https://www.baeldung.com/java-sasl) - [A Guide to Java GSS API](https://www.baeldung.com/java-gss) +- [Intro to the Java SecurityManager](https://www.baeldung.com/java-security-manager) diff --git a/core-java-modules/core-java-security-manager/src/main/java/com/baeldung/security/manager/CustomPermission.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/securitymanager/CustomPermission.java similarity index 87% rename from core-java-modules/core-java-security-manager/src/main/java/com/baeldung/security/manager/CustomPermission.java rename to core-java-modules/core-java-security/src/main/java/com/baeldung/securitymanager/CustomPermission.java index 5f9c43336f..fa46353893 100644 --- a/core-java-modules/core-java-security-manager/src/main/java/com/baeldung/security/manager/CustomPermission.java +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/securitymanager/CustomPermission.java @@ -1,4 +1,4 @@ -package com.baeldung.security.manager; +package com.baeldung.securitymanager; import java.security.BasicPermission; diff --git a/core-java-modules/core-java-security-manager/src/main/java/com/baeldung/security/manager/Service.java b/core-java-modules/core-java-security/src/main/java/com/baeldung/securitymanager/Service.java similarity index 92% rename from core-java-modules/core-java-security-manager/src/main/java/com/baeldung/security/manager/Service.java rename to core-java-modules/core-java-security/src/main/java/com/baeldung/securitymanager/Service.java index 1b9f14e3b8..21e0c0a657 100644 --- a/core-java-modules/core-java-security-manager/src/main/java/com/baeldung/security/manager/Service.java +++ b/core-java-modules/core-java-security/src/main/java/com/baeldung/securitymanager/Service.java @@ -1,4 +1,4 @@ -package com.baeldung.security.manager; +package com.baeldung.securitymanager; public class Service { diff --git a/core-java-modules/core-java-security/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java b/core-java-modules/core-java-security/src/test/java/com/baeldung/java/md5/JavaMD5UnitTest.java similarity index 98% rename from core-java-modules/core-java-security/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java rename to core-java-modules/core-java-security/src/test/java/com/baeldung/java/md5/JavaMD5UnitTest.java index 55e71470c8..67d6918c09 100644 --- a/core-java-modules/core-java-security/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java +++ b/core-java-modules/core-java-security/src/test/java/com/baeldung/java/md5/JavaMD5UnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.md5; +package com.baeldung.java.md5; import static org.assertj.core.api.Assertions.assertThat; diff --git a/core-java-modules/core-java-security/src/test/java/com/baeldung/securitymanager/SecurityManagerUnitTest.java b/core-java-modules/core-java-security/src/test/java/com/baeldung/securitymanager/SecurityManagerUnitTest.java new file mode 100644 index 0000000000..a7dcc949d2 --- /dev/null +++ b/core-java-modules/core-java-security/src/test/java/com/baeldung/securitymanager/SecurityManagerUnitTest.java @@ -0,0 +1,35 @@ +package com.baeldung.securitymanager; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.net.URL; +import java.security.AccessControlException; + +public class SecurityManagerUnitTest { + + private static final String TESTING_SECURITY_POLICY = "file:src/test/resources/testing.policy"; + + @Before + public void setUp() { + System.setProperty("java.security.policy", TESTING_SECURITY_POLICY); + System.setSecurityManager(new SecurityManager()); + } + + @After + public void tearDown() { + System.setSecurityManager(null); + } + + @Test(expected = AccessControlException.class) + public void whenSecurityManagerIsActive_thenNetworkIsNotAccessibleByDefault() throws IOException { + new URL("http://www.google.com").openConnection().connect(); + } + + @Test(expected = AccessControlException.class) + public void whenUnauthorizedClassTriesToAccessProtectedOperation_thenAnExceptionIsThrown() { + new Service().operation(); + } +} diff --git a/core-java-modules/core-java-security/src/test/resources/testing.policy b/core-java-modules/core-java-security/src/test/resources/testing.policy new file mode 100644 index 0000000000..16ab8a1869 --- /dev/null +++ b/core-java-modules/core-java-security/src/test/resources/testing.policy @@ -0,0 +1,5 @@ +grant { + // This is for testing purposes only. + // It allows us to properly reset the security manager after the unit test completes. + permission java.lang.RuntimePermission "setSecurityManager"; +}; \ No newline at end of file diff --git a/core-java-modules/core-java-strings/src/test/java/com/baeldung/randomstrings/RandomStringsUnitTest.java b/core-java-modules/core-java-strings/src/test/java/com/baeldung/randomstrings/RandomStringsUnitTest.java index 2806635d03..edfabc8777 100644 --- a/core-java-modules/core-java-strings/src/test/java/com/baeldung/randomstrings/RandomStringsUnitTest.java +++ b/core-java-modules/core-java-strings/src/test/java/com/baeldung/randomstrings/RandomStringsUnitTest.java @@ -1,72 +1,103 @@ -package com.baeldung.randomstrings; - -import org.apache.commons.lang3.RandomStringUtils; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.nio.charset.Charset; -import java.util.Random; - -public class RandomStringsUnitTest { - - private static final Logger LOG = LoggerFactory.getLogger(RandomStringsUnitTest.class); - - @Test - public void givenUsingPlainJava_whenGeneratingRandomStringUnbounded_thenCorrect() { - final byte[] array = new byte[7]; // length is bounded by 7 - new Random().nextBytes(array); - final String generatedString = new String(array, Charset.forName("UTF-8")); - - LOG.debug(generatedString); - } - - @Test - public void givenUsingPlainJava_whenGeneratingRandomStringBounded_thenCorrect() { - final int leftLimit = 97; // letter 'a' - final int rightLimit = 122; // letter 'z' - final int targetStringLength = 10; - final Random random = new Random(); - final StringBuilder buffer = new StringBuilder(targetStringLength); - - for (int i = 0; i < targetStringLength; i++) { - final int randomLimitedInt = leftLimit + (int) (random.nextFloat() * (rightLimit - leftLimit + 1)); - buffer.append((char) randomLimitedInt); - } - final String generatedString = buffer.toString(); - - LOG.debug(generatedString); - } - - @Test - public void givenUsingApache_whenGeneratingRandomString_thenCorrect() { - final String generatedString = RandomStringUtils.random(10); - - LOG.debug(generatedString); - } - - @Test - public void givenUsingApache_whenGeneratingRandomAlphabeticString_thenCorrect() { - final String generatedString = RandomStringUtils.randomAlphabetic(10); - - LOG.debug(generatedString); - } - - @Test - public void givenUsingApache_whenGeneratingRandomAlphanumericString_thenCorrect() { - final String generatedString = RandomStringUtils.randomAlphanumeric(10); - - LOG.debug(generatedString); - } - - @Test - public void givenUsingApache_whenGeneratingRandomStringBounded_thenCorrect() { - final int length = 10; - final boolean useLetters = true; - final boolean useNumbers = false; - final String generatedString = RandomStringUtils.random(length, useLetters, useNumbers); - - LOG.debug(generatedString); - } - -} +package com.baeldung.randomstrings; + +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.nio.charset.Charset; +import java.util.Random; + +public class RandomStringsUnitTest { + + private static final Logger LOG = LoggerFactory.getLogger(RandomStringsUnitTest.class); + + @Test + public void givenUsingPlainJava_whenGeneratingRandomStringUnbounded_thenCorrect() { + byte[] array = new byte[7]; // length is bounded by 7 + new Random().nextBytes(array); + String generatedString = new String(array, Charset.forName("UTF-8")); + + LOG.debug(generatedString); + } + + @Test + public void givenUsingPlainJava_whenGeneratingRandomStringBounded_thenCorrect() { + int leftLimit = 97; // letter 'a' + int rightLimit = 122; // letter 'z' + int targetStringLength = 10; + Random random = new Random(); + StringBuilder buffer = new StringBuilder(targetStringLength); + + for (int i = 0; i < targetStringLength; i++) { + int randomLimitedInt = leftLimit + (int) (random.nextFloat() * (rightLimit - leftLimit + 1)); + buffer.append((char) randomLimitedInt); + } + String generatedString = buffer.toString(); + + LOG.debug(generatedString); + } + + @Test + public void givenUsingJava8_whenGeneratingRandomAlphabeticString_thenCorrect() { + int leftLimit = 97; // letter 'a' + int rightLimit = 122; // letter 'z' + int targetStringLength = 10; + Random random = new Random(); + + String generatedString = random.ints(leftLimit, rightLimit + 1) + .limit(targetStringLength) + .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) + .toString(); + + LOG.debug(generatedString); + } + + @Test + public void givenUsingJava8_whenGeneratingRandomAlphanumericString_thenCorrect() { + int leftLimit = 48; // numeral '0' + int rightLimit = 122; // letter 'z' + int targetStringLength = 10; + Random random = new Random(); + + String generatedString = random.ints(leftLimit, rightLimit + 1) + .filter(i -> (i <= 57 || i >= 65) && (i <= 90 || i >= 97)) + .limit(targetStringLength) + .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) + .toString(); + + LOG.debug(generatedString); + } + + @Test + public void givenUsingApache_whenGeneratingRandomString_thenCorrect() { + String generatedString = RandomStringUtils.random(10); + + LOG.debug(generatedString); + } + + @Test + public void givenUsingApache_whenGeneratingRandomAlphabeticString_thenCorrect() { + String generatedString = RandomStringUtils.randomAlphabetic(10); + + LOG.debug(generatedString); + } + + @Test + public void givenUsingApache_whenGeneratingRandomAlphanumericString_thenCorrect() { + String generatedString = RandomStringUtils.randomAlphanumeric(10); + + LOG.debug(generatedString); + } + + @Test + public void givenUsingApache_whenGeneratingRandomStringBounded_thenCorrect() { + int length = 10; + boolean useLetters = true; + boolean useNumbers = false; + String generatedString = RandomStringUtils.random(length, useLetters, useNumbers); + + LOG.debug(generatedString); + } + +} diff --git a/core-java-modules/core-java-text/pom.xml b/core-java-modules/core-java-text/pom.xml index 640b90764a..442fecd298 100644 --- a/core-java-modules/core-java-text/pom.xml +++ b/core-java-modules/core-java-text/pom.xml @@ -14,6 +14,19 @@ ../../parent-java + + + org.openjdk.jmh + jmh-core + ${jmh-core.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh-core.version} + + + core-java-text diff --git a/core-java-modules/core-java-text/src/main/java/com/baeldung/patternreuse/PatternPerformanceComparison.java b/core-java-modules/core-java-text/src/main/java/com/baeldung/patternreuse/PatternPerformanceComparison.java new file mode 100644 index 0000000000..01f8df9ec6 --- /dev/null +++ b/core-java-modules/core-java-text/src/main/java/com/baeldung/patternreuse/PatternPerformanceComparison.java @@ -0,0 +1,92 @@ +package com.baeldung.patternreuse; + +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.infra.Blackhole; +import org.openjdk.jmh.runner.RunnerException; + +import java.io.IOException; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Fork(value = 1, warmups = 1) +@Warmup(iterations = 5) +@State(Scope.Benchmark) +public class PatternPerformanceComparison { + + private static final String PATTERN = "\\d*[02468]"; + private static List values; + + private static Matcher matcherFromPreCompiledPattern; + private static Pattern preCompiledPattern; + + public static void main(String[] args) throws IOException, RunnerException { + org.openjdk.jmh.Main.main(args); + } + + @Benchmark + public void matcherFromPreCompiledPatternResetMatches(Blackhole bh) { + //With pre-compiled pattern and reusing the matcher + // 1 Pattern object created + // 1 Matcher objects created + for (String value : values) { + bh.consume(matcherFromPreCompiledPattern.reset(value).matches()); + } + } + + @Benchmark + public void preCompiledPatternMatcherMatches(Blackhole bh) { + // With pre-compiled pattern + // 1 Pattern object created + // 5_000_000 Matcher objects created + for (String value : values) { + bh.consume(preCompiledPattern.matcher(value).matches()); + } + } + + @Benchmark + public void patternCompileMatcherMatches(Blackhole bh) { + // Above approach "Pattern.matches(PATTERN, value)" makes this internally + // 5_000_000 Pattern objects created + // 5_000_000 Matcher objects created + for (String value : values) { + bh.consume(Pattern.compile(PATTERN).matcher(value).matches()); + } + } + + @Benchmark + public void patternMatches(Blackhole bh) { + // Above approach "value.matches(PATTERN)" makes this internally + // 5_000_000 Pattern objects created + // 5_000_000 Matcher objects created + for (String value : values) { + bh.consume(Pattern.matches(PATTERN, value)); + } + } + + @Benchmark + public void stringMatchs(Blackhole bh) { + // 5_000_000 Pattern objects created + // 5_000_000 Matcher objects created + Instant start = Instant.now(); + for (String value : values) { + bh.consume(value.matches(PATTERN)); + } + } + + @Setup() + public void setUp() { + preCompiledPattern = Pattern.compile(PATTERN); + matcherFromPreCompiledPattern = preCompiledPattern.matcher(""); + + values = new ArrayList<>(); + for (int x = 1; x <= 5_000_000; x++) { + values.add(String.valueOf(x)); + } + } +} diff --git a/core-java-modules/core-java-text/src/test/java/com/baeldung/patternreuse/PatternUnitTest.java b/core-java-modules/core-java-text/src/test/java/com/baeldung/patternreuse/PatternUnitTest.java new file mode 100644 index 0000000000..c7331471ec --- /dev/null +++ b/core-java-modules/core-java-text/src/test/java/com/baeldung/patternreuse/PatternUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.patternreuse; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.junit.Assert.*; + +public class PatternUnitTest { + + private static final Pattern FIRST_LAST_NAME_PRE_COMPILED_PATTERN = Pattern.compile("[a-zA-Z]{3,} [a-zA-Z]{3,}"); + private static final Pattern SPLIT_PRE_COMPILED_PATTERN = Pattern.compile("__"); + + @Test + public void givenPreCompiledPattern_whenCallMatcher_thenReturnAMatcherToMatches() { + Matcher matcherName1 = FIRST_LAST_NAME_PRE_COMPILED_PATTERN.matcher("Fabio Silva"); + Matcher matcherName2 = FIRST_LAST_NAME_PRE_COMPILED_PATTERN.matcher("Mr. Silva"); + + boolean matchesName1 = matcherName1.matches(); + boolean matchesName2 = matcherName2.matches(); + + assertTrue(matchesName1); + assertFalse(matchesName2); + } + + @Test + public void givenPreCompiledPattern_whenCallAsPredicate_thenReturnPredicateToFindPatternInTheList() { + List namesToValidate = Arrays.asList("Fabio Silva", "Mr. Silva"); + Predicate patternsAsPredicate = FIRST_LAST_NAME_PRE_COMPILED_PATTERN.asPredicate(); + + List validNames = namesToValidate.stream() + .filter(patternsAsPredicate) + .collect(Collectors.toList()); + + assertEquals(1, validNames.size()); + assertTrue(validNames.contains("Fabio Silva")); + } + + @Test + public void givenPreCompiledPattern_whenCallSplit_thenReturnArrayWithValuesSplitByThePattern() { + String[] textSplit = SPLIT_PRE_COMPILED_PATTERN.split("My_Name__is__Fabio_Silva"); + + assertEquals("My_Name", textSplit[0]); + assertEquals("is", textSplit[1]); + assertEquals("Fabio_Silva", textSplit[2]); + } + + @Test + public void givenPreCompiledPattern_whenCallSplitAsStream_thenReturnArraySplitByThePattern() { + Stream textSplitAsStream = SPLIT_PRE_COMPILED_PATTERN.splitAsStream("My_Name__is__Fabio_Silva"); + String[] textSplit = textSplitAsStream.toArray(String[]::new); + + assertEquals("My_Name", textSplit[0]); + assertEquals("is", textSplit[1]); + assertEquals("Fabio_Silva", textSplit[2]); + } +} diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index dcc98d77f6..1dadbf1efa 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -18,7 +18,6 @@ core-java-optional core-java-lang-operators core-java-networking-2 - core-java-security-manager core-java-date-operations diff --git a/core-kotlin-2/README.md b/core-kotlin-2/README.md index 5a443c1831..5249262fa3 100644 --- a/core-kotlin-2/README.md +++ b/core-kotlin-2/README.md @@ -4,11 +4,11 @@ This module contains articles about core Kotlin. ### Relevant articles: -- [Void Type in Kotlin](https://www.baeldung.com/kotlin-void-type) -- [How to use Kotlin Range Expressions](https://www.baeldung.com/kotlin-ranges) -- [Creating a Kotlin Range Iterator on a Custom Object](https://www.baeldung.com/kotlin-custom-range-iterator) - [Kotlin Scope Functions](https://www.baeldung.com/kotlin-scope-functions) - [Kotlin Annotations](https://www.baeldung.com/kotlin-annotations) - [Split a List into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts) +- [String Comparison in Kotlin](https://www.baeldung.com/kotlin-string-comparison) +- [Guide to JVM Platform Annotations in Kotlin](https://www.baeldung.com/kotlin-jvm-annotations) - [Finding an Element in a List Using Kotlin](https://www.baeldung.com/kotlin-finding-element-in-list) +- [Kotlin Ternary Conditional Operator](https://www.baeldung.com/kotlin-ternary-conditional-operator) - More articles: [[<-- prev]](/core-kotlin) diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/ternary/TernaryOperatorTest.kt b/core-kotlin-2/src/test/kotlin/com/baeldung/ternary/TernaryOperatorTest.kt new file mode 100644 index 0000000000..21dfdd2ae0 --- /dev/null +++ b/core-kotlin-2/src/test/kotlin/com/baeldung/ternary/TernaryOperatorTest.kt @@ -0,0 +1,24 @@ +package com.baeldung.ternary + +import org.junit.Test +import kotlin.test.assertEquals + +class TernaryOperatorTest { + + @Test + fun `using If`() { + val a = true + val result = if (a) "yes" else "no" + assertEquals("yes", result) + } + + @Test + fun `using When`() { + val a = true + val result = when(a) { + true -> "yes" + false -> "no" + } + assertEquals("yes", result) + } +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-advanced/README.md b/core-kotlin-modules/core-kotlin-advanced/README.md new file mode 100644 index 0000000000..2e99e3b078 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-advanced/README.md @@ -0,0 +1,11 @@ +## Core Kotlin Advanced + +This module contains articles about advanced topics in Kotlin. + +### Relevant articles: +- [Building DSLs in Kotlin](https://www.baeldung.com/kotlin-dsl) +- [Regular Expressions in Kotlin](https://www.baeldung.com/kotlin-regular-expressions) +- [Idiomatic Logging in Kotlin](https://www.baeldung.com/kotlin-logging) +- [Mapping of Data Objects in Kotlin](https://www.baeldung.com/kotlin-data-objects) +- [Reflection with Kotlin](https://www.baeldung.com/kotlin-reflection) +- [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) diff --git a/core-kotlin-modules/core-kotlin-advanced/pom.xml b/core-kotlin-modules/core-kotlin-advanced/pom.xml new file mode 100644 index 0000000000..5ddfef23cc --- /dev/null +++ b/core-kotlin-modules/core-kotlin-advanced/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + core-kotlin-advanced + core-kotlin-advanced + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + + + 1.3.30 + 3.10.0 + + + \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/contract/CallsInPlaceEffect.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/contract/CallsInPlaceEffect.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/contract/CallsInPlaceEffect.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/contract/CallsInPlaceEffect.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/contract/ReturnsEffect.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/contract/ReturnsEffect.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/contract/ReturnsEffect.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/contract/ReturnsEffect.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/User.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/User.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/datamapping/User.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/User.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt similarity index 82% rename from core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt index 6113ed3591..1f3d7f3b47 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt @@ -3,10 +3,10 @@ package com.baeldung.datamapping import kotlin.reflect.full.memberProperties fun User.toUserView() = UserView( - name = "$firstName $lastName", - address = "$street $houseNumber", - telephone = phone, - age = age + name = "$firstName $lastName", + address = "$street $houseNumber", + telephone = phone, + age = age ) fun User.toUserViewReflection() = with(::UserView) { diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserView.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserView.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserView.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserView.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/dsl/SqlDsl.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/dsl/SqlDsl.kt similarity index 99% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/dsl/SqlDsl.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/dsl/SqlDsl.kt index 5296d301a3..207e9dbd53 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/dsl/SqlDsl.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/dsl/SqlDsl.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.dsl +package com.baeldung.dsl abstract class Condition { diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnAny.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnAny.kt similarity index 94% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnAny.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnAny.kt index 32d968fff5..01edf5e871 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnAny.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnAny.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging import org.slf4j.Logger diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnMarkerInterface.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnMarkerInterface.kt similarity index 95% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnMarkerInterface.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnMarkerInterface.kt index b33d4c9f93..8210361345 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnMarkerInterface.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnMarkerInterface.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsProperty.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsProperty.kt similarity index 88% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsProperty.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsProperty.kt index 979b3b3a10..60ac0800e2 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsProperty.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsProperty.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging open class LoggerAsProperty { private val logger = getLogger(javaClass) diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsPropertyDelegate.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsPropertyDelegate.kt similarity index 92% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsPropertyDelegate.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsPropertyDelegate.kt index 23f04722be..83cde2b446 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsPropertyDelegate.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsPropertyDelegate.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging import org.slf4j.Logger import kotlin.properties.ReadOnlyProperty @@ -43,5 +43,5 @@ fun main(args: Array) { class LoggerDelegate : ReadOnlyProperty { override fun getValue(thisRef: R, property: KProperty<*>) = - getLogger(getClassForLogging(thisRef.javaClass)) + getLogger(getClassForLogging(thisRef.javaClass)) } diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerInCompanionObject.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerInCompanionObject.kt similarity index 97% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerInCompanionObject.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerInCompanionObject.kt index f973606369..6a44675e45 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerInCompanionObject.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerInCompanionObject.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging open class LoggerInCompanionObject { companion object { diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/Util.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/Util.kt similarity index 91% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/Util.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/Util.kt index b9c0d9e34c..44dba53cb7 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/Util.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/Util.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/core-kotlin/src/test/kotlin/com/baeldung/datamapping/UserTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/datamapping/UserTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/datamapping/UserTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/datamapping/UserTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/dsl/SqlDslTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/dsl/SqlDslTest.kt similarity index 97% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/dsl/SqlDslTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/dsl/SqlDslTest.kt index 55ae44e4dc..a370e7f15d 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/dsl/SqlDslTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/dsl/SqlDslTest.kt @@ -1,8 +1,7 @@ -package com.baeldung.kotlin.dsl +package com.baeldung.dsl import org.assertj.core.api.Assertions.assertThat import org.junit.Test -import java.lang.Exception class SqlDslTest { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/JavaReflectionTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/JavaReflectionTest.kt similarity index 95% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/JavaReflectionTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/JavaReflectionTest.kt index 0d0e7b724d..c77774dd81 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/JavaReflectionTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/JavaReflectionTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.reflection +package com.baeldung.reflection import org.junit.Ignore import org.junit.Test diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KClassTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KClassTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KClassTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KClassTest.kt index 56183b50be..f5d83cd13d 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KClassTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KClassTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.reflection +package com.baeldung.reflection import org.junit.Assert import org.junit.Ignore diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KMethodTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KMethodTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KMethodTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KMethodTest.kt index 17e9913731..b58c199a7c 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KMethodTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KMethodTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.reflection +package com.baeldung.reflection import org.junit.Assert import org.junit.Test diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/stdlib/RegexTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/regex/RegexTest.kt similarity index 95% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/stdlib/RegexTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/regex/RegexTest.kt index eeb587ee22..5cb54b4dda 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/stdlib/RegexTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/regex/RegexTest.kt @@ -1,12 +1,7 @@ -package com.baeldung.kotlin.stdlib +package com.baeldung.regex import org.junit.Test -import java.beans.ExceptionListener -import java.beans.XMLEncoder -import java.io.* -import java.lang.Exception import kotlin.test.* -import kotlin.text.RegexOption.* class RegexTest { diff --git a/core-kotlin-modules/core-kotlin-collections/README.md b/core-kotlin-modules/core-kotlin-collections/README.md new file mode 100644 index 0000000000..bbea5869af --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/README.md @@ -0,0 +1,10 @@ +## Core Kotlin Collections + +This module contains articles about core Kotlin collections. + +### Relevant articles: +- [Split a List Into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts) +- [Finding an Element in a List Using Kotlin](https://www.baeldung.com/kotlin-finding-element-in-list) +- [Overview of Kotlin Collections API](https://www.baeldung.com/kotlin-collections-api) +- [Converting a List to Map in Kotlin](https://www.baeldung.com/kotlin-list-to-map) +- [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) diff --git a/core-kotlin-modules/core-kotlin-collections/pom.xml b/core-kotlin-modules/core-kotlin-collections/pom.xml new file mode 100644 index 0000000000..52401d267c --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + core-kotlin-collections + core-kotlin-collections + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + + + 1.3.30 + 3.6.1 + 3.10.0 + + + \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/CollectionsTest.kt similarity index 99% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/CollectionsTest.kt index 59d6adccac..64b1f72eab 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/CollectionsTest.kt @@ -1,9 +1,9 @@ -package com.baeldung.kotlin +package com.baeldung.collections import org.junit.Test -import kotlin.test.assertTrue -import kotlin.test.assertFalse import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue class CollectionsTest { @@ -142,5 +142,5 @@ class CollectionsTest { val finalResult = theList.fold( 1000, { oldResult, currentItem -> oldResult + (currentItem *currentItem)}) print(finalResult) assertEquals(1091, finalResult) - } + } } \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/ChunkedTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/ChunkedTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/ChunkedTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/ChunkedTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/DistinctTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/DistinctTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/DistinctTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/DistinctTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/DropTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/DropTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/DropTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/DropTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/FilterTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/FilterTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/FilterTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/FilterTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/SliceTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/SliceTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/SliceTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/SliceTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/TakeTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/TakeTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/TakeTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/TakeTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/findelement/FindAnElementInAListUnitTest.kt similarity index 95% rename from core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/findelement/FindAnElementInAListUnitTest.kt index 6fa7983689..52e7e2a5b5 100644 --- a/core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/findelement/FindAnElementInAListUnitTest.kt @@ -1,11 +1,11 @@ -package com.baeldung.lists +package com.baeldung.findelement import org.junit.jupiter.api.Test import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertTrue -class ListsUnitTest { +class FindAnElementInAListUnitTest { var batmans: List = listOf("Christian Bale", "Michael Keaton", "Ben Affleck", "George Clooney") diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/ListToMapTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/ListToMapTest.kt index e3477931bb..93e4f11fdf 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/ListToMapTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.listtomap import org.junit.Test import kotlin.test.assertTrue diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/User.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/User.kt similarity index 71% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/User.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/User.kt index 759627b56e..89eb9ac701 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/User.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/User.kt @@ -1,3 +1,3 @@ -package com.baeldung.kotlin +package com.baeldung.listtomap data class User(val name: String, val age: Int, val hobbies: List) diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/splitting/SplittingTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/splitlist/SplitListIntoPartsTest.kt similarity index 98% rename from core-kotlin-2/src/test/kotlin/com/baeldung/splitting/SplittingTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/splitlist/SplitListIntoPartsTest.kt index a9ddc99992..627c7eaacf 100644 --- a/core-kotlin-2/src/test/kotlin/com/baeldung/splitting/SplittingTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/splitlist/SplitListIntoPartsTest.kt @@ -1,9 +1,9 @@ -package com.baeldung.lambda +package com.baeldung.splitlist import org.junit.jupiter.api.Test import kotlin.test.assertEquals -class SplittingTest { +class SplitListIntoPartsTest { private val evenList = listOf(0, "a", 1, "b", 2, "c"); private val unevenList = listOf(0, "a", 1, "b", 2, "c", 3); diff --git a/core-kotlin-modules/core-kotlin-concurrency/README.md b/core-kotlin-modules/core-kotlin-concurrency/README.md new file mode 100644 index 0000000000..09d9055a2b --- /dev/null +++ b/core-kotlin-modules/core-kotlin-concurrency/README.md @@ -0,0 +1,7 @@ +## Core Kotlin Concurrency + +This module contains articles about concurrency in Kotlin. + +### Relevant articles: +- [Threads vs Coroutines in Kotlin](https://www.baeldung.com/kotlin-threads-coroutines) +- [Introduction to Kotlin Coroutines](https://www.baeldung.com/kotlin-coroutines) diff --git a/core-kotlin-modules/core-kotlin-concurrency/pom.xml b/core-kotlin-modules/core-kotlin-concurrency/pom.xml new file mode 100644 index 0000000000..7c3b0fb5b6 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-concurrency/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + core-kotlin-concurrency + core-kotlin-concurrency + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + + + 1.3.30 + 3.10.0 + + + \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt b/core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleRunnable.kt similarity index 74% rename from core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleRunnable.kt index 7bc0528d06..80ffb4077a 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleRunnable.kt @@ -1,4 +1,4 @@ -package com.baeldung.thread +package com.baeldung.threadsvscoroutines class SimpleRunnable: Runnable { diff --git a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt b/core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleThread.kt similarity index 74% rename from core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleThread.kt index 2b2827ae02..6647dac0ef 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleThread.kt @@ -1,4 +1,4 @@ -package com.baeldung.thread +package com.baeldung.threadsvscoroutines class SimpleThread: Thread() { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/coroutines/CoroutinesUnitTest.kt similarity index 99% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/coroutines/CoroutinesUnitTest.kt index 324cf1109b..6b9437a8ab 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/coroutines/CoroutinesUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.coroutines import kotlinx.coroutines.* import org.junit.Test diff --git a/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/CoroutineUnitTest.kt similarity index 96% rename from core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/CoroutineUnitTest.kt index 1f1609b06b..ff385d0869 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/CoroutineUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.thread +package com.baeldung.threadsvscoroutines import kotlinx.coroutines.* import org.junit.jupiter.api.Test diff --git a/core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/ThreadUnitTest.kt similarity index 94% rename from core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/ThreadUnitTest.kt index fa2f1edc36..9503751fa3 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/ThreadUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.thread +package com.baeldung.threadsvscoroutines import org.junit.jupiter.api.Test import kotlin.concurrent.thread diff --git a/core-kotlin-modules/core-kotlin-lang-2/README.md b/core-kotlin-modules/core-kotlin-lang-2/README.md new file mode 100644 index 0000000000..e64a39cb9b --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-2/README.md @@ -0,0 +1,13 @@ +## Core Kotlin Lang + +This module contains articles about core features in the Kotlin language. + +### Relevant articles: +- [Kotlin return, break, continue Keywords](https://www.baeldung.com/kotlin-return-break-continue) +- [Infix Functions in Kotlin](https://www.baeldung.com/kotlin-infix-functions) +- [Lambda Expressions in Kotlin](https://www.baeldung.com/kotlin-lambda-expressions) +- [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final) +- [Initializing Arrays in Kotlin](https://www.baeldung.com/kotlin-initialize-array) +- [Lazy Initialization in Kotlin](https://www.baeldung.com/kotlin-lazy-initialization) +- [Comprehensive Guide to Null Safety in Kotlin](https://www.baeldung.com/kotlin-null-safety) +- [[<-- Prev]](/core-kotlin-modules/core-kotlin-lang) diff --git a/core-kotlin-modules/core-kotlin-lang-2/pom.xml b/core-kotlin-modules/core-kotlin-lang-2/pom.xml new file mode 100644 index 0000000000..753147728d --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-2/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + core-kotlin-lang-2 + core-kotlin-lang-2 + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + \ No newline at end of file diff --git a/core-kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java b/core-kotlin-modules/core-kotlin-lang-2/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java similarity index 100% rename from core-kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java rename to core-kotlin-modules/core-kotlin-lang-2/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java diff --git a/core-kotlin/src/main/kotlin/com/baeldung/lambda/Lambda.kt b/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/lambda/Lambda.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/lambda/Lambda.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/lambda/Lambda.kt diff --git a/core-kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java b/core-kotlin-modules/core-kotlin-lang-2/src/test/java/com/baeldung/lazy/LazyJavaUnitTest.java similarity index 86% rename from core-kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java rename to core-kotlin-modules/core-kotlin-lang-2/src/test/java/com/baeldung/lazy/LazyJavaUnitTest.java index e2fe58d537..01c87d9543 100644 --- a/core-kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/java/com/baeldung/lazy/LazyJavaUnitTest.java @@ -1,7 +1,5 @@ -package com.baeldung.kotlin; +package com.baeldung.lazy; - -import com.baeldung.lazy.ClassWithHeavyInitialization; import org.junit.Test; import static junit.framework.TestCase.assertTrue; diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayInitializationTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/arrayinitialization/ArrayInitializationTest.kt similarity index 96% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayInitializationTest.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/arrayinitialization/ArrayInitializationTest.kt index ba3694c831..d4b9d607fb 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayInitializationTest.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/arrayinitialization/ArrayInitializationTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.arrayinitialization import org.junit.Test import kotlin.test.assertEquals diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/ConstantUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/ConstantUnitTest.kt similarity index 79% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/ConstantUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/ConstantUnitTest.kt index 51d45b8df0..d9bf433208 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/ConstantUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/ConstantUnitTest.kt @@ -1,5 +1,5 @@ -import com.baeldung.kotlin.constant.TestKotlinConstantClass -import com.baeldung.kotlin.constant.TestKotlinConstantObject +package com.baeldung.constant + import org.junit.jupiter.api.Test import kotlin.test.assertEquals diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/TestKotlinConstantClass.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/TestKotlinConstantClass.kt similarity index 75% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/TestKotlinConstantClass.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/TestKotlinConstantClass.kt index 8bcc327999..3c4d4db220 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/TestKotlinConstantClass.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/TestKotlinConstantClass.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.constant +package com.baeldung.constant class TestKotlinConstantClass { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/TestKotlinConstantObject.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/TestKotlinConstantObject.kt similarity index 87% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/TestKotlinConstantObject.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/TestKotlinConstantObject.kt index 815fdeaf14..a6951b4481 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/constant/TestKotlinConstantObject.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/constant/TestKotlinConstantObject.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.constant +package com.baeldung.constant object TestKotlinConstantObject { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/InfixFunctionsTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/infixfunctions/InfixFunctionsTest.kt similarity index 97% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/InfixFunctionsTest.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/infixfunctions/InfixFunctionsTest.kt index fc4286460a..0b09d34013 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/InfixFunctionsTest.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/infixfunctions/InfixFunctionsTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.infixfunctions import org.junit.Assert import org.junit.Test diff --git a/core-kotlin/src/test/java/com/baeldung/lambda/LambdaKotlinUnitTest.java b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/lambda/LambdaKotlinUnitTest.java similarity index 100% rename from core-kotlin/src/test/java/com/baeldung/lambda/LambdaKotlinUnitTest.java rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/lambda/LambdaKotlinUnitTest.java diff --git a/core-kotlin/src/test/kotlin/com/baeldung/lambda/LambdaTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/lambda/LambdaTest.kt similarity index 99% rename from core-kotlin/src/test/kotlin/com/baeldung/lambda/LambdaTest.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/lambda/LambdaTest.kt index 3af00c98ff..bddabee462 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/lambda/LambdaTest.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/lambda/LambdaTest.kt @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test import kotlin.test.assertEquals class LambdaTest { + @Test fun whenCallingALambda_thenPerformTheAction() { assertEquals(9, inferredType(3)) diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/lazy/LazyUnitTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/lazy/LazyUnitTest.kt index 1169fb9193..b9b21ed4d9 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/lazy/LazyUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.lazy import org.junit.Test import java.util.concurrent.CountDownLatch diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/NullSafetyTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/nullsafety/NullSafetyTest.kt similarity index 99% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/NullSafetyTest.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/nullsafety/NullSafetyTest.kt index 0ecc74b6fb..66fc043581 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/NullSafetyTest.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/nullsafety/NullSafetyTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.nullsafety import org.junit.Test import kotlin.test.assertEquals @@ -8,6 +8,7 @@ import kotlin.test.assertTrue class NullSafetyTest { + @Test fun givenNonNullableField_whenAssignValueToIt_thenNotNeedToCheckAgainstNull() { //given diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/StructuralJumpUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/structuraljump/StructuralJumpUnitTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/StructuralJumpUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/structuraljump/StructuralJumpUnitTest.kt index 436dc9e2ba..88011ab396 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/StructuralJumpUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/structuraljump/StructuralJumpUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.structuraljump import org.junit.Test import kotlin.test.assertEquals diff --git a/core-kotlin-modules/core-kotlin-lang-oop-2/README.md b/core-kotlin-modules/core-kotlin-lang-oop-2/README.md new file mode 100644 index 0000000000..83d8f6f38a --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-oop-2/README.md @@ -0,0 +1,10 @@ +## Core Kotlin + +This module contains articles about Object-Oriented Programming in Kotlin + +### Relevant articles: + +- [Generics in Kotlin](https://www.baeldung.com/kotlin-generics) +- [Delegated Properties in Kotlin](https://www.baeldung.com/kotlin-delegated-properties) +- [Delegation Pattern in Kotlin](https://www.baeldung.com/kotlin-delegation-pattern) +- [[<-- Prev]](/core-kotlin-lang-oop) diff --git a/core-kotlin-modules/core-kotlin-lang-oop-2/pom.xml b/core-kotlin-modules/core-kotlin-lang-oop-2/pom.xml new file mode 100644 index 0000000000..f0adea121e --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-oop-2/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + core-kotlin-lang-oop-2 + core-kotlin-lang-oop-2 + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/generic/Reified.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/generic/Reified.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/generic/Reified.kt rename to core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/generic/Reified.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/Database.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/kotlin/delegates/Database.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/Database.kt rename to core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/kotlin/delegates/Database.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegate.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegate.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegate.kt rename to core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegate.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/InterfaceDelegation.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/kotlin/delegates/InterfaceDelegation.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/InterfaceDelegation.kt rename to core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/kotlin/delegates/InterfaceDelegation.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/User.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/kotlin/delegates/User.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/User.kt rename to core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/kotlin/delegates/User.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/GenericsTest.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/GenericsTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/GenericsTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/GenericsTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegatesTest.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegatesTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegatesTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegatesTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/delegates/InterfaceDelegationTest.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/kotlin/delegates/InterfaceDelegationTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/delegates/InterfaceDelegationTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop-2/src/test/kotlin/com/baeldung/kotlin/delegates/InterfaceDelegationTest.kt diff --git a/core-kotlin-modules/core-kotlin-lang-oop/README.md b/core-kotlin-modules/core-kotlin-lang-oop/README.md new file mode 100644 index 0000000000..461635f1b5 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-oop/README.md @@ -0,0 +1,17 @@ +## Core Kotlin Lang OOP + +This module contains articles about Object-Oriented Programming in Kotlin + +### Relevant articles: + +- [Data Classes in Kotlin](https://www.baeldung.com/kotlin-data-classes) +- [Sealed Classes in Kotlin](https://www.baeldung.com/kotlin-sealed-classes) +- [Extension Methods in Kotlin](https://www.baeldung.com/kotlin-extension-methods) +- [Objects in Kotlin](https://www.baeldung.com/kotlin-objects) +- [Working with Enums in Kotlin](https://www.baeldung.com/kotlin-enum) +- [Kotlin Constructors](https://www.baeldung.com/kotlin-constructors) +- [Kotlin Nested and Inner Classes](https://www.baeldung.com/kotlin-inner-classes) +- [Guide to Kotlin Interfaces](https://www.baeldung.com/kotlin-interfaces) +- [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) +- [Static Methods Behavior in Kotlin](https://www.baeldung.com/kotlin-static-methods) +- More articles: [[next -->]](/core-kotlin-lang-oop-2) diff --git a/core-kotlin-modules/core-kotlin-lang-oop/pom.xml b/core-kotlin-modules/core-kotlin-lang-oop/pom.xml new file mode 100644 index 0000000000..03fc80f07d --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-oop/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + core-kotlin-lang-oop + core-kotlin-lang-oop + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + \ No newline at end of file diff --git a/core-kotlin/src/main/java/com/baeldung/constructor/Car.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/java/com/baeldung/constructor/Car.kt similarity index 100% rename from core-kotlin/src/main/java/com/baeldung/constructor/Car.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/java/com/baeldung/constructor/Car.kt diff --git a/core-kotlin/src/main/java/com/baeldung/constructor/Employee.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/java/com/baeldung/constructor/Employee.kt similarity index 100% rename from core-kotlin/src/main/java/com/baeldung/constructor/Employee.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/java/com/baeldung/constructor/Employee.kt diff --git a/core-kotlin/src/main/java/com/baeldung/constructor/Person.java b/core-kotlin-modules/core-kotlin-lang-oop/src/main/java/com/baeldung/constructor/Person.java similarity index 100% rename from core-kotlin/src/main/java/com/baeldung/constructor/Person.java rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/java/com/baeldung/constructor/Person.java diff --git a/core-kotlin/src/main/java/com/baeldung/dataclass/Movie.java b/core-kotlin-modules/core-kotlin-lang-oop/src/main/java/com/baeldung/dataclass/Movie.java similarity index 100% rename from core-kotlin/src/main/java/com/baeldung/dataclass/Movie.java rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/java/com/baeldung/dataclass/Movie.java diff --git a/core-kotlin/src/main/kotlin/com/baeldung/constructor/Person.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/constructor/Person.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/constructor/Person.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/constructor/Person.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/dataclass/Movie.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/dataclass/Movie.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/dataclass/Movie.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/dataclass/Movie.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/dataclass/Sandbox.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/dataclass/Sandbox.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/dataclass/Sandbox.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/dataclass/Sandbox.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/enums/CardType.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/enums/CardType.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/enums/CardType.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/enums/CardType.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/enums/ICardLimit.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/enums/ICardLimit.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/enums/ICardLimit.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/enums/ICardLimit.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/inline/classes/CircleRadius.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/inline/classes/CircleRadius.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/inline/classes/CircleRadius.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/inline/classes/CircleRadius.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/inline/classes/InlineDoubleWrapper.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/inline/classes/InlineDoubleWrapper.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/inline/classes/InlineDoubleWrapper.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/inline/classes/InlineDoubleWrapper.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/interfaces/ConflictingInterfaces.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/interfaces/InterfaceDelegation.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/interfaces/MultipleInterfaces.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/interfaces/SimpleInterface.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/Sealed.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/kotlin/Sealed.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/Sealed.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/kotlin/Sealed.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/StringUtil.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/kotlin/StringUtil.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/StringUtil.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/kotlin/StringUtil.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/nested/Computer.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/nested/Computer.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/nested/Computer.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/nested/Computer.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/static/LoggingUtils.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/main/kotlin/com/baeldung/static/LoggingUtils.kt diff --git a/core-kotlin/src/test/java/com/baeldung/kotlin/StringUtilUnitTest.java b/core-kotlin-modules/core-kotlin-lang-oop/src/test/java/com/baeldung/kotlin/StringUtilUnitTest.java similarity index 100% rename from core-kotlin/src/test/java/com/baeldung/kotlin/StringUtilUnitTest.java rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/java/com/baeldung/kotlin/StringUtilUnitTest.java diff --git a/core-kotlin/src/test/kotlin/com/baeldung/enums/CardTypeUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/enums/CardTypeUnitTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/enums/CardTypeUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/enums/CardTypeUnitTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/inline/classes/CircleRadiusTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/inline/classes/CircleRadiusTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/inline/classes/CircleRadiusTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/inline/classes/CircleRadiusTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/inline/classes/InlineDoubleWrapperTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/inline/classes/InlineDoubleWrapperTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/inline/classes/InlineDoubleWrapperTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/inline/classes/InlineDoubleWrapperTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/interfaces/InterfaceExamplesUnitTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ExtensionMethods.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/ExtensionMethods.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/ExtensionMethods.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/ExtensionMethods.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/SealedTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/SealedTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/SealedTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/SealedTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/Counter.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/Counter.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/Counter.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/Counter.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/ObjectsTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/ObjectsTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/ObjectsTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/ObjectsTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/OuterClass.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/OuterClass.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/OuterClass.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/OuterClass.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/ReverseStringComparator.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/ReverseStringComparator.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/ReverseStringComparator.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/ReverseStringComparator.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/SimpleSingleton.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/SimpleSingleton.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/SimpleSingleton.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/SimpleSingleton.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/StaticClass.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/StaticClass.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/objects/StaticClass.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/kotlin/objects/StaticClass.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/nested/ComputerUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/nested/ComputerUnitTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/nested/ComputerUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/nested/ComputerUnitTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang-oop/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt diff --git a/core-kotlin-modules/core-kotlin-lang/README.md b/core-kotlin-modules/core-kotlin-lang/README.md new file mode 100644 index 0000000000..eaeae76854 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang/README.md @@ -0,0 +1,16 @@ +## Core Kotlin Lang + +This module contains articles about core features in the Kotlin language. + +### Relevant articles: +- [Guide to the “when{}” Block in Kotlin](https://www.baeldung.com/kotlin-when) +- [Difference Between “==” and “===” Operators in Kotlin](https://www.baeldung.com/kotlin-equality-operators) +- [Nested forEach in Kotlin](https://www.baeldung.com/kotlin-nested-foreach) +- [Destructuring Declarations in Kotlin](https://www.baeldung.com/kotlin-destructuring-declarations) +- [Try-with-resources in Kotlin](https://www.baeldung.com/kotlin-try-with-resources) +- [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading) +- [Inline Functions in Kotlin](https://www.baeldung.com/kotlin-inline-functions) +- [Void Type in Kotlin](https://www.baeldung.com/kotlin-void-type) +- [How to use Kotlin Range Expressions](https://www.baeldung.com/kotlin-ranges) +- [Creating a Kotlin Range Iterator on a Custom Object](https://www.baeldung.com/kotlin-custom-range-iterator) +- [[More --> ]](/core-kotlin-modules/core-kotlin-lang-2) diff --git a/core-kotlin-modules/core-kotlin-lang/pom.xml b/core-kotlin-modules/core-kotlin-lang/pom.xml new file mode 100644 index 0000000000..d3ac7f690c --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + core-kotlin-lang + core-kotlin-lang + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt similarity index 94% rename from core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt index a5018d93c8..f845d01539 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt @@ -1,7 +1,5 @@ package com.baeldung.destructuringdeclarations -import com.baeldung.destructuringdeclarations.Person - fun main(args: Array) { //2.1. Objects diff --git a/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/equalityoperators/User.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/equalityoperators/User.kt new file mode 100644 index 0000000000..030169bb8a --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/equalityoperators/User.kt @@ -0,0 +1,3 @@ +package com.baeldung.equalityoperators + +data class User(val name: String, val age: Int, val hobbies: List) diff --git a/core-kotlin/src/main/kotlin/com/baeldung/forEach/forEach.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/forEach/forEach.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/forEach/forEach.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/forEach/forEach.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/functions/Inline.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt similarity index 95% rename from core-kotlin/src/main/kotlin/com/baeldung/functions/Inline.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt index 239c425c03..3b179642ba 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/functions/Inline.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt @@ -1,4 +1,4 @@ -package com.baeldung.functions +package com.baeldung.inline import kotlin.random.Random diff --git a/core-kotlin/src/main/kotlin/com/baeldung/operators/Money.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/operators/Money.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/operators/Money.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/operators/Money.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/operators/Page.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/operators/Page.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/operators/Page.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/operators/Page.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/operators/Point.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/operators/Point.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/operators/Point.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/operators/Point.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/operators/Utils.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/operators/Utils.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/operators/Utils.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/operators/Utils.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/CharRange.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/CharRange.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/CharRange.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/CharRange.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/Color.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/Color.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/Color.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/Color.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/Filter.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/Filter.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/Filter.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/Filter.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/FirstLast.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/FirstLast.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/FirstLast.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/FirstLast.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/OtherRangeFunctions.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/OtherRangeFunctions.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/OtherRangeFunctions.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/OtherRangeFunctions.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/Range.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/Range.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/Range.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/Range.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/ReverseRange.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/ReverseRange.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/ReverseRange.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/ReverseRange.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/Step.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/Step.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/Step.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/Step.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/UntilRange.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/UntilRange.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/UntilRange.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/range/UntilRange.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/range/CustomColor.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/rangeiterator/CustomColor.kt similarity index 84% rename from core-kotlin-2/src/main/kotlin/com/baeldung/range/CustomColor.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/rangeiterator/CustomColor.kt index b4fed13b18..c1ab8e1610 100644 --- a/core-kotlin-2/src/main/kotlin/com/baeldung/range/CustomColor.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/rangeiterator/CustomColor.kt @@ -1,4 +1,4 @@ -package com.baeldung.range +package com.baeldung.rangeiterator import java.lang.IllegalStateException @@ -8,7 +8,7 @@ class CustomColor(val rgb: Int): Comparable { return this.rgb.compareTo(other.rgb) } - operator fun rangeTo(that: CustomColor) = ColorRange(this,that) + operator fun rangeTo(that: CustomColor) = ColorRange(this, that) operator fun inc(): CustomColor { return CustomColor(rgb + 1) @@ -25,7 +25,7 @@ class CustomColor(val rgb: Int): Comparable { } } class ColorRange(override val start: CustomColor, - override val endInclusive: CustomColor) : ClosedRange, Iterable{ + override val endInclusive: CustomColor) : ClosedRange, Iterable{ override fun iterator(): Iterator { return ColorIterator(start, endInclusive) diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/WhenBlockTypes.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/whenblock/WhenBlockTypes.kt similarity index 95% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/WhenBlockTypes.kt rename to core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/whenblock/WhenBlockTypes.kt index 6180da10d9..a4cd7b98f0 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/WhenBlockTypes.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/whenblock/WhenBlockTypes.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.whenblock enum class UnixFileType { D, HYPHEN_MINUS, L diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/equalityoperators/EqualityTest.kt similarity index 97% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/equalityoperators/EqualityTest.kt index 6fb6d0a288..0728d55b73 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/equalityoperators/EqualityTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.equalityoperators import org.junit.Test import kotlin.test.assertFalse diff --git a/core-kotlin/src/test/kotlin/com/baeldung/operators/PageTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/operators/PageTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/operators/PageTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/operators/PageTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/operators/PointTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/operators/PointTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/operators/PointTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/operators/PointTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/operators/UtilsTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/operators/UtilsTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/operators/UtilsTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/operators/UtilsTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/CharRangeTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/CharRangeTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/CharRangeTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/CharRangeTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/ColorTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/ColorTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/ColorTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/ColorTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/FilterTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/FilterTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/FilterTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/FilterTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/FirstLastTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/FirstLastTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/FirstLastTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/FirstLastTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/OtherRangeFunctionsTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/OtherRangeFunctionsTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/OtherRangeFunctionsTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/OtherRangeFunctionsTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/RangeTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/RangeTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/RangeTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/RangeTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/ReverseRangeTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/ReverseRangeTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/ReverseRangeTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/ReverseRangeTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/StepTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/StepTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/StepTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/StepTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/UntilRangeTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/UntilRangeTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/UntilRangeTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/range/UntilRangeTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/CustomColorTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/rangeiterator/CustomColorTest.kt similarity index 95% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/CustomColorTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/rangeiterator/CustomColorTest.kt index 8c8795ac42..676b47ae7a 100644 --- a/core-kotlin-2/src/test/kotlin/com/baeldung/range/CustomColorTest.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/rangeiterator/CustomColorTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.range +package com.baeldung.rangeiterator import org.junit.Test import java.lang.IllegalStateException diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/UseTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/trywithresource/UseTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/UseTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/trywithresource/UseTest.kt index 15bdfcafd8..d17832b380 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/UseTest.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/trywithresource/UseTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.trywithresource import org.junit.Test import java.beans.ExceptionListener diff --git a/core-kotlin-2/src/test/kotlin/voidtypes/VoidTypesUnitTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/voidtypes/VoidTypesUnitTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/voidtypes/VoidTypesUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/voidtypes/VoidTypesUnitTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/WhenBlockUnitTest.kt b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/whenblock/WhenBlockUnitTest.kt similarity index 99% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/WhenBlockUnitTest.kt rename to core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/whenblock/WhenBlockUnitTest.kt index aa1891fa46..31b6ad69f5 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/WhenBlockUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/test/kotlin/com/baeldung/whenblock/WhenBlockUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.whenblock import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue diff --git a/core-kotlin-modules/pom.xml b/core-kotlin-modules/pom.xml index 747e8b69de..e49b5fb85d 100644 --- a/core-kotlin-modules/pom.xml +++ b/core-kotlin-modules/pom.xml @@ -15,9 +15,16 @@ + core-kotlin-advanced core-kotlin-annotations + core-kotlin-collections + core-kotlin-concurrency core-kotlin-io + core-kotlin-lang + core-kotlin-lang-2 core-kotlin-strings + core-kotlin-lang-oop + core-kotlin-lang-oop-2 diff --git a/core-kotlin/README.md b/core-kotlin/README.md index f75a4e764c..89e1b7287e 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -5,53 +5,28 @@ This module contains articles about core Kotlin. ### Relevant articles: - [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin) -- [Guide to the “when{}” Block in Kotlin](https://www.baeldung.com/kotlin-when) -- [Comprehensive Guide to Null Safety in Kotlin](https://www.baeldung.com/kotlin-null-safety) - [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability) -- [Difference Between “==” and “===” operators in Kotlin](https://www.baeldung.com/kotlin-equality-operators) - [Generics in Kotlin](https://www.baeldung.com/kotlin-generics) -- [Introduction to Kotlin Coroutines](https://www.baeldung.com/kotlin-coroutines) -- [Destructuring Declarations in Kotlin](https://www.baeldung.com/kotlin-destructuring-declarations) -- [Lazy Initialization in Kotlin](https://www.baeldung.com/kotlin-lazy-initialization) -- [Overview of Kotlin Collections API](https://www.baeldung.com/kotlin-collections-api) -- [Converting a List to Map in Kotlin](https://www.baeldung.com/kotlin-list-to-map) - [Data Classes in Kotlin](https://www.baeldung.com/kotlin-data-classes) - [Delegated Properties in Kotlin](https://www.baeldung.com/kotlin-delegated-properties) - [Sealed Classes in Kotlin](https://www.baeldung.com/kotlin-sealed-classes) - [JUnit 5 for Kotlin Developers](https://www.baeldung.com/junit-5-kotlin) - [Extension Methods in Kotlin](https://www.baeldung.com/kotlin-extension-methods) -- [Infix Functions in Kotlin](https://www.baeldung.com/kotlin-infix-functions) -- [Try-with-resources in Kotlin](https://www.baeldung.com/kotlin-try-with-resources) -- [Regular Expressions in Kotlin](https://www.baeldung.com/kotlin-regular-expressions) - [Objects in Kotlin](https://www.baeldung.com/kotlin-objects) -- [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) -- [Lambda Expressions in Kotlin](https://www.baeldung.com/kotlin-lambda-expressions) - [Working with Enums in Kotlin](https://www.baeldung.com/kotlin-enum) - [Create a Java and Kotlin Project with Maven](https://www.baeldung.com/kotlin-maven-java-project) -- [Reflection with Kotlin](https://www.baeldung.com/kotlin-reflection) - [Get a Random Number in Kotlin](https://www.baeldung.com/kotlin-random-number) -- [Idiomatic Logging in Kotlin](https://www.baeldung.com/kotlin-logging) - [Kotlin Constructors](https://www.baeldung.com/kotlin-constructors) - [Creational Design Patterns in Kotlin: Builder](https://www.baeldung.com/kotlin-builder-pattern) - [Kotlin Nested and Inner Classes](https://www.baeldung.com/kotlin-inner-classes) - [Fuel HTTP Library with Kotlin](https://www.baeldung.com/kotlin-fuel) - [Introduction to Kovenant Library for Kotlin](https://www.baeldung.com/kotlin-kovenant) - [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class) -- [Kotlin return, break, continue Keywords](https://www.baeldung.com/kotlin-return-break-continue) -- [Mapping of Data Objects in Kotlin](https://www.baeldung.com/kotlin-data-objects) -- [Initializing Arrays in Kotlin](https://www.baeldung.com/kotlin-initialize-array) -- [Threads vs Coroutines in Kotlin](https://www.baeldung.com/kotlin-threads-coroutines) - [Guide to Kotlin Interfaces](https://www.baeldung.com/kotlin-interfaces) - [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort) - [Dependency Injection for Kotlin with Injekt](https://www.baeldung.com/kotlin-dependency-injection-with-injekt) - [Implementing a Binary Tree in Kotlin](https://www.baeldung.com/kotlin-binary-tree) -- [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) -- [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading) - [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) -- [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final) -- [Nested forEach in Kotlin](https://www.baeldung.com/kotlin-nested-foreach) -- [Building DSLs in Kotlin](https://www.baeldung.com/kotlin-dsl) - [Static Methods Behavior in Kotlin](https://www.baeldung.com/kotlin-static-methods) -- [Inline Functions in Kotlin](https://www.baeldung.com/kotlin-inline-functions) - [Delegation Pattern in Kotlin](https://www.baeldung.com/kotlin-delegation-pattern) - More articles: [[next -->]](/core-kotlin-2) diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml index 63a6d8035e..5fe8a47f62 100644 --- a/core-kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -14,11 +14,6 @@ - - org.apache.commons - commons-math3 - ${commons-math3.version} - org.apache.commons commons-lang3 @@ -75,7 +70,6 @@ - 3.6.1 1.1.1 5.2.0 3.10.0 diff --git a/custom-pmd/pom.xml b/custom-pmd/pom.xml index 601eedf08f..a011b6a121 100644 --- a/custom-pmd/pom.xml +++ b/custom-pmd/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.baeldung.pmd + com.baeldung.pmd custom-pmd 0.0.1 custom-pmd diff --git a/custom-pmd/src/main/java/org/baeldung/pmd/UnitTestNamingConventionRule.java b/custom-pmd/src/main/java/com/baeldung/pmd/UnitTestNamingConventionRule.java similarity index 97% rename from custom-pmd/src/main/java/org/baeldung/pmd/UnitTestNamingConventionRule.java rename to custom-pmd/src/main/java/com/baeldung/pmd/UnitTestNamingConventionRule.java index 2cbab782ee..e30164ac4f 100644 --- a/custom-pmd/src/main/java/org/baeldung/pmd/UnitTestNamingConventionRule.java +++ b/custom-pmd/src/main/java/com/baeldung/pmd/UnitTestNamingConventionRule.java @@ -1,4 +1,4 @@ -package org.baeldung.pmd; +package com.baeldung.pmd; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; diff --git a/grpc/src/main/java/org/baeldung/grpc/client/GrpcClient.java b/grpc/src/main/java/com/baeldung/grpc/client/GrpcClient.java similarity index 81% rename from grpc/src/main/java/org/baeldung/grpc/client/GrpcClient.java rename to grpc/src/main/java/com/baeldung/grpc/client/GrpcClient.java index f653e17910..f10b24faa7 100644 --- a/grpc/src/main/java/org/baeldung/grpc/client/GrpcClient.java +++ b/grpc/src/main/java/com/baeldung/grpc/client/GrpcClient.java @@ -1,8 +1,8 @@ -package org.baeldung.grpc.client; +package com.baeldung.grpc.client; -import org.baeldung.grpc.HelloRequest; -import org.baeldung.grpc.HelloResponse; -import org.baeldung.grpc.HelloServiceGrpc; +import com.baeldung.grpc.HelloRequest; +import com.baeldung.grpc.HelloResponse; +import com.baeldung.grpc.HelloServiceGrpc; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; diff --git a/grpc/src/main/java/org/baeldung/grpc/server/GrpcServer.java b/grpc/src/main/java/com/baeldung/grpc/server/GrpcServer.java similarity index 93% rename from grpc/src/main/java/org/baeldung/grpc/server/GrpcServer.java rename to grpc/src/main/java/com/baeldung/grpc/server/GrpcServer.java index 8a2b94e53b..2380d73a8c 100644 --- a/grpc/src/main/java/org/baeldung/grpc/server/GrpcServer.java +++ b/grpc/src/main/java/com/baeldung/grpc/server/GrpcServer.java @@ -1,4 +1,4 @@ -package org.baeldung.grpc.server; +package com.baeldung.grpc.server; import java.io.IOException; diff --git a/grpc/src/main/java/org/baeldung/grpc/server/HelloServiceImpl.java b/grpc/src/main/java/com/baeldung/grpc/server/HelloServiceImpl.java similarity index 79% rename from grpc/src/main/java/org/baeldung/grpc/server/HelloServiceImpl.java rename to grpc/src/main/java/com/baeldung/grpc/server/HelloServiceImpl.java index b08ad02c97..8609477fe9 100644 --- a/grpc/src/main/java/org/baeldung/grpc/server/HelloServiceImpl.java +++ b/grpc/src/main/java/com/baeldung/grpc/server/HelloServiceImpl.java @@ -1,8 +1,8 @@ -package org.baeldung.grpc.server; +package com.baeldung.grpc.server; -import org.baeldung.grpc.HelloRequest; -import org.baeldung.grpc.HelloResponse; -import org.baeldung.grpc.HelloServiceGrpc.HelloServiceImplBase; +import com.baeldung.grpc.HelloRequest; +import com.baeldung.grpc.HelloResponse; +import com.baeldung.grpc.HelloServiceGrpc.HelloServiceImplBase; import io.grpc.stub.StreamObserver; diff --git a/grpc/src/main/proto/HelloService.proto b/grpc/src/main/proto/HelloService.proto index 4f53191ab9..a008fad4b0 100644 --- a/grpc/src/main/proto/HelloService.proto +++ b/grpc/src/main/proto/HelloService.proto @@ -1,6 +1,6 @@ syntax = "proto3"; option java_multiple_files = true; -package org.baeldung.grpc; +package com.baeldung.grpc; message HelloRequest { string firstName = 1; diff --git a/gson/src/main/java/org/baeldung/gson/entities/ActorGson.java b/gson/src/main/java/com/baeldung/gson/entities/ActorGson.java similarity index 97% rename from gson/src/main/java/org/baeldung/gson/entities/ActorGson.java rename to gson/src/main/java/com/baeldung/gson/entities/ActorGson.java index 92468683bf..a68dba2436 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/ActorGson.java +++ b/gson/src/main/java/com/baeldung/gson/entities/ActorGson.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import java.text.DateFormat; import java.text.SimpleDateFormat; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Animal.java b/gson/src/main/java/com/baeldung/gson/entities/Animal.java similarity index 65% rename from gson/src/main/java/org/baeldung/gson/entities/Animal.java rename to gson/src/main/java/com/baeldung/gson/entities/Animal.java index 2eec5f8704..6c0f4a6e4e 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Animal.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Animal.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; public abstract class Animal { public String type = "Animal"; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Cow.java b/gson/src/main/java/com/baeldung/gson/entities/Cow.java similarity index 88% rename from gson/src/main/java/org/baeldung/gson/entities/Cow.java rename to gson/src/main/java/com/baeldung/gson/entities/Cow.java index 020bcd5860..5bd8d23f44 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Cow.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Cow.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; public class Cow extends Animal { private String breed; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Dog.java b/gson/src/main/java/com/baeldung/gson/entities/Dog.java similarity index 88% rename from gson/src/main/java/org/baeldung/gson/entities/Dog.java rename to gson/src/main/java/com/baeldung/gson/entities/Dog.java index 042d73adcf..ac55573866 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Dog.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Dog.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; public class Dog extends Animal { private String petName; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Employee.java b/gson/src/main/java/com/baeldung/gson/entities/Employee.java similarity index 94% rename from gson/src/main/java/org/baeldung/gson/entities/Employee.java rename to gson/src/main/java/com/baeldung/gson/entities/Employee.java index cedcd6572e..ecc4571dcc 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Employee.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Employee.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; public class Employee { private int id; diff --git a/gson/src/main/java/org/baeldung/gson/entities/Movie.java b/gson/src/main/java/com/baeldung/gson/entities/Movie.java similarity index 96% rename from gson/src/main/java/org/baeldung/gson/entities/Movie.java rename to gson/src/main/java/com/baeldung/gson/entities/Movie.java index ee688f228d..ebc4cff137 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Movie.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Movie.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import java.util.List; diff --git a/gson/src/main/java/org/baeldung/gson/entities/MovieWithNullValue.java b/gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java similarity index 96% rename from gson/src/main/java/org/baeldung/gson/entities/MovieWithNullValue.java rename to gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java index fe62d51ffb..381d7cb83b 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/MovieWithNullValue.java +++ b/gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import com.google.gson.annotations.Expose; diff --git a/gson/src/main/java/org/baeldung/gson/entities/MyClass.java b/gson/src/main/java/com/baeldung/gson/entities/MyClass.java similarity index 96% rename from gson/src/main/java/org/baeldung/gson/entities/MyClass.java rename to gson/src/main/java/com/baeldung/gson/entities/MyClass.java index 4e717e72c3..66a1887414 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/MyClass.java +++ b/gson/src/main/java/com/baeldung/gson/entities/MyClass.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import java.util.Objects; diff --git a/gson/src/main/java/org/baeldung/gson/entities/User.java b/gson/src/main/java/com/baeldung/gson/entities/User.java similarity index 84% rename from gson/src/main/java/org/baeldung/gson/entities/User.java rename to gson/src/main/java/com/baeldung/gson/entities/User.java index b413f3300e..d821ef5552 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/User.java +++ b/gson/src/main/java/com/baeldung/gson/entities/User.java @@ -1,19 +1,19 @@ -package org.baeldung.gson.entities; - -public class User { - - private int id; - private String name; - private transient String nationality; - - public User(int id, String name, String nationality) { - this.id = id; - this.name = name; - this.nationality = nationality; - } - - public User(int id, String name) { - this(id, name, null); - } - -} +package com.baeldung.gson.entities; + +public class User { + + private int id; + private String name; + private transient String nationality; + + public User(int id, String name, String nationality) { + this.id = id; + this.name = name; + this.nationality = nationality; + } + + public User(int id, String name) { + this(id, name, null); + } + +} diff --git a/gson/src/main/java/org/baeldung/gson/entities/Weather.java b/gson/src/main/java/com/baeldung/gson/entities/Weather.java similarity index 95% rename from gson/src/main/java/org/baeldung/gson/entities/Weather.java rename to gson/src/main/java/com/baeldung/gson/entities/Weather.java index 383e9ef41c..b68ec4c6d4 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/Weather.java +++ b/gson/src/main/java/com/baeldung/gson/entities/Weather.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.entities; +package com.baeldung.gson.entities; import com.google.gson.annotations.SerializedName; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/BooleanExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java similarity index 75% rename from gson/src/main/java/org/baeldung/gson/primitives/models/BooleanExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java index 1fe87650de..1f05fc6119 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/BooleanExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class BooleanExample { public boolean value; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/ByteExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java similarity index 75% rename from gson/src/main/java/org/baeldung/gson/primitives/models/ByteExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java index 2e1c68ee51..6ec4e42ea3 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/ByteExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class ByteExample { public byte value = (byte) 1; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/CharExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java similarity index 74% rename from gson/src/main/java/org/baeldung/gson/primitives/models/CharExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java index ccac913f23..69d1a95fcd 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/CharExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class CharExample { public char value; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/DoubleExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java similarity index 75% rename from gson/src/main/java/org/baeldung/gson/primitives/models/DoubleExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java index 5022b6a11e..7c9db2bd50 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/DoubleExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class DoubleExample { public double value; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/FloatExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java similarity index 74% rename from gson/src/main/java/org/baeldung/gson/primitives/models/FloatExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java index 00a97f68fc..86c0c4802c 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/FloatExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class FloatExample { public float value; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/InfinityValuesExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java similarity index 70% rename from gson/src/main/java/org/baeldung/gson/primitives/models/InfinityValuesExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java index 163b0a3d95..90f10c0751 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/InfinityValuesExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class InfinityValuesExample { public float negativeInfinity; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/LongExample.java b/gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java similarity index 75% rename from gson/src/main/java/org/baeldung/gson/primitives/models/LongExample.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java index e709650789..021de1d06d 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/LongExample.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class LongExample { public long value = 1; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundle.java b/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java similarity index 93% rename from gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundle.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java index ad7309a2f7..10134110f3 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundle.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class PrimitiveBundle { public byte byteValue; diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java b/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java similarity index 92% rename from gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java rename to gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java index 2780f7fd18..c6eb6ca267 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java +++ b/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.primitives.models; +package com.baeldung.gson.primitives.models; public class PrimitiveBundleInitialized { // @formatter:off diff --git a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java b/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java similarity index 94% rename from gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java index 016e3ba1e2..34c9f83888 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java @@ -1,11 +1,11 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; -import org.baeldung.gson.entities.ActorGson; +import com.baeldung.gson.entities.ActorGson; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; diff --git a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonSerializer.java b/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java similarity index 93% rename from gson/src/main/java/org/baeldung/gson/serialization/ActorGsonSerializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java index 8f2cd10f5a..4ca653f76b 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonSerializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java @@ -1,10 +1,10 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import org.baeldung.gson.entities.ActorGson; +import com.baeldung.gson.entities.ActorGson; import java.lang.reflect.Type; import java.text.SimpleDateFormat; diff --git a/gson/src/main/java/org/baeldung/gson/serialization/AnimalDeserializer.java b/gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java similarity index 93% rename from gson/src/main/java/org/baeldung/gson/serialization/AnimalDeserializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java index 9dcef0e10b..6c72ddb0da 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/AnimalDeserializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import com.google.gson.Gson; import com.google.gson.JsonDeserializationContext; @@ -8,7 +8,7 @@ import com.google.gson.JsonObject; import java.lang.reflect.Type; import java.util.HashMap; import java.util.Map; -import org.baeldung.gson.entities.Animal; +import com.baeldung.gson.entities.Animal; public class AnimalDeserializer implements JsonDeserializer { private String animalTypeElementName; diff --git a/gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java b/gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java similarity index 94% rename from gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java index cdeb2e23c8..1954986547 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/MapDeserializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java @@ -1,12 +1,11 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; import java.math.BigDecimal; -import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; -import org.baeldung.gson.entities.Employee; +import com.baeldung.gson.entities.Employee; import com.google.gson.*; diff --git a/gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java b/gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java similarity index 97% rename from gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java rename to gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java index f18bdbc84f..fa9d7d2240 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/StringDateMapDeserializer.java +++ b/gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; import java.text.ParseException; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/Exclude.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java similarity index 82% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/Exclude.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java index 429cb9d1b5..d3067e3482 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/Exclude.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClass.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java similarity index 79% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClass.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java index cc6c498458..8919792721 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClass.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java similarity index 85% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java index 5d41f8a224..4c38df1eac 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import com.google.gson.annotations.Expose; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java similarity index 83% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java index ace3583013..85871be03d 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java similarity index 82% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java index 5e781a6287..dfb9d4bd6e 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClass.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java similarity index 78% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClass.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java index 5adac0697e..6b8a287020 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClass.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java similarity index 83% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java index a0f7b5d277..0c94e8f2cc 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import com.google.gson.annotations.Expose; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java similarity index 81% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java index f6aa4651b3..0bd9a149cb 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java similarity index 80% rename from gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java rename to gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java index d4e31b0bc8..817d2ee557 100644 --- a/gson/src/main/java/org/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java +++ b/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/gson/src/test/java/org/baeldung/gson/advance/GsonAdvanceUnitTest.java b/gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java similarity index 94% rename from gson/src/test/java/org/baeldung/gson/advance/GsonAdvanceUnitTest.java rename to gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java index 5b787f1956..d4adb6e406 100644 --- a/gson/src/test/java/org/baeldung/gson/advance/GsonAdvanceUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java @@ -1,8 +1,9 @@ -package org.baeldung.gson.advance; +package com.baeldung.gson.advance; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import com.baeldung.gson.entities.Dog; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -10,11 +11,10 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.baeldung.gson.entities.Animal; -import org.baeldung.gson.entities.Cow; -import org.baeldung.gson.entities.Dog; -import org.baeldung.gson.entities.MyClass; -import org.baeldung.gson.serialization.AnimalDeserializer; +import com.baeldung.gson.entities.Animal; +import com.baeldung.gson.entities.Cow; +import com.baeldung.gson.entities.MyClass; +import com.baeldung.gson.serialization.AnimalDeserializer; import org.junit.Test; public class GsonAdvanceUnitTest { diff --git a/gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java b/gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java similarity index 99% rename from gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java rename to gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java index 739dd889c7..aab3f5f3f1 100644 --- a/gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java +++ b/gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.advance; +package com.baeldung.gson.advance; /* * Copyright (C) 2011 Google Inc. diff --git a/gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java b/gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java similarity index 96% rename from gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java rename to gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java index 847ec1b85d..9f07617969 100644 --- a/gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.conversion; +package com.baeldung.gson.conversion; import com.google.gson.*; import org.junit.Assert; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/Foo.java b/gson/src/test/java/com/baeldung/gson/deserialization/Foo.java similarity index 97% rename from gson/src/test/java/org/baeldung/gson/deserialization/Foo.java rename to gson/src/test/java/com/baeldung/gson/deserialization/Foo.java index 84f8aaef13..e556786020 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/Foo.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; public class Foo { public int intValue; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializer.java b/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java similarity index 95% rename from gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializer.java rename to gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java index 17c1dfae19..1ccb3f7de9 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializer.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java b/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java similarity index 94% rename from gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java rename to gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java index d4eaa39ac5..289f71820c 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/FooInstanceCreator.java b/gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java similarity index 84% rename from gson/src/test/java/org/baeldung/gson/deserialization/FooInstanceCreator.java rename to gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java index 4df3986ec3..e3ebc09874 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/FooInstanceCreator.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/FooWithInner.java b/gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java similarity index 92% rename from gson/src/test/java/org/baeldung/gson/deserialization/FooWithInner.java rename to gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java index 705e534e77..ddad97b4ab 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/FooWithInner.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; public class FooWithInner { public int intValue; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/GenericFoo.java b/gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java similarity index 85% rename from gson/src/test/java/org/baeldung/gson/deserialization/GenericFoo.java rename to gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java index 954cf007cf..9a81d5ae7a 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/GenericFoo.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; public class GenericFoo { diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/GsonAlternateUnitTest.java b/gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java similarity index 92% rename from gson/src/test/java/org/baeldung/gson/deserialization/GsonAlternateUnitTest.java rename to gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java index f3a5d24e3e..c49a1ea568 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/GsonAlternateUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java @@ -1,8 +1,8 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import static org.junit.Assert.assertEquals; -import org.baeldung.gson.entities.Weather; +import com.baeldung.gson.entities.Weather; import org.junit.Test; import com.google.gson.Gson; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeUnitTest.java b/gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java similarity index 90% rename from gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeUnitTest.java rename to gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java index 40e8524744..73e76967b9 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java @@ -1,10 +1,10 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.text.ParseException; -import org.baeldung.gson.entities.ActorGson; -import org.baeldung.gson.entities.Movie; -import org.baeldung.gson.serialization.ActorGsonDeserializer; +import com.baeldung.gson.entities.Movie; +import com.baeldung.gson.serialization.ActorGsonDeserializer; +import com.baeldung.gson.entities.ActorGson; import org.junit.Assert; import org.junit.Test; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java b/gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java similarity index 95% rename from gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java rename to gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java index a5ae4194e8..77c934283a 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/MapDeserializationUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization; +package com.baeldung.gson.deserialization; import java.lang.reflect.Type; import java.text.ParseException; @@ -6,9 +6,9 @@ import java.util.Date; import java.util.Map; import org.apache.commons.lang3.time.DateUtils; -import org.baeldung.gson.entities.Employee; -import org.baeldung.gson.serialization.MapDeserializer; -import org.baeldung.gson.serialization.StringDateMapDeserializer; +import com.baeldung.gson.entities.Employee; +import com.baeldung.gson.serialization.MapDeserializer; +import com.baeldung.gson.serialization.StringDateMapDeserializer; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java b/gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java similarity index 93% rename from gson/src/test/java/org/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java rename to gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java index 784bb45a6a..adc046ed8e 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.deserialization.test; +package com.baeldung.gson.deserialization.test; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.instanceOf; @@ -10,11 +10,11 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; -import org.baeldung.gson.deserialization.Foo; -import org.baeldung.gson.deserialization.FooDeserializerFromJsonWithDifferentFields; -import org.baeldung.gson.deserialization.FooInstanceCreator; -import org.baeldung.gson.deserialization.FooWithInner; -import org.baeldung.gson.deserialization.GenericFoo; +import com.baeldung.gson.deserialization.Foo; +import com.baeldung.gson.deserialization.FooDeserializerFromJsonWithDifferentFields; +import com.baeldung.gson.deserialization.FooInstanceCreator; +import com.baeldung.gson.deserialization.FooWithInner; +import com.baeldung.gson.deserialization.GenericFoo; import org.junit.Test; import com.google.common.collect.Lists; diff --git a/gson/src/test/java/org/baeldung/gson/primitives/PrimitiveValuesUnitTest.java b/gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java similarity index 99% rename from gson/src/test/java/org/baeldung/gson/primitives/PrimitiveValuesUnitTest.java rename to gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java index 7d249bc55c..e1241fa92a 100644 --- a/gson/src/test/java/org/baeldung/gson/primitives/PrimitiveValuesUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java @@ -1,7 +1,7 @@ -package org.baeldung.gson.primitives; +package com.baeldung.gson.primitives; +import com.baeldung.gson.primitives.models.*; import com.google.gson.*; -import org.baeldung.gson.primitives.models.*; import org.junit.Test; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/DifferentNameSerializer.java b/gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java similarity index 94% rename from gson/src/test/java/org/baeldung/gson/serialization/DifferentNameSerializer.java rename to gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java index 9cef1da37b..b82f90f476 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/DifferentNameSerializer.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/GsonSerializeUnitTest.java b/gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java similarity index 92% rename from gson/src/test/java/org/baeldung/gson/serialization/GsonSerializeUnitTest.java rename to gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java index 4392ea1631..d5051060c4 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/GsonSerializeUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java @@ -1,11 +1,11 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; +import com.baeldung.gson.entities.Movie; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParser; -import org.baeldung.gson.entities.ActorGson; -import org.baeldung.gson.entities.Movie; -import org.baeldung.gson.entities.MovieWithNullValue; +import com.baeldung.gson.entities.ActorGson; +import com.baeldung.gson.entities.MovieWithNullValue; import org.junit.Assert; import org.junit.Test; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java b/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java similarity index 95% rename from gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java rename to gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java index 769a4d33a7..554d63b29b 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsSerializer.java b/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java similarity index 93% rename from gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsSerializer.java rename to gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java index bd1928cb18..7f251894a0 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/IgnoringFieldsSerializer.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; import java.lang.reflect.Type; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/SourceClass.java b/gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java similarity index 96% rename from gson/src/test/java/org/baeldung/gson/serialization/SourceClass.java rename to gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java index 02de2636c2..181f1134b5 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/SourceClass.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serialization; +package com.baeldung.gson.serialization; public class SourceClass { private int intValue; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/test/GsonSerializationUnitTest.java b/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java similarity index 91% rename from gson/src/test/java/org/baeldung/gson/serialization/test/GsonSerializationUnitTest.java rename to gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java index 6806c470b9..4780b8a6bf 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/test/GsonSerializationUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java @@ -1,18 +1,16 @@ -package org.baeldung.gson.serialization.test; +package com.baeldung.gson.serialization.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.lang.reflect.Type; -import java.util.Calendar; import java.util.Collection; import java.util.Date; -import java.util.GregorianCalendar; -import org.baeldung.gson.serialization.DifferentNameSerializer; -import org.baeldung.gson.serialization.IgnoringFieldsNotMatchingCriteriaSerializer; -import org.baeldung.gson.serialization.IgnoringFieldsSerializer; -import org.baeldung.gson.serialization.SourceClass; +import com.baeldung.gson.serialization.DifferentNameSerializer; +import com.baeldung.gson.serialization.IgnoringFieldsNotMatchingCriteriaSerializer; +import com.baeldung.gson.serialization.IgnoringFieldsSerializer; +import com.baeldung.gson.serialization.SourceClass; import org.joda.time.DateTime; import org.junit.Test; diff --git a/gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java b/gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java similarity index 88% rename from gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java rename to gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java index f6a8de080c..8e58435520 100644 --- a/gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java @@ -1,43 +1,43 @@ -package org.baeldung.gson.serialization.test; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.nio.file.Files; -import java.nio.file.Paths; - -import org.baeldung.gson.entities.User; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameter; -import org.junit.runners.Parameterized.Parameters; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -@RunWith(Parameterized.class) -public class JsonFileUnitTest { - - @Parameter - public Object object; - - @Parameters - public static Object[] data() { - return new Object[] { 123.45, new User(1, "Tom", "American") }; - } - - @Test - public void givenProperData_whenStoredInFile_shouldSaveJsonSuccessfully() { - String filePath = "target/output.json"; - try (Writer writer = new FileWriter(filePath)) { - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - gson.toJson(object, writer); - Assert.assertTrue(Files.exists(Paths.get(filePath))); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} +package com.baeldung.gson.serialization.test; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.nio.file.Files; +import java.nio.file.Paths; + +import com.baeldung.gson.entities.User; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +@RunWith(Parameterized.class) +public class JsonFileUnitTest { + + @Parameter + public Object object; + + @Parameters + public static Object[] data() { + return new Object[] { 123.45, new User(1, "Tom", "American") }; + } + + @Test + public void givenProperData_whenStoredInFile_shouldSaveJsonSuccessfully() { + String filePath = "target/output.json"; + try (Writer writer = new FileWriter(filePath)) { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + gson.toJson(object, writer); + Assert.assertTrue(Files.exists(Paths.get(filePath))); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/gson/src/test/java/org/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java b/gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java similarity index 98% rename from gson/src/test/java/org/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java rename to gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java index 632d06946b..d677f0b271 100644 --- a/gson/src/test/java/org/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java +++ b/gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.gson.serializationwithexclusions; +package com.baeldung.gson.serializationwithexclusions; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaMapFromSet.java b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSet.java similarity index 98% rename from guava-collections-set/src/test/java/org/baeldung/guava/GuavaMapFromSet.java rename to guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSet.java index f474fcb17b..d2c772080d 100644 --- a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaMapFromSet.java +++ b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSet.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.base.Function; diff --git a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaMapFromSetUnitTest.java b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSetUnitTest.java similarity index 98% rename from guava-collections-set/src/test/java/org/baeldung/guava/GuavaMapFromSetUnitTest.java rename to guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSetUnitTest.java index 03f2d8f891..71a526601b 100644 --- a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaMapFromSetUnitTest.java +++ b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSetUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.base.Function; import org.junit.Test; diff --git a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaMultiSetUnitTest.java b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMultiSetUnitTest.java similarity index 99% rename from guava-collections-set/src/test/java/org/baeldung/guava/GuavaMultiSetUnitTest.java rename to guava-collections-set/src/test/java/com/baeldung/guava/GuavaMultiSetUnitTest.java index e74db29881..dc1489f7ea 100644 --- a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaMultiSetUnitTest.java +++ b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMultiSetUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.collect.HashMultiset; import com.google.common.collect.Multiset; diff --git a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaRangeSetUnitTest.java b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaRangeSetUnitTest.java similarity index 99% rename from guava-collections-set/src/test/java/org/baeldung/guava/GuavaRangeSetUnitTest.java rename to guava-collections-set/src/test/java/com/baeldung/guava/GuavaRangeSetUnitTest.java index edefc61fc4..bd9aa09941 100644 --- a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaRangeSetUnitTest.java +++ b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaRangeSetUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.collect.ImmutableRangeSet; import com.google.common.collect.Range; diff --git a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaSetOperationsUnitTest.java b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaSetOperationsUnitTest.java similarity index 99% rename from guava-collections-set/src/test/java/org/baeldung/guava/GuavaSetOperationsUnitTest.java rename to guava-collections-set/src/test/java/com/baeldung/guava/GuavaSetOperationsUnitTest.java index dfd90ad738..eaa6d8a832 100644 --- a/guava-collections-set/src/test/java/org/baeldung/guava/GuavaSetOperationsUnitTest.java +++ b/guava-collections-set/src/test/java/com/baeldung/guava/GuavaSetOperationsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.base.Function; import com.google.common.base.Joiner; diff --git a/guava-io/src/main/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java b/guava-io/src/main/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java index 7293b1631e..5d846933f9 100644 --- a/guava-io/src/main/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java +++ b/guava-io/src/main/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/guava-io/src/main/test/java/com/baeldung/guava/GuavaIOUnitTest.java b/guava-io/src/main/test/java/com/baeldung/guava/GuavaIOUnitTest.java index 4a827dfbc0..7d7b0ea04d 100644 --- a/guava-io/src/main/test/java/com/baeldung/guava/GuavaIOUnitTest.java +++ b/guava-io/src/main/test/java/com/baeldung/guava/GuavaIOUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.hamcrest.Matchers.contains; import static org.junit.Assert.assertEquals; diff --git a/guava/src/main/java/org/baeldung/guava/CustomEvent.java b/guava/src/main/java/com/baeldung/guava/CustomEvent.java similarity index 90% rename from guava/src/main/java/org/baeldung/guava/CustomEvent.java rename to guava/src/main/java/com/baeldung/guava/CustomEvent.java index 8534d7da1c..a154790374 100644 --- a/guava/src/main/java/org/baeldung/guava/CustomEvent.java +++ b/guava/src/main/java/com/baeldung/guava/CustomEvent.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; public class CustomEvent { private String action; diff --git a/guava/src/main/java/org/baeldung/guava/EventListener.java b/guava/src/main/java/com/baeldung/guava/EventListener.java similarity index 97% rename from guava/src/main/java/org/baeldung/guava/EventListener.java rename to guava/src/main/java/com/baeldung/guava/EventListener.java index 60beebeea5..7bcfbcb8e9 100644 --- a/guava/src/main/java/org/baeldung/guava/EventListener.java +++ b/guava/src/main/java/com/baeldung/guava/EventListener.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.eventbus.DeadEvent; import com.google.common.eventbus.Subscribe; diff --git a/guava/src/main/java/org/baeldung/guava/memoizer/CostlySupplier.java b/guava/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java similarity index 89% rename from guava/src/main/java/org/baeldung/guava/memoizer/CostlySupplier.java rename to guava/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java index 63b3fbd438..9a929a15bd 100644 --- a/guava/src/main/java/org/baeldung/guava/memoizer/CostlySupplier.java +++ b/guava/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java @@ -1,4 +1,4 @@ -package org.baeldung.guava.memoizer; +package com.baeldung.guava.memoizer; import java.math.BigInteger; import java.util.Random; diff --git a/guava/src/main/java/org/baeldung/guava/memoizer/Factorial.java b/guava/src/main/java/com/baeldung/guava/memoizer/Factorial.java similarity index 93% rename from guava/src/main/java/org/baeldung/guava/memoizer/Factorial.java rename to guava/src/main/java/com/baeldung/guava/memoizer/Factorial.java index 74fcbdcc14..6497979682 100644 --- a/guava/src/main/java/org/baeldung/guava/memoizer/Factorial.java +++ b/guava/src/main/java/com/baeldung/guava/memoizer/Factorial.java @@ -1,4 +1,4 @@ -package org.baeldung.guava.memoizer; +package com.baeldung.guava.memoizer; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; diff --git a/guava/src/main/java/org/baeldung/guava/memoizer/FibonacciSequence.java b/guava/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java similarity index 90% rename from guava/src/main/java/org/baeldung/guava/memoizer/FibonacciSequence.java rename to guava/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java index 0c70f08c23..d0462fb001 100644 --- a/guava/src/main/java/org/baeldung/guava/memoizer/FibonacciSequence.java +++ b/guava/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java @@ -1,11 +1,10 @@ -package org.baeldung.guava.memoizer; +package com.baeldung.guava.memoizer; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import java.math.BigInteger; -import java.util.concurrent.TimeUnit; public class FibonacciSequence { diff --git a/guava/src/test/java/org/baeldung/guava/BloomFilterUnitTest.java b/guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java similarity index 98% rename from guava/src/test/java/org/baeldung/guava/BloomFilterUnitTest.java rename to guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java index ff3031a0cb..c11bf27256 100644 --- a/guava/src/test/java/org/baeldung/guava/BloomFilterUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.hash.BloomFilter; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaBigIntegerMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaBigIntegerMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java index f5afe20fc2..cca42a688f 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaBigIntegerMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaCacheLoaderUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java similarity index 98% rename from guava/src/test/java/org/baeldung/guava/GuavaCacheLoaderUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java index e27171bb84..bf9747ec18 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaCacheLoaderUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaCacheUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaCacheUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java index 49ce6b1a09..8aa56c7c52 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaCacheUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaDoubleMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaDoubleMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java index b39770e2e7..9c78fb36fa 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaDoubleMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.*; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaEventBusUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java similarity index 97% rename from guava/src/test/java/org/baeldung/guava/GuavaEventBusUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java index 1bc62af300..bb9d26fcce 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaEventBusUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.eventbus.EventBus; import org.junit.After; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaFunctionalExamplesUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaFunctionalExamplesUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java index c09ae696b3..b54a7c951a 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaFunctionalExamplesUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaIntMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaIntMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java index 9270212929..547f423396 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaIntMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.*; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaLongMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaLongMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java index 680f405149..33c28d4594 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaLongMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.junit.Assert.*; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMathUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaMathUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java index 1e1f806628..fce0fec13b 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaMathUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.*; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMemoizerUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java similarity index 94% rename from guava/src/test/java/org/baeldung/guava/GuavaMemoizerUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java index 8c37ecf07c..9bafb7ad3f 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaMemoizerUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java @@ -1,9 +1,9 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.base.Suppliers; -import org.baeldung.guava.memoizer.CostlySupplier; -import org.baeldung.guava.memoizer.Factorial; -import org.baeldung.guava.memoizer.FibonacciSequence; +import com.baeldung.guava.memoizer.CostlySupplier; +import com.baeldung.guava.memoizer.Factorial; +import com.baeldung.guava.memoizer.FibonacciSequence; import org.junit.Test; import java.math.BigInteger; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaPreConditionsUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaPreConditionsUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java index 6bf9e5c7a2..fe3be9abf0 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaPreConditionsUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.Arrays; diff --git a/guava/src/test/java/org/baeldung/guava/GuavaReflectionUtilsUnitTest.java b/guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java similarity index 99% rename from guava/src/test/java/org/baeldung/guava/GuavaReflectionUtilsUnitTest.java rename to guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java index f2d1c08ae9..36df241711 100644 --- a/guava/src/test/java/org/baeldung/guava/GuavaReflectionUtilsUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.collect.Lists; diff --git a/guava/src/test/java/org/baeldung/guava/RateLimiterLongRunningUnitTest.java b/guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java similarity index 98% rename from guava/src/test/java/org/baeldung/guava/RateLimiterLongRunningUnitTest.java rename to guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java index 914de01a6d..7372e9f6e9 100644 --- a/guava/src/test/java/org/baeldung/guava/RateLimiterLongRunningUnitTest.java +++ b/guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.guava; +package com.baeldung.guava; import com.google.common.util.concurrent.RateLimiter; diff --git a/httpclient-simple/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java b/httpclient-simple/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java index 380ff9df6b..cafd8cfb7b 100644 --- a/httpclient-simple/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java +++ b/httpclient-simple/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java @@ -1,20 +1,20 @@ package com.baeldung.basic; +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint; import org.springframework.stereotype.Component; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - @Component public class MyBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint { @Override - public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException, ServletException { + public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException { response.addHeader("WWW-Authenticate", "Basic realm=\"" + getRealmName() + "\""); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); final PrintWriter writer = response.getWriter(); @@ -22,7 +22,7 @@ public class MyBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoi } @Override - public void afterPropertiesSet() throws Exception { + public void afterPropertiesSet() { setRealmName("Baeldung"); super.afterPropertiesSet(); } diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java index 47a587885e..082c282306 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/HttpAsyncClientLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient; +package com.baeldung.httpclient; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/HttpClientMultipartLiveTest.java similarity index 98% rename from httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/HttpClientMultipartLiveTest.java index 1752c27286..7576e49034 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/HttpClientMultipartLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient; +package com.baeldung.httpclient; import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; @@ -38,7 +38,7 @@ public class HttpClientMultipartLiveTest { private static final String TEXTFILENAME = "temp.txt"; private static final String IMAGEFILENAME = "image.jpg"; private static final String ZIPFILENAME = "zipFile.zip"; - private static final Logger LOGGER = Logger.getLogger("org.baeldung.httpclient.HttpClientMultipartLiveTest"); + private static final Logger LOGGER = Logger.getLogger("com.baeldung.httpclient.HttpClientMultipartLiveTest"); private CloseableHttpClient client; private HttpPost post; private BufferedReader rd; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/HttpClientRedirectLiveTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/HttpClientRedirectLiveTest.java index a501367a6b..9a03ab02a5 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/HttpClientRedirectLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient; +package com.baeldung.httpclient; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java b/httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java similarity index 94% rename from httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java rename to httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java index fd38b95cbe..e9ea08a723 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient; +package com.baeldung.httpclient; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java b/httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java index 77d5a298c1..2235d0e9d0 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.advancedconfig; +package com.baeldung.httpclient.advancedconfig; import com.github.tomakehurst.wiremock.junit.WireMockRule; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java similarity index 95% rename from httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java index fe275be082..9d4573084b 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java @@ -1,5 +1,6 @@ -package org.baeldung.httpclient.base; +package com.baeldung.httpclient.base; +import com.baeldung.httpclient.ResponseUtil; import org.apache.http.auth.AuthenticationException; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.methods.CloseableHttpResponse; @@ -8,7 +9,6 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.auth.BasicScheme; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientLiveTest.java similarity index 97% rename from httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientLiveTest.java index 78097227e7..ef12c37412 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientLiveTest.java @@ -1,5 +1,6 @@ -package org.baeldung.httpclient.base; +package com.baeldung.httpclient.base; +import com.baeldung.httpclient.ResponseUtil; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpHeaders; @@ -11,7 +12,6 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.BasicHttpClientConnectionManager; -import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientSandboxLiveTest.java similarity index 94% rename from httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientSandboxLiveTest.java index d945d075f2..c667ae36f6 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/base/HttpClientSandboxLiveTest.java @@ -1,5 +1,6 @@ -package org.baeldung.httpclient.base; +package com.baeldung.httpclient.base; +import com.baeldung.httpclient.ResponseUtil; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; @@ -8,7 +9,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.baeldung.httpclient.ResponseUtil; import org.junit.Test; import java.io.IOException; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java index cf945098db..823b506113 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.conn; +package com.baeldung.httpclient.conn; import org.apache.http.HeaderElement; import org.apache.http.HeaderElementIterator; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java b/httpclient/src/test/java/com/baeldung/httpclient/conn/IdleConnectionMonitorThread.java similarity index 96% rename from httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java rename to httpclient/src/test/java/com/baeldung/httpclient/conn/IdleConnectionMonitorThread.java index ffe4155a78..f1d7cbc427 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/conn/IdleConnectionMonitorThread.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.conn; +package com.baeldung.httpclient.conn; import java.util.concurrent.TimeUnit; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java b/httpclient/src/test/java/com/baeldung/httpclient/conn/MultiHttpClientConnThread.java similarity index 98% rename from httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java rename to httpclient/src/test/java/com/baeldung/httpclient/conn/MultiHttpClientConnThread.java index 3794943f02..acadd1f240 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/conn/MultiHttpClientConnThread.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.conn; +package com.baeldung.httpclient.conn; import java.io.IOException; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java b/httpclient/src/test/java/com/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java similarity index 97% rename from httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java rename to httpclient/src/test/java/com/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java index 9cc6480e74..a50858672e 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.conn; +package com.baeldung.httpclient.conn; import java.io.IOException; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java b/httpclient/src/test/java/com/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java similarity index 99% rename from httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java rename to httpclient/src/test/java/com/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java index 8fc79baed9..efa7953ba8 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java +++ b/httpclient/src/test/java/com/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.httpclient.rare; +package com.baeldung.httpclient.rare; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; diff --git a/intelliJ/remote-debugging/README.adoc b/intelliJ/remote-debugging/README.adoc index 6a4b80959f..7110a5d7b9 100644 --- a/intelliJ/remote-debugging/README.adoc +++ b/intelliJ/remote-debugging/README.adoc @@ -82,3 +82,4 @@ The following guides may also be helpful: * https://spring.io/guides/gs/batch-processing/[Creating a Batch Service] include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/footer.adoc[] + diff --git a/jackson-annotations/README.md b/jackson-modules/jackson-annotations/README.md similarity index 100% rename from jackson-annotations/README.md rename to jackson-modules/jackson-annotations/README.md diff --git a/jackson-annotations/pom.xml b/jackson-modules/jackson-annotations/pom.xml similarity index 76% rename from jackson-annotations/pom.xml rename to jackson-modules/jackson-annotations/pom.xml index a259d895da..e4a41a5825 100644 --- a/jackson-annotations/pom.xml +++ b/jackson-modules/jackson-annotations/pom.xml @@ -8,22 +8,11 @@ com.baeldung - parent-java + jackson-modules 0.0.1-SNAPSHOT - ../parent-java - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - com.fasterxml.jackson.module jackson-module-jsonSchema diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListDeserializer.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListDeserializer.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListDeserializer.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListDeserializer.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListSerializer.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListSerializer.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListSerializer.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/CustomListSerializer.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/Item.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/Item.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/Item.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/Item.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIdentity.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithIgnore.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithRef.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithRef.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithRef.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithRef.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithSerializer.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithSerializer.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithSerializer.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithSerializer.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithView.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithView.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithView.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/ItemWithView.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/User.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/User.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/User.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/User.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIdentity.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIdentity.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIdentity.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIdentity.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIgnore.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIgnore.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIgnore.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithIgnore.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithRef.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithRef.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithRef.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithRef.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithSerializer.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithSerializer.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithSerializer.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithSerializer.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithView.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithView.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithView.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/UserWithView.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/jsonview/Views.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/jsonview/Views.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/jsonview/Views.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/bidirection/jsonview/Views.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/domain/Person.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/domain/Person.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/domain/Person.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/domain/Person.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/format/User.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/format/User.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/format/User.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/format/User.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Item.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Item.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Item.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Item.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/MyBeanSerializerModifier.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/MyBeanSerializerModifier.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/MyBeanSerializerModifier.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/MyBeanSerializerModifier.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/UpperCasingWriter.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/UpperCasingWriter.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/UpperCasingWriter.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/UpperCasingWriter.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/User.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/User.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/User.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/User.java diff --git a/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Views.java b/jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Views.java similarity index 100% rename from jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Views.java rename to jackson-modules/jackson-annotations/src/main/java/com/baeldung/jackson/jsonview/Views.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AdvancedAnnotationsUnitTest.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AdvancedAnnotationsUnitTest.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AdvancedAnnotationsUnitTest.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AdvancedAnnotationsUnitTest.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AppendBeans.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AppendBeans.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AppendBeans.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/AppendBeans.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/IdentityReferenceBeans.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/IdentityReferenceBeans.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/IdentityReferenceBeans.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/IdentityReferenceBeans.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/NamingBean.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/NamingBean.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/NamingBean.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/NamingBean.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/POJOBuilderBean.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/POJOBuilderBean.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/POJOBuilderBean.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/POJOBuilderBean.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/PropertyDescriptionBean.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/PropertyDescriptionBean.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/PropertyDescriptionBean.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/PropertyDescriptionBean.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdBean.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdBean.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdBean.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdBean.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdResolverStructure.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdResolverStructure.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdResolverStructure.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/advancedannotations/TypeIdResolverStructure.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/bidirection/JacksonBidirectionRelationUnitTest.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/bidirection/JacksonBidirectionRelationUnitTest.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/bidirection/JacksonBidirectionRelationUnitTest.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/bidirection/JacksonBidirectionRelationUnitTest.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java diff --git a/jackson-annotations/src/test/java/com/baeldung/jackson/jsonview/JacksonJsonViewUnitTest.java b/jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/jsonview/JacksonJsonViewUnitTest.java similarity index 100% rename from jackson-annotations/src/test/java/com/baeldung/jackson/jsonview/JacksonJsonViewUnitTest.java rename to jackson-modules/jackson-annotations/src/test/java/com/baeldung/jackson/jsonview/JacksonJsonViewUnitTest.java diff --git a/jackson-conversions-2/README.md b/jackson-modules/jackson-conversions-2/README.md similarity index 100% rename from jackson-conversions-2/README.md rename to jackson-modules/jackson-conversions-2/README.md diff --git a/jackson-conversions-2/pom.xml b/jackson-modules/jackson-conversions-2/pom.xml similarity index 77% rename from jackson-conversions-2/pom.xml rename to jackson-modules/jackson-conversions-2/pom.xml index 732c89c1e5..43c9d1478b 100644 --- a/jackson-conversions-2/pom.xml +++ b/jackson-modules/jackson-conversions-2/pom.xml @@ -8,23 +8,11 @@ com.baeldung - parent-java + jackson-modules 0.0.1-SNAPSHOT - ../parent-java - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - com.fasterxml.jackson.dataformat diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/JsonCsvConverter.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLine.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLine.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLine.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLine.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLineForCsv.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLineForCsv.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLineForCsv.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/csv/OrderLineForCsv.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/Product.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/Product.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/Product.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/Product.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductJsonNode.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductJsonNode.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductJsonNode.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductJsonNode.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductMap.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductMap.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductMap.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/dynamicobject/ProductMap.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/multiplefields/Weather.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/multiplefields/Weather.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/multiplefields/Weather.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/multiplefields/Weather.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Color.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Color.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Color.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Color.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/Order.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/Order.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/Order.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/Order.java diff --git a/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/OrderLine.java b/jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/OrderLine.java similarity index 100% rename from jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/OrderLine.java rename to jackson-modules/jackson-conversions-2/src/main/java/com/baeldung/jackson/yaml/OrderLine.java diff --git a/jackson-conversions-2/src/main/resources/csv/orderLines.csv b/jackson-modules/jackson-conversions-2/src/main/resources/csv/orderLines.csv similarity index 100% rename from jackson-conversions-2/src/main/resources/csv/orderLines.csv rename to jackson-modules/jackson-conversions-2/src/main/resources/csv/orderLines.csv diff --git a/jackson-conversions-2/src/main/resources/csv/orderLines.json b/jackson-modules/jackson-conversions-2/src/main/resources/csv/orderLines.json similarity index 100% rename from jackson-conversions-2/src/main/resources/csv/orderLines.json rename to jackson-modules/jackson-conversions-2/src/main/resources/csv/orderLines.json diff --git a/jackson-conversions-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java b/jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java similarity index 100% rename from jackson-conversions-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java rename to jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/csv/CsvUnitTest.java diff --git a/jackson-conversions-2/src/test/java/com/baeldung/jackson/dynamicobject/DynamicObjectDeserializationUnitTest.java b/jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/dynamicobject/DynamicObjectDeserializationUnitTest.java similarity index 100% rename from jackson-conversions-2/src/test/java/com/baeldung/jackson/dynamicobject/DynamicObjectDeserializationUnitTest.java rename to jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/dynamicobject/DynamicObjectDeserializationUnitTest.java diff --git a/jackson-conversions-2/src/test/java/com/baeldung/jackson/multiplefields/MapMultipleFieldsToSingleFieldUnitTest.java b/jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/multiplefields/MapMultipleFieldsToSingleFieldUnitTest.java similarity index 100% rename from jackson-conversions-2/src/test/java/com/baeldung/jackson/multiplefields/MapMultipleFieldsToSingleFieldUnitTest.java rename to jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/multiplefields/MapMultipleFieldsToSingleFieldUnitTest.java diff --git a/jackson-conversions-2/src/test/java/com/baeldung/jackson/streaming/StreamingAPIUnitTest.java b/jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/streaming/StreamingAPIUnitTest.java similarity index 100% rename from jackson-conversions-2/src/test/java/com/baeldung/jackson/streaming/StreamingAPIUnitTest.java rename to jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/streaming/StreamingAPIUnitTest.java diff --git a/jackson-conversions-2/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java b/jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java similarity index 100% rename from jackson-conversions-2/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java rename to jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java diff --git a/jackson-conversions-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java b/jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java similarity index 100% rename from jackson-conversions-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java rename to jackson-modules/jackson-conversions-2/src/test/java/com/baeldung/jackson/yaml/YamlUnitTest.java diff --git a/jackson-conversions-2/src/test/resources/csv/expectedCsvFromJson.csv b/jackson-modules/jackson-conversions-2/src/test/resources/csv/expectedCsvFromJson.csv similarity index 100% rename from jackson-conversions-2/src/test/resources/csv/expectedCsvFromJson.csv rename to jackson-modules/jackson-conversions-2/src/test/resources/csv/expectedCsvFromJson.csv diff --git a/jackson-conversions-2/src/test/resources/csv/expectedFormattedCsvFromJson.csv b/jackson-modules/jackson-conversions-2/src/test/resources/csv/expectedFormattedCsvFromJson.csv similarity index 100% rename from jackson-conversions-2/src/test/resources/csv/expectedFormattedCsvFromJson.csv rename to jackson-modules/jackson-conversions-2/src/test/resources/csv/expectedFormattedCsvFromJson.csv diff --git a/jackson-conversions-2/src/test/resources/csv/expectedJsonFromCsv.json b/jackson-modules/jackson-conversions-2/src/test/resources/csv/expectedJsonFromCsv.json similarity index 100% rename from jackson-conversions-2/src/test/resources/csv/expectedJsonFromCsv.json rename to jackson-modules/jackson-conversions-2/src/test/resources/csv/expectedJsonFromCsv.json diff --git a/jackson-conversions-2/src/test/resources/deserialize-dynamic-object/embedded.json b/jackson-modules/jackson-conversions-2/src/test/resources/deserialize-dynamic-object/embedded.json similarity index 100% rename from jackson-conversions-2/src/test/resources/deserialize-dynamic-object/embedded.json rename to jackson-modules/jackson-conversions-2/src/test/resources/deserialize-dynamic-object/embedded.json diff --git a/jackson-conversions-2/src/test/resources/deserialize-dynamic-object/flat.json b/jackson-modules/jackson-conversions-2/src/test/resources/deserialize-dynamic-object/flat.json similarity index 100% rename from jackson-conversions-2/src/test/resources/deserialize-dynamic-object/flat.json rename to jackson-modules/jackson-conversions-2/src/test/resources/deserialize-dynamic-object/flat.json diff --git a/jackson-conversions-2/src/test/resources/yaml/orderInput.yaml b/jackson-modules/jackson-conversions-2/src/test/resources/yaml/orderInput.yaml similarity index 100% rename from jackson-conversions-2/src/test/resources/yaml/orderInput.yaml rename to jackson-modules/jackson-conversions-2/src/test/resources/yaml/orderInput.yaml diff --git a/jackson-conversions/README.md b/jackson-modules/jackson-conversions/README.md similarity index 100% rename from jackson-conversions/README.md rename to jackson-modules/jackson-conversions/README.md diff --git a/jackson-conversions/pom.xml b/jackson-modules/jackson-conversions/pom.xml similarity index 69% rename from jackson-conversions/pom.xml rename to jackson-modules/jackson-conversions/pom.xml index c45d88bedd..fafb731cc9 100644 --- a/jackson-conversions/pom.xml +++ b/jackson-modules/jackson-conversions/pom.xml @@ -8,17 +8,11 @@ com.baeldung - parent-java + jackson-modules 0.0.1-SNAPSHOT - ../parent-java - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - com.fasterxml.jackson.datatype jackson-datatype-joda @@ -29,12 +23,6 @@ jackson-datatype-jsr310 ${jackson.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateDeserializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateDeserializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateDeserializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateDeserializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateSerializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateSerializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateSerializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateSerializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateTimeSerializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateTimeSerializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateTimeSerializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomDateTimeSerializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/Event.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/Event.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/Event.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/Event.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithFormat.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithFormat.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithFormat.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithFormat.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithJodaTime.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithJodaTime.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithJodaTime.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithJodaTime.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithLocalDateTime.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithLocalDateTime.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithLocalDateTime.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithLocalDateTime.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithSerializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithSerializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithSerializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/date/EventWithSerializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/City.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/City.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/City.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/City.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/Distance.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/Distance.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/Distance.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/Distance.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/City.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/City.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/City.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/City.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/CustomEnumDeserializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/CustomEnumDeserializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/CustomEnumDeserializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/CustomEnumDeserializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/Distance.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/Distance.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/Distance.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/customdeserializer/Distance.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/City.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/City.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/City.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/City.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/Distance.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/Distance.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/Distance.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsoncreator/Distance.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/City.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/City.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/City.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/City.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/Distance.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/Distance.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/Distance.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonproperty/Distance.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/City.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/City.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/City.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/City.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/Distance.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/Distance.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/Distance.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/deserialization/jsonvalue/Distance.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/Distance.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/Distance.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/Distance.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/Distance.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/DistanceSerializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/DistanceSerializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/DistanceSerializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/serialization/DistanceSerializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumSimple.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumSimple.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumSimple.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumSimple.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithJsonFormat.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithJsonFormat.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithJsonFormat.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithJsonFormat.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithValue.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithValue.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithValue.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/DistanceEnumWithValue.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumCustom.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumCustom.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumCustom.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumCustom.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumJsonFormat.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumJsonFormat.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumJsonFormat.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/enums/withEnum/MyDtoWithEnumJsonFormat.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDto.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDto.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDto.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDto.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoAccessLevel.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoAccessLevel.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoAccessLevel.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoAccessLevel.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithGetter.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithGetter.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithGetter.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithGetter.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithSetter.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithSetter.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithSetter.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/field/MyDtoWithSetter.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Employee.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Employee.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Employee.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Employee.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Person.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Person.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Person.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/immutable/Person.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/map/ClassWithAMap.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/map/ClassWithAMap.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/map/ClassWithAMap.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/map/ClassWithAMap.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPair.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPair.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPair.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPair.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairDeserializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairDeserializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairDeserializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairDeserializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairSerializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairSerializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairSerializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/map/MyPairSerializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDto.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDto.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDto.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDto.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDtoNullKeySerializer.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDtoNullKeySerializer.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDtoNullKeySerializer.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/mapnull/MyDtoNullKeySerializer.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/tocollection/MyDto.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/tocollection/MyDto.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/tocollection/MyDto.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/tocollection/MyDto.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Address.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Address.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/xml/Address.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Address.java diff --git a/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Person.java b/jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Person.java similarity index 100% rename from jackson-conversions/src/main/java/com/baeldung/jackson/xml/Person.java rename to jackson-modules/jackson-conversions/src/main/java/com/baeldung/jackson/xml/Person.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/date/JacksonDateUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/date/JacksonDateUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/date/JacksonDateUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/date/JacksonDateUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/DefaultEnumDeserializationUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/DefaultEnumDeserializationUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/DefaultEnumDeserializationUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/DefaultEnumDeserializationUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/customdeserializer/EnumCustomDeserializationUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/customdeserializer/EnumCustomDeserializationUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/customdeserializer/EnumCustomDeserializationUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/customdeserializer/EnumCustomDeserializationUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsoncreator/EnumDeserializationUsingJsonCreatorUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonproperty/EnumDeserializationUsingJsonPropertyUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/deserialization/jsonvalue/EnumDeserializationUsingJsonValueUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonEnumSerializationUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonEnumSerializationUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonEnumSerializationUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonEnumSerializationUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonSerializationEnumsUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonSerializationEnumsUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonSerializationEnumsUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/enums/serialization/JacksonSerializationEnumsUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/field/JacksonFieldUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/field/JacksonFieldUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/field/JacksonFieldUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/field/JacksonFieldUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/immutable/ImmutableObjectDeserializationUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/immutable/ImmutableObjectDeserializationUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/immutable/ImmutableObjectDeserializationUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/immutable/ImmutableObjectDeserializationUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapDeserializeUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapDeserializeUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapDeserializeUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapDeserializeUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapSerializeUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapSerializeUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapSerializeUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/map/JacksonMapSerializeUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/mapnull/JacksonMapNullUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/mapnull/JacksonMapNullUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/mapnull/JacksonMapNullUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/mapnull/JacksonMapNullUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/nested/DeserializeWithNestedPropertiesUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/nested/DeserializeWithNestedPropertiesUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/nested/DeserializeWithNestedPropertiesUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/nested/DeserializeWithNestedPropertiesUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/nested/Product.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/nested/Product.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/nested/Product.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/nested/Product.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/nested/ProductDeserializer.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/nested/ProductDeserializer.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/nested/ProductDeserializer.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/nested/ProductDeserializer.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/tocollection/JacksonCollectionDeserializationUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/tocollection/JacksonCollectionDeserializationUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/tocollection/JacksonCollectionDeserializationUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/tocollection/JacksonCollectionDeserializationUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/tojsonnode/StringToJsonNodeUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/tojsonnode/StringToJsonNodeUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/tojsonnode/StringToJsonNodeUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/tojsonnode/StringToJsonNodeUnitTest.java diff --git a/jackson-conversions/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java b/jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java similarity index 100% rename from jackson-conversions/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java rename to jackson-modules/jackson-conversions/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java diff --git a/jackson-conversions/src/test/resources/simple_bean.xml b/jackson-modules/jackson-conversions/src/test/resources/simple_bean.xml similarity index 100% rename from jackson-conversions/src/test/resources/simple_bean.xml rename to jackson-modules/jackson-conversions/src/test/resources/simple_bean.xml diff --git a/jackson-custom-conversions/README.md b/jackson-modules/jackson-custom-conversions/README.md similarity index 100% rename from jackson-custom-conversions/README.md rename to jackson-modules/jackson-custom-conversions/README.md diff --git a/jackson-custom-conversions/pom.xml b/jackson-modules/jackson-custom-conversions/pom.xml similarity index 81% rename from jackson-custom-conversions/pom.xml rename to jackson-modules/jackson-custom-conversions/pom.xml index 68c785e972..c319891da9 100644 --- a/jackson-custom-conversions/pom.xml +++ b/jackson-modules/jackson-custom-conversions/pom.xml @@ -8,17 +8,11 @@ com.baeldung - parent-java + jackson-modules 0.0.1-SNAPSHOT - ../parent-java - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/File.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/File.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/File.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/File.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/Folder.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/Folder.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/Folder.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/Folder.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderBeanSerializerModifier.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderBeanSerializerModifier.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderBeanSerializerModifier.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderBeanSerializerModifier.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializer.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializer.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializer.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializer.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithCallingOwnSerializer.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithCallingOwnSerializer.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithCallingOwnSerializer.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithCallingOwnSerializer.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithDefaultSerializerStored.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithDefaultSerializerStored.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithDefaultSerializerStored.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithDefaultSerializerStored.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithInternalObjectMapper.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithInternalObjectMapper.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithInternalObjectMapper.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithInternalObjectMapper.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithSerializerProvider.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithSerializerProvider.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithSerializerProvider.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/defaultserializercustomserializer/FolderSerializerWithSerializerProvider.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ActorJackson.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ActorJackson.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ActorJackson.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ActorJackson.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Item.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Item.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Item.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Item.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializer.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializer.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializer.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializer.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializerOnClass.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializerOnClass.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializerOnClass.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemDeserializerOnClass.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemWithDeserializer.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemWithDeserializer.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemWithDeserializer.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/ItemWithDeserializer.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Movie.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Movie.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Movie.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/Movie.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/User.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/User.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/deserialization/User.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/deserialization/User.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/serialization/Item.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/Item.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/serialization/Item.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/Item.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializer.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializer.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializer.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializer.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializerOnClass.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializerOnClass.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializerOnClass.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemSerializerOnClass.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemWithSerializer.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemWithSerializer.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemWithSerializer.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/ItemWithSerializer.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/serialization/User.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/User.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/serialization/User.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/serialization/User.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Address.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Address.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Address.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Address.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Hidable.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Hidable.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Hidable.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Hidable.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/HidableSerializer.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/HidableSerializer.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/skipfields/HidableSerializer.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/HidableSerializer.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/MyDtoWithFilter.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/MyDtoWithFilter.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/skipfields/MyDtoWithFilter.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/MyDtoWithFilter.java diff --git a/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Person.java b/jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Person.java similarity index 100% rename from jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Person.java rename to jackson-modules/jackson-custom-conversions/src/main/java/com/baeldung/skipfields/Person.java diff --git a/jackson-custom-conversions/src/test/java/com/baeldung/defaultserializercustomserializer/CallingDefaultSerializerUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/defaultserializercustomserializer/CallingDefaultSerializerUnitTest.java similarity index 100% rename from jackson-custom-conversions/src/test/java/com/baeldung/defaultserializercustomserializer/CallingDefaultSerializerUnitTest.java rename to jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/defaultserializercustomserializer/CallingDefaultSerializerUnitTest.java diff --git a/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 similarity index 100% rename from jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java rename to jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java diff --git a/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 similarity index 100% rename from jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java rename to jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java diff --git a/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 similarity index 100% rename from jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java rename to jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java diff --git a/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 similarity index 100% rename from jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java rename to jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java diff --git a/jackson-exceptions/README.md b/jackson-modules/jackson-exceptions/README.md similarity index 100% rename from jackson-exceptions/README.md rename to jackson-modules/jackson-exceptions/README.md diff --git a/jackson-exceptions/pom.xml b/jackson-modules/jackson-exceptions/pom.xml similarity index 70% rename from jackson-exceptions/pom.xml rename to jackson-modules/jackson-exceptions/pom.xml index 3cf4796fa7..1a52892523 100644 --- a/jackson-exceptions/pom.xml +++ b/jackson-modules/jackson-exceptions/pom.xml @@ -8,19 +8,10 @@ com.baeldung - parent-java + jackson-modules 0.0.1-SNAPSHOT - ../parent-java - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - jackson-exceptions diff --git a/jackson-exceptions/src/main/java/com/baeldung/exceptions/User.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/User.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/exceptions/User.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/User.java diff --git a/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithConflict.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithConflict.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithConflict.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithConflict.java diff --git a/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithNoDefaultConstructor.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithNoDefaultConstructor.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithNoDefaultConstructor.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithNoDefaultConstructor.java diff --git a/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithPrivateFields.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithPrivateFields.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithPrivateFields.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithPrivateFields.java diff --git a/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithRoot.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithRoot.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithRoot.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/UserWithRoot.java diff --git a/jackson-exceptions/src/main/java/com/baeldung/exceptions/Zoo.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/Zoo.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/exceptions/Zoo.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/Zoo.java diff --git a/jackson-exceptions/src/main/java/com/baeldung/exceptions/ZooConfigured.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/ZooConfigured.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/exceptions/ZooConfigured.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/exceptions/ZooConfigured.java diff --git a/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessors.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessors.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessors.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessors.java diff --git a/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessorsAndFieldVisibility.java b/jackson-modules/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessorsAndFieldVisibility.java similarity index 100% rename from jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessorsAndFieldVisibility.java rename to jackson-modules/jackson-exceptions/src/main/java/com/baeldung/mappingexception/MyDtoNoAccessorsAndFieldVisibility.java diff --git a/jackson-exceptions/src/test/java/com/baeldung/exceptions/JacksonExceptionsUnitTest.java b/jackson-modules/jackson-exceptions/src/test/java/com/baeldung/exceptions/JacksonExceptionsUnitTest.java similarity index 100% rename from jackson-exceptions/src/test/java/com/baeldung/exceptions/JacksonExceptionsUnitTest.java rename to jackson-modules/jackson-exceptions/src/test/java/com/baeldung/exceptions/JacksonExceptionsUnitTest.java diff --git a/jackson-exceptions/src/test/java/com/baeldung/mappingexception/JacksonMappingExceptionUnitTest.java b/jackson-modules/jackson-exceptions/src/test/java/com/baeldung/mappingexception/JacksonMappingExceptionUnitTest.java similarity index 100% rename from jackson-exceptions/src/test/java/com/baeldung/mappingexception/JacksonMappingExceptionUnitTest.java rename to jackson-modules/jackson-exceptions/src/test/java/com/baeldung/mappingexception/JacksonMappingExceptionUnitTest.java diff --git a/jackson-simple/README.md b/jackson-modules/jackson-simple/README.md similarity index 100% rename from jackson-simple/README.md rename to jackson-modules/jackson-simple/README.md diff --git a/jackson-simple/pom.xml b/jackson-modules/jackson-simple/pom.xml similarity index 75% rename from jackson-simple/pom.xml rename to jackson-modules/jackson-simple/pom.xml index cdda031e0f..fef28e4359 100644 --- a/jackson-simple/pom.xml +++ b/jackson-modules/jackson-simple/pom.xml @@ -3,24 +3,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 jackson-simple - 0.1-SNAPSHOT + 0.0.1-SNAPSHOT jackson-simple com.baeldung - parent-java + jackson-modules 0.0.1-SNAPSHOT - ../parent-java - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - - org.assertj diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/AliasBean.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/AliasBean.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/AliasBean.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/AliasBean.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCreator.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCreator.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCreator.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCreator.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCustomAnnotation.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCustomAnnotation.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCustomAnnotation.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithCustomAnnotation.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithFilter.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithFilter.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithFilter.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithFilter.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithGetter.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithGetter.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithGetter.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithGetter.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithIgnore.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithIgnore.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithIgnore.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithIgnore.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithInject.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithInject.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithInject.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/BeanWithInject.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ExtendableBean.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ExtendableBean.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/ExtendableBean.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ExtendableBean.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/MyBean.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/MyBean.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/MyBean.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/MyBean.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/PrivateBean.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/PrivateBean.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/PrivateBean.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/PrivateBean.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/RawBean.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/RawBean.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/RawBean.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/RawBean.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/UnwrappedUser.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/UnwrappedUser.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/UnwrappedUser.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/UnwrappedUser.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/UserWithIgnoreType.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/UserWithIgnoreType.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/UserWithIgnoreType.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/UserWithIgnoreType.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/Zoo.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/Zoo.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/Zoo.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/Zoo.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIdentity.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIdentity.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIdentity.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIdentity.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIgnore.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIgnore.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIgnore.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithIgnore.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithRef.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithRef.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithRef.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/ItemWithRef.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIdentity.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIdentity.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIdentity.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIdentity.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIgnore.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIgnore.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIgnore.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithIgnore.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithRef.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithRef.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithRef.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/bidirection/UserWithRef.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateDeserializer.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateDeserializer.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateDeserializer.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateDeserializer.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateSerializer.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateSerializer.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateSerializer.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/CustomDateSerializer.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithFormat.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithFormat.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithFormat.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithFormat.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithSerializer.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithSerializer.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithSerializer.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/date/EventWithSerializer.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/deserialization/ItemDeserializerOnClass.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/deserialization/ItemDeserializerOnClass.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/deserialization/ItemDeserializerOnClass.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/deserialization/ItemDeserializerOnClass.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/Item.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/Item.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/Item.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/Item.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/ItemWithSerializer.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/ItemWithSerializer.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/ItemWithSerializer.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/ItemWithSerializer.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/User.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/User.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/User.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/User.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/withEnum/DistanceEnumWithValue.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/withEnum/DistanceEnumWithValue.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/withEnum/DistanceEnumWithValue.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/dtos/withEnum/DistanceEnumWithValue.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRoot.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRoot.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRoot.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRoot.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRootNamespace.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRootNamespace.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRootNamespace.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/exception/UserWithRootNamespace.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ignore/MyMixInForIgnoreType.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ignore/MyMixInForIgnoreType.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/ignore/MyMixInForIgnoreType.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/ignore/MyMixInForIgnoreType.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Item.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Item.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Item.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Item.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Views.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Views.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Views.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/jsonview/Views.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializer.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializer.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializer.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializer.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializerOnClass.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializerOnClass.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializerOnClass.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/annotation/serialization/ItemSerializerOnClass.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDto.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDto.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDto.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDto.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreField.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreField.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreField.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreField.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreFieldByName.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreFieldByName.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreFieldByName.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreFieldByName.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreNull.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreNull.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreNull.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIgnoreNull.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIncludeNonDefault.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIncludeNonDefault.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIncludeNonDefault.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoIncludeNonDefault.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithFilter.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithFilter.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithFilter.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithFilter.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithSpecialField.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithSpecialField.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithSpecialField.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyDtoWithSpecialField.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyMixInForIgnoreType.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyMixInForIgnoreType.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyMixInForIgnoreType.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignore/MyMixInForIgnoreType.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDto.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDto.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDto.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDto.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDtoIgnoreNull.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDtoIgnoreNull.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDtoIgnoreNull.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/ignorenullfields/MyDtoIgnoreNull.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDto.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDto.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDto.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDto.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDtoFieldNameChanged.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDtoFieldNameChanged.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDtoFieldNameChanged.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/jsonproperty/MyDtoFieldNameChanged.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Car.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Car.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Car.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Car.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Request.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Request.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Request.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/objectmapper/dto/Request.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDto.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDto.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDto.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDto.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreType.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreType.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreType.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreType.java diff --git a/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreUnknown.java b/jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreUnknown.java similarity index 100% rename from jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreUnknown.java rename to jackson-modules/jackson-simple/src/main/java/com/baeldung/jackson/unknownproperties/MyDtoIgnoreUnknown.java diff --git a/jackson-simple/src/main/resources/logback.xml b/jackson-modules/jackson-simple/src/main/resources/logback.xml similarity index 100% rename from jackson-simple/src/main/resources/logback.xml rename to jackson-modules/jackson-simple/src/main/resources/logback.xml diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/annotation/JacksonAnnotationUnitTest.java b/jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/annotation/JacksonAnnotationUnitTest.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/annotation/JacksonAnnotationUnitTest.java rename to jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/annotation/JacksonAnnotationUnitTest.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/IgnoreFieldsWithFilterUnitTest.java b/jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/ignore/IgnoreFieldsWithFilterUnitTest.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/ignore/IgnoreFieldsWithFilterUnitTest.java rename to jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/ignore/IgnoreFieldsWithFilterUnitTest.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignore/JacksonSerializationIgnoreUnitTest.java b/jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/ignore/JacksonSerializationIgnoreUnitTest.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/ignore/JacksonSerializationIgnoreUnitTest.java rename to jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/ignore/JacksonSerializationIgnoreUnitTest.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/ignorenullfields/IgnoreNullFieldsUnitTest.java b/jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/ignorenullfields/IgnoreNullFieldsUnitTest.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/ignorenullfields/IgnoreNullFieldsUnitTest.java rename to jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/ignorenullfields/IgnoreNullFieldsUnitTest.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/jsonproperty/JsonPropertyUnitTest.java b/jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/jsonproperty/JsonPropertyUnitTest.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/jsonproperty/JsonPropertyUnitTest.java rename to jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/jsonproperty/JsonPropertyUnitTest.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java b/jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java rename to jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java b/jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java rename to jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java diff --git a/jackson-simple/src/test/java/com/baeldung/jackson/unknownproperties/UnknownPropertiesUnitTest.java b/jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/unknownproperties/UnknownPropertiesUnitTest.java similarity index 100% rename from jackson-simple/src/test/java/com/baeldung/jackson/unknownproperties/UnknownPropertiesUnitTest.java rename to jackson-modules/jackson-simple/src/test/java/com/baeldung/jackson/unknownproperties/UnknownPropertiesUnitTest.java diff --git a/jackson-simple/src/test/resources/json_car.json b/jackson-modules/jackson-simple/src/test/resources/json_car.json similarity index 100% rename from jackson-simple/src/test/resources/json_car.json rename to jackson-modules/jackson-simple/src/test/resources/json_car.json diff --git a/jackson/README.md b/jackson-modules/jackson/README.md similarity index 100% rename from jackson/README.md rename to jackson-modules/jackson/README.md diff --git a/jackson/pom.xml b/jackson-modules/jackson/pom.xml similarity index 86% rename from jackson/pom.xml rename to jackson-modules/jackson/pom.xml index d7fc3aac9a..615076fc93 100644 --- a/jackson/pom.xml +++ b/jackson-modules/jackson/pom.xml @@ -3,26 +3,17 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 jackson - 0.1-SNAPSHOT + 0.0.1-SNAPSHOT jackson com.baeldung - parent-java + jackson-modules 0.0.1-SNAPSHOT - ../parent-java - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - - - com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Person.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Person.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Person.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Person.java diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonanysetter/Inventory.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonanysetter/Inventory.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/jsonanysetter/Inventory.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonanysetter/Inventory.java diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/CustomDateDeserializer.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/CustomDateDeserializer.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/CustomDateDeserializer.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/CustomDateDeserializer.java diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Person.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/domain/Person.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/domain/Person.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/domain/Person.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/Event.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/Event.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/Event.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/Event.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceAnnotationStructure.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceAnnotationStructure.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceAnnotationStructure.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceAnnotationStructure.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceMixinOrIntrospection.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceMixinOrIntrospection.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceMixinOrIntrospection.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/IgnoranceMixinOrIntrospection.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdAddedToUser.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdAddedToUser.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdAddedToUser.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdAddedToUser.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUser.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUser.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUser.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUser.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConstructorStructure.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConstructorStructure.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConstructorStructure.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConstructorStructure.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConversionStructure.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConversionStructure.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConversionStructure.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/SubTypeConversionStructure.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoAnnotatedStructure.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoAnnotatedStructure.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoAnnotatedStructure.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoAnnotatedStructure.java diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoStructure.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoStructure.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoStructure.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/inheritance/TypeInfoStructure.java diff --git a/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJackson.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJackson.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJackson.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJackson.java diff --git a/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJacksonSerializer.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJacksonSerializer.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJacksonSerializer.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/ActorJacksonSerializer.java diff --git a/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/Movie.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/Movie.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/Movie.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/Movie.java diff --git a/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/MovieWithNullValue.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/MovieWithNullValue.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/MovieWithNullValue.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/jacksonvsgson/MovieWithNullValue.java diff --git a/jackson/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/node/JsonNodeIterator.java diff --git a/jackson/src/main/java/com/baeldung/jackson/optionalwithjackson/Book.java b/jackson-modules/jackson/src/main/java/com/baeldung/jackson/optionalwithjackson/Book.java similarity index 100% rename from jackson/src/main/java/com/baeldung/jackson/optionalwithjackson/Book.java rename to jackson-modules/jackson/src/main/java/com/baeldung/jackson/optionalwithjackson/Book.java diff --git a/jackson/src/main/resources/example1.json b/jackson-modules/jackson/src/main/resources/example1.json similarity index 100% rename from jackson/src/main/resources/example1.json rename to jackson-modules/jackson/src/main/resources/example1.json diff --git a/jackson/src/main/resources/example2.json b/jackson-modules/jackson/src/main/resources/example2.json similarity index 100% rename from jackson/src/main/resources/example2.json rename to jackson-modules/jackson/src/main/resources/example2.json diff --git a/jackson/src/main/resources/logback.xml b/jackson-modules/jackson/src/main/resources/logback.xml similarity index 100% rename from jackson/src/main/resources/logback.xml rename to jackson-modules/jackson/src/main/resources/logback.xml diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/Address.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/dtos/Address.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/dtos/Address.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/dtos/Address.java diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/MyDto.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/dtos/MyDto.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/dtos/MyDto.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/dtos/MyDto.java diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/Person.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/dtos/Person.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/dtos/Person.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/dtos/Person.java diff --git a/jackson/src/test/java/com/baeldung/jackson/dtos/User.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/dtos/User.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/dtos/User.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/dtos/User.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/IgnoranceUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/inheritance/IgnoranceUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/IgnoranceUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/inheritance/IgnoranceUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUserUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUserUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUserUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUserUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeHandlingUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeHandlingUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeHandlingUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeHandlingUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoInclusionUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoInclusionUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoInclusionUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoInclusionUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonDeserializeUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonDeserializeUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonDeserializeUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonDeserializeUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonSerializeUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonSerializeUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonSerializeUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/jacksonvsgson/JacksonSerializeUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/jsoncompare/JsonCompareUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/jsoncompare/JsonCompareUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/jsoncompare/JsonCompareUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/jsoncompare/JsonCompareUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java diff --git a/jackson/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/node/NodeBean.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/node/NodeBean.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/node/NodeBean.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/node/NodeBean.java diff --git a/jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/optionalwithjackson/OptionalTypeUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/optionalwithjackson/OptionalTypeUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/optionalwithjackson/OptionalTypeUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/optionalwithjackson/OptionalTypeUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/sandbox/JacksonPrettyPrintUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/sandbox/JacksonPrettyPrintUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/sandbox/JacksonPrettyPrintUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/sandbox/JacksonPrettyPrintUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/sandbox/TestElement.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/sandbox/TestElement.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/sandbox/TestElement.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/sandbox/TestElement.java diff --git a/jackson/src/test/java/com/baeldung/jackson/test/UnitTestSuite.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/test/UnitTestSuite.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/test/UnitTestSuite.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/test/UnitTestSuite.java diff --git a/jackson/src/test/java/com/baeldung/jackson/try1/IEntity.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/try1/IEntity.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/try1/IEntity.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/try1/IEntity.java diff --git a/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequest.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequest.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequest.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequest.java diff --git a/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequestDeserializer.java b/jackson-modules/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequestDeserializer.java similarity index 100% rename from jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequestDeserializer.java rename to jackson-modules/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequestDeserializer.java diff --git a/jackson/src/test/resources/author-jsonpropertyorder-schema.json b/jackson-modules/jackson/src/test/resources/author-jsonpropertyorder-schema.json similarity index 100% rename from jackson/src/test/resources/author-jsonpropertyorder-schema.json rename to jackson-modules/jackson/src/test/resources/author-jsonpropertyorder-schema.json diff --git a/jackson/src/test/resources/node_example.json b/jackson-modules/jackson/src/test/resources/node_example.json similarity index 100% rename from jackson/src/test/resources/node_example.json rename to jackson-modules/jackson/src/test/resources/node_example.json diff --git a/jackson-modules/pom.xml b/jackson-modules/pom.xml new file mode 100644 index 0000000000..a8568c1950 --- /dev/null +++ b/jackson-modules/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + jackson-modules + jackson-modules + pom + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + jackson + jackson-annotations + jackson-conversions + jackson-conversions-2 + jackson-custom-conversions + jackson-exceptions + jackson-simple + + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + + + \ No newline at end of file diff --git a/java-numbers-3/pom.xml b/java-numbers-3/pom.xml new file mode 100644 index 0000000000..3dd8e16bc7 --- /dev/null +++ b/java-numbers-3/pom.xml @@ -0,0 +1,26 @@ + + 4.0.0 + java-numbers-3 + java-numbers-3 + jar + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + java-numbers-3 + + + src/main/resources + true + + + + + diff --git a/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java b/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java new file mode 100644 index 0000000000..702c59c12b --- /dev/null +++ b/java-numbers-3/src/test/java/com/baeldung/doubletolong/DoubleToLongUnitTest.java @@ -0,0 +1,64 @@ +package com.baeldung.doubletolong; + +import org.junit.Assert; +import org.junit.Test; + +public class DoubleToLongUnitTest { + + final static double VALUE = 9999.999; + + @Test + public void givenDoubleValue_whenLongValueCalled_thenLongValueReturned() { + Assert.assertEquals(9999L, Double.valueOf(VALUE).longValue()); + } + + @Test + public void givenDoubleValue_whenMathRoundUsed_thenRoundUp() { + Assert.assertEquals(10000L, Math.round(VALUE)); + } + + @Test + public void givenDoubleValue_whenMathRoundUsed_thenRoundDown() { + Assert.assertEquals(9999L, Math.round(9999.444)); + } + + @Test + public void givenDoubleValue_whenMathRoundUsed_thenSameValueReturned() { + Assert.assertEquals(9999L, Math.round(9999.0)); + } + + @Test + public void givenDoubleValue_whenMathCeilUsed_thenLongValueReturned() { + Assert.assertEquals(10000L, Math.ceil(VALUE), 0); + } + + @Test + public void givenDoubleValue_whenMathCeilUsed_thenSameValueReturned() { + Assert.assertEquals(9999L, Math.ceil(9999.0), 0); + } + + @Test + public void givenDoubleValue_whenMathCeilUsed_thenDifferentThanRound() { + Assert.assertEquals(10000L, Math.ceil(9999.444), 0); + } + + @Test + public void givenDoubleValue_whenMathFloorUsed_thenLongValueReturned() { + Assert.assertEquals(9999L, Math.floor(VALUE), 0); + } + + @Test + public void givenDoubleValue_whenMathFloorUsed_thenSameValueReturned() { + Assert.assertEquals(9999L, Math.floor(9999.0), 0); + } + + @Test + public void givenDoubleValue_whenMathFloorUsed_thenDifferentThanCeil() { + Assert.assertEquals(9999L, Math.floor(9999.444), 0); + } + + @Test + public void givenDoubleValue_whenTypeCasted_thenLongValueReturned() { + Assert.assertEquals(9999L, (long) VALUE); + } +} diff --git a/javaxval/src/main/java/org/baeldung/javaxval/beanvalidation/User.java b/javaxval/src/main/java/com/baeldung/javaxval/beanvalidation/User.java similarity index 97% rename from javaxval/src/main/java/org/baeldung/javaxval/beanvalidation/User.java rename to javaxval/src/main/java/com/baeldung/javaxval/beanvalidation/User.java index 8303edd033..d583ac51d2 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/beanvalidation/User.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/beanvalidation/User.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.beanvalidation; +package com.baeldung.javaxval.beanvalidation; import java.time.LocalDate; import java.util.List; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/bigdecimal/Invoice.java b/javaxval/src/main/java/com/baeldung/javaxval/bigdecimal/Invoice.java similarity index 91% rename from javaxval/src/main/java/org/baeldung/javaxval/bigdecimal/Invoice.java rename to javaxval/src/main/java/com/baeldung/javaxval/bigdecimal/Invoice.java index 087701f166..c14a6bd2b1 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/bigdecimal/Invoice.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/bigdecimal/Invoice.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.bigdecimal; +package com.baeldung.javaxval.bigdecimal; import java.math.BigDecimal; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/container/validation/Customer.java b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/Customer.java similarity index 96% rename from javaxval/src/main/java/org/baeldung/javaxval/container/validation/Customer.java rename to javaxval/src/main/java/com/baeldung/javaxval/container/validation/Customer.java index 6ca5ba3ee1..03811635ee 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/container/validation/Customer.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/Customer.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.container.validation; +package com.baeldung.javaxval.container.validation; import java.util.List; import java.util.Optional; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/container/validation/CustomerMap.java b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/CustomerMap.java similarity index 89% rename from javaxval/src/main/java/org/baeldung/javaxval/container/validation/CustomerMap.java rename to javaxval/src/main/java/com/baeldung/javaxval/container/validation/CustomerMap.java index 82cf0f2b0c..554285fbae 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/container/validation/CustomerMap.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/CustomerMap.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.container.validation; +package com.baeldung.javaxval.container.validation; import java.util.Map; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/container/validation/Profile.java b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/Profile.java similarity index 81% rename from javaxval/src/main/java/org/baeldung/javaxval/container/validation/Profile.java rename to javaxval/src/main/java/com/baeldung/javaxval/container/validation/Profile.java index 41260540fc..252e671250 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/container/validation/Profile.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/Profile.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.container.validation; +package com.baeldung.javaxval.container.validation; public class Profile { private String companyName; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/container/validation/valueextractors/ProfileValueExtractor.java b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/valueextractors/ProfileValueExtractor.java similarity index 79% rename from javaxval/src/main/java/org/baeldung/javaxval/container/validation/valueextractors/ProfileValueExtractor.java rename to javaxval/src/main/java/com/baeldung/javaxval/container/validation/valueextractors/ProfileValueExtractor.java index ebc618e80e..03e0c7aac4 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/container/validation/valueextractors/ProfileValueExtractor.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/container/validation/valueextractors/ProfileValueExtractor.java @@ -1,10 +1,10 @@ -package org.baeldung.javaxval.container.validation.valueextractors; +package com.baeldung.javaxval.container.validation.valueextractors; import javax.validation.valueextraction.ExtractedValue; import javax.validation.valueextraction.UnwrapByDefault; import javax.validation.valueextraction.ValueExtractor; -import org.baeldung.javaxval.container.validation.Profile; +import com.baeldung.javaxval.container.validation.Profile; @UnwrapByDefault public class ProfileValueExtractor implements ValueExtractor<@ExtractedValue(type = String.class) Profile> { diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/CustomerTypeSubSetValidator.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/CustomerTypeSubSetValidator.java similarity index 79% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/CustomerTypeSubSetValidator.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/CustomerTypeSubSetValidator.java index c730cb937f..c91f449bad 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/CustomerTypeSubSetValidator.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/CustomerTypeSubSetValidator.java @@ -1,12 +1,12 @@ -package org.baeldung.javaxval.enums; +package com.baeldung.javaxval.enums; import java.util.Arrays; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; -import org.baeldung.javaxval.enums.constraints.CustomerTypeSubset; -import org.baeldung.javaxval.enums.demo.CustomerType; +import com.baeldung.javaxval.enums.constraints.CustomerTypeSubset; +import com.baeldung.javaxval.enums.demo.CustomerType; public class CustomerTypeSubSetValidator implements ConstraintValidator { private CustomerType[] subset; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/EnumNamePatternValidator.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/EnumNamePatternValidator.java similarity index 89% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/EnumNamePatternValidator.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/EnumNamePatternValidator.java index a279813461..3d56d40563 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/EnumNamePatternValidator.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/EnumNamePatternValidator.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums; +package com.baeldung.javaxval.enums; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -7,7 +7,7 @@ import java.util.regex.PatternSyntaxException; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; -import org.baeldung.javaxval.enums.constraints.EnumNamePattern; +import com.baeldung.javaxval.enums.constraints.EnumNamePattern; public class EnumNamePatternValidator implements ConstraintValidator> { private Pattern pattern; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/EnumSubSetValidator.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/EnumSubSetValidator.java similarity index 94% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/EnumSubSetValidator.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/EnumSubSetValidator.java index 339b4fb03b..04cccb8b0c 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/EnumSubSetValidator.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/EnumSubSetValidator.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums; +package com.baeldung.javaxval.enums; import java.lang.annotation.Annotation; import java.util.Arrays; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/InheritedCustomerTypeSubSetValidator.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/InheritedCustomerTypeSubSetValidator.java similarity index 61% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/InheritedCustomerTypeSubSetValidator.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/InheritedCustomerTypeSubSetValidator.java index 1cd31c4187..b49bc11541 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/InheritedCustomerTypeSubSetValidator.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/InheritedCustomerTypeSubSetValidator.java @@ -1,7 +1,7 @@ -package org.baeldung.javaxval.enums; +package com.baeldung.javaxval.enums; -import org.baeldung.javaxval.enums.constraints.CustomerTypeSubset; -import org.baeldung.javaxval.enums.demo.CustomerType; +import com.baeldung.javaxval.enums.constraints.CustomerTypeSubset; +import com.baeldung.javaxval.enums.demo.CustomerType; public class InheritedCustomerTypeSubSetValidator extends EnumSubSetValidator { @Override diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/ValueOfEnumValidator.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/ValueOfEnumValidator.java similarity index 89% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/ValueOfEnumValidator.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/ValueOfEnumValidator.java index 7184dae49b..0203d63923 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/ValueOfEnumValidator.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/ValueOfEnumValidator.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums; +package com.baeldung.javaxval.enums; import java.util.List; import java.util.stream.Collectors; @@ -7,7 +7,7 @@ import java.util.stream.Stream; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; -import org.baeldung.javaxval.enums.constraints.ValueOfEnum; +import com.baeldung.javaxval.enums.constraints.ValueOfEnum; public class ValueOfEnumValidator implements ConstraintValidator { private List acceptedValues; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/CustomerTypeSubset.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/CustomerTypeSubset.java similarity index 88% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/CustomerTypeSubset.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/CustomerTypeSubset.java index 44009e6723..97c2137f6a 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/CustomerTypeSubset.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/CustomerTypeSubset.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums.constraints; +package com.baeldung.javaxval.enums.constraints; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; @@ -15,8 +15,8 @@ import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; -import org.baeldung.javaxval.enums.CustomerTypeSubSetValidator; -import org.baeldung.javaxval.enums.demo.CustomerType; +import com.baeldung.javaxval.enums.CustomerTypeSubSetValidator; +import com.baeldung.javaxval.enums.demo.CustomerType; @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/EnumNamePattern.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/EnumNamePattern.java similarity index 91% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/EnumNamePattern.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/EnumNamePattern.java index 403cdcd0b4..29fff857c8 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/EnumNamePattern.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/EnumNamePattern.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums.constraints; +package com.baeldung.javaxval.enums.constraints; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; @@ -15,7 +15,7 @@ import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; -import org.baeldung.javaxval.enums.EnumNamePatternValidator; +import com.baeldung.javaxval.enums.EnumNamePatternValidator; @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/ValueOfEnum.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/ValueOfEnum.java similarity index 92% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/ValueOfEnum.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/ValueOfEnum.java index 0f9677d982..29b44a1793 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/constraints/ValueOfEnum.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/constraints/ValueOfEnum.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums.constraints; +package com.baeldung.javaxval.enums.constraints; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; @@ -15,7 +15,7 @@ import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; -import org.baeldung.javaxval.enums.ValueOfEnumValidator; +import com.baeldung.javaxval.enums.ValueOfEnumValidator; @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/demo/Customer.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/demo/Customer.java similarity index 91% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/demo/Customer.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/demo/Customer.java index db3486ab5f..15cd9e0da7 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/demo/Customer.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/demo/Customer.java @@ -1,10 +1,10 @@ -package org.baeldung.javaxval.enums.demo; +package com.baeldung.javaxval.enums.demo; import javax.validation.constraints.NotNull; -import org.baeldung.javaxval.enums.constraints.CustomerTypeSubset; -import org.baeldung.javaxval.enums.constraints.EnumNamePattern; -import org.baeldung.javaxval.enums.constraints.ValueOfEnum; +import com.baeldung.javaxval.enums.constraints.CustomerTypeSubset; +import com.baeldung.javaxval.enums.constraints.EnumNamePattern; +import com.baeldung.javaxval.enums.constraints.ValueOfEnum; public class Customer { @ValueOfEnum(enumClass = CustomerType.class) diff --git a/javaxval/src/main/java/org/baeldung/javaxval/enums/demo/CustomerType.java b/javaxval/src/main/java/com/baeldung/javaxval/enums/demo/CustomerType.java similarity index 55% rename from javaxval/src/main/java/org/baeldung/javaxval/enums/demo/CustomerType.java rename to javaxval/src/main/java/com/baeldung/javaxval/enums/demo/CustomerType.java index 937f3a3817..88eb1b359f 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/enums/demo/CustomerType.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/enums/demo/CustomerType.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums.demo; +package com.baeldung.javaxval.enums.demo; public enum CustomerType { NEW, OLD, DEFAULT diff --git a/javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/application/Application.java b/javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/application/Application.java similarity index 77% rename from javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/application/Application.java rename to javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/application/Application.java index 22095084c5..22157f351c 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/application/Application.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/application/Application.java @@ -1,9 +1,9 @@ -package org.baeldung.javaxval.javabeanconstraints.application; +package com.baeldung.javaxval.javabeanconstraints.application; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.javabeanconstraints.entities.UserNotBlank; +import com.baeldung.javaxval.javabeanconstraints.entities.UserNotBlank; public class Application { diff --git a/javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotBlank.java b/javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotBlank.java similarity index 86% rename from javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotBlank.java rename to javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotBlank.java index d86b6a65d2..5542be8c25 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotBlank.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotBlank.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.javabeanconstraints.entities; +package com.baeldung.javaxval.javabeanconstraints.entities; import javax.validation.constraints.NotBlank; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotEmpty.java b/javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotEmpty.java similarity index 86% rename from javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotEmpty.java rename to javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotEmpty.java index 2082265145..e3dbe27b0e 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotEmpty.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotEmpty.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.javabeanconstraints.entities; +package com.baeldung.javaxval.javabeanconstraints.entities; import javax.validation.constraints.NotEmpty; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotNull.java b/javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotNull.java similarity index 86% rename from javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotNull.java rename to javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotNull.java index e2f9e7ec57..b3a0f90d36 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/javabeanconstraints/entities/UserNotNull.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/javabeanconstraints/entities/UserNotNull.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.javabeanconstraints.entities; +package com.baeldung.javaxval.javabeanconstraints.entities; import javax.validation.constraints.NotNull; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/messageinterpolator/Person.java b/javaxval/src/main/java/com/baeldung/javaxval/messageinterpolator/Person.java similarity index 94% rename from javaxval/src/main/java/org/baeldung/javaxval/messageinterpolator/Person.java rename to javaxval/src/main/java/com/baeldung/javaxval/messageinterpolator/Person.java index b9fcfdf4d4..387af48c20 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/messageinterpolator/Person.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/messageinterpolator/Person.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.messageinterpolator; +package com.baeldung.javaxval.messageinterpolator; import javax.validation.constraints.Email; import javax.validation.constraints.Min; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/MethodValidationConfig.java b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/MethodValidationConfig.java similarity index 82% rename from javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/MethodValidationConfig.java rename to javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/MethodValidationConfig.java index 817f2370ef..d4046bf5f9 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/MethodValidationConfig.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/MethodValidationConfig.java @@ -1,9 +1,9 @@ -package org.baeldung.javaxval.methodvalidation; +package com.baeldung.javaxval.methodvalidation; import java.time.LocalDate; -import org.baeldung.javaxval.methodvalidation.model.Customer; -import org.baeldung.javaxval.methodvalidation.model.Reservation; +import com.baeldung.javaxval.methodvalidation.model.Customer; +import com.baeldung.javaxval.methodvalidation.model.Reservation; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -12,7 +12,7 @@ import org.springframework.context.annotation.Scope; import org.springframework.validation.beanvalidation.MethodValidationPostProcessor; @Configuration -@ComponentScan({ "org.baeldung.javaxval.methodvalidation.model" }) +@ComponentScan({ "com.baeldung.javaxval.methodvalidation.model" }) public class MethodValidationConfig { @Bean diff --git a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameterValidator.java b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameterValidator.java similarity index 94% rename from javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameterValidator.java rename to javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameterValidator.java index df09cfa906..6b48046b5c 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameterValidator.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameterValidator.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.methodvalidation.constraints; +package com.baeldung.javaxval.methodvalidation.constraints; import java.time.LocalDate; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameters.java b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameters.java similarity index 92% rename from javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameters.java rename to javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameters.java index bdfabe05ba..83f551d45f 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameters.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ConsistentDateParameters.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.methodvalidation.constraints; +package com.baeldung.javaxval.methodvalidation.constraints; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.METHOD; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ValidReservation.java b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ValidReservation.java similarity index 92% rename from javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ValidReservation.java rename to javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ValidReservation.java index 842f9e0621..c28cc79004 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ValidReservation.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ValidReservation.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.methodvalidation.constraints; +package com.baeldung.javaxval.methodvalidation.constraints; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.METHOD; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ValidReservationValidator.java b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ValidReservationValidator.java similarity index 88% rename from javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ValidReservationValidator.java rename to javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ValidReservationValidator.java index c139d1affc..541fc15e9c 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/constraints/ValidReservationValidator.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/constraints/ValidReservationValidator.java @@ -1,11 +1,11 @@ -package org.baeldung.javaxval.methodvalidation.constraints; +package com.baeldung.javaxval.methodvalidation.constraints; import java.time.LocalDate; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; -import org.baeldung.javaxval.methodvalidation.model.Reservation; +import com.baeldung.javaxval.methodvalidation.model.Reservation; public class ValidReservationValidator implements ConstraintValidator { diff --git a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/Customer.java b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/Customer.java similarity index 94% rename from javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/Customer.java rename to javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/Customer.java index 99a32d6277..e0b7fcf917 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/Customer.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/Customer.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.methodvalidation.model; +package com.baeldung.javaxval.methodvalidation.model; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/Reservation.java b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/Reservation.java similarity index 86% rename from javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/Reservation.java rename to javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/Reservation.java index 5775bdd66b..49cf1306a9 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/Reservation.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/Reservation.java @@ -1,12 +1,12 @@ -package org.baeldung.javaxval.methodvalidation.model; +package com.baeldung.javaxval.methodvalidation.model; import java.time.LocalDate; import javax.validation.Valid; import javax.validation.constraints.Positive; -import org.baeldung.javaxval.methodvalidation.constraints.ConsistentDateParameters; -import org.baeldung.javaxval.methodvalidation.constraints.ValidReservation; +import com.baeldung.javaxval.methodvalidation.constraints.ValidReservation; +import com.baeldung.javaxval.methodvalidation.constraints.ConsistentDateParameters; import org.springframework.validation.annotation.Validated; @Validated diff --git a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/ReservationManagement.java b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/ReservationManagement.java similarity index 91% rename from javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/ReservationManagement.java rename to javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/ReservationManagement.java index e480e7912d..41fc4c3840 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/methodvalidation/model/ReservationManagement.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/methodvalidation/model/ReservationManagement.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.methodvalidation.model; +package com.baeldung.javaxval.methodvalidation.model; import java.time.LocalDate; import java.util.List; @@ -9,7 +9,7 @@ import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import org.baeldung.javaxval.methodvalidation.constraints.ConsistentDateParameters; +import com.baeldung.javaxval.methodvalidation.constraints.ConsistentDateParameters; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Controller; diff --git a/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/AdvanceInfo.java b/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/AdvanceInfo.java new file mode 100644 index 0000000000..0be96f1341 --- /dev/null +++ b/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/AdvanceInfo.java @@ -0,0 +1,5 @@ +package com.baeldung.javaxval.validationgroup; + +public interface AdvanceInfo { + +} diff --git a/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/BasicInfo.java b/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/BasicInfo.java new file mode 100644 index 0000000000..7413c10cda --- /dev/null +++ b/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/BasicInfo.java @@ -0,0 +1,5 @@ +package com.baeldung.javaxval.validationgroup; + +public interface BasicInfo { + +} diff --git a/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/CompleteInfo.java b/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/CompleteInfo.java similarity index 73% rename from javaxval/src/main/java/org/baeldung/javaxval/validationgroup/CompleteInfo.java rename to javaxval/src/main/java/com/baeldung/javaxval/validationgroup/CompleteInfo.java index e34f318b5f..4ecdc3c5f1 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/CompleteInfo.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/CompleteInfo.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.validationgroup; +package com.baeldung.javaxval.validationgroup; import javax.validation.GroupSequence; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/RegistrationForm.java b/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/RegistrationForm.java similarity index 98% rename from javaxval/src/main/java/org/baeldung/javaxval/validationgroup/RegistrationForm.java rename to javaxval/src/main/java/com/baeldung/javaxval/validationgroup/RegistrationForm.java index 190a0c1280..a30a074556 100644 --- a/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/RegistrationForm.java +++ b/javaxval/src/main/java/com/baeldung/javaxval/validationgroup/RegistrationForm.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.validationgroup; +package com.baeldung.javaxval.validationgroup; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; diff --git a/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/AdvanceInfo.java b/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/AdvanceInfo.java deleted file mode 100644 index 9a398e9e7e..0000000000 --- a/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/AdvanceInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.javaxval.validationgroup; - -public interface AdvanceInfo { - -} diff --git a/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/BasicInfo.java b/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/BasicInfo.java deleted file mode 100644 index 6959f52bfa..0000000000 --- a/javaxval/src/main/java/org/baeldung/javaxval/validationgroup/BasicInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.javaxval.validationgroup; - -public interface BasicInfo { - -} diff --git a/javaxval/src/main/resources/META-INF/services/javax.validation.valueextraction.ValueExtractor b/javaxval/src/main/resources/META-INF/services/javax.validation.valueextraction.ValueExtractor index 16bacf1097..0c1fcddd9b 100644 --- a/javaxval/src/main/resources/META-INF/services/javax.validation.valueextraction.ValueExtractor +++ b/javaxval/src/main/resources/META-INF/services/javax.validation.valueextraction.ValueExtractor @@ -1 +1 @@ -org.baeldung.javaxval.container.validation.valueextractors.ProfileValueExtractor \ No newline at end of file +com.baeldung.javaxval.container.validation.valueextractors.ProfileValueExtractor \ No newline at end of file diff --git a/javaxval/src/test/java/org/baeldung/javaxval/LocaleAwareUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/LocaleAwareUnitTest.java similarity index 93% rename from javaxval/src/test/java/org/baeldung/javaxval/LocaleAwareUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/LocaleAwareUnitTest.java index 5623b50a72..ebf1ca3dc6 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/LocaleAwareUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/LocaleAwareUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval; +package com.baeldung.javaxval; import java.util.Locale; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/beanvalidation/ValidationIntegrationTest.java b/javaxval/src/test/java/com/baeldung/javaxval/beanvalidation/ValidationIntegrationTest.java similarity index 98% rename from javaxval/src/test/java/org/baeldung/javaxval/beanvalidation/ValidationIntegrationTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/beanvalidation/ValidationIntegrationTest.java index 3d54955177..3e60fa7acd 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/beanvalidation/ValidationIntegrationTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/beanvalidation/ValidationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.beanvalidation; +package com.baeldung.javaxval.beanvalidation; import static org.junit.Assert.assertEquals; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/bigdecimal/InvoiceUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/bigdecimal/InvoiceUnitTest.java similarity index 96% rename from javaxval/src/test/java/org/baeldung/javaxval/bigdecimal/InvoiceUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/bigdecimal/InvoiceUnitTest.java index 6a53d67f30..2df0cf81af 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/bigdecimal/InvoiceUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/bigdecimal/InvoiceUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.bigdecimal; +package com.baeldung.javaxval.bigdecimal; import static org.assertj.core.api.Assertions.assertThat; @@ -9,7 +9,7 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.LocaleAwareUnitTest; +import com.baeldung.javaxval.LocaleAwareUnitTest; import org.junit.BeforeClass; import org.junit.Test; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/container/validation/ContainerValidationIntegrationTest.java b/javaxval/src/test/java/com/baeldung/javaxval/container/validation/ContainerValidationIntegrationTest.java similarity index 96% rename from javaxval/src/test/java/org/baeldung/javaxval/container/validation/ContainerValidationIntegrationTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/container/validation/ContainerValidationIntegrationTest.java index 25c8111732..d96b641442 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/container/validation/ContainerValidationIntegrationTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/container/validation/ContainerValidationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.container.validation; +package com.baeldung.javaxval.container.validation; import static org.junit.Assert.assertEquals; @@ -11,7 +11,7 @@ import javax.validation.Validation; import javax.validation.Validator; import javax.validation.ValidatorFactory; -import org.baeldung.javaxval.container.validation.valueextractors.ProfileValueExtractor; +import com.baeldung.javaxval.container.validation.valueextractors.ProfileValueExtractor; import org.junit.Before; import org.junit.Test; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/enums/CustomerTypeSubSetValidatorUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/enums/CustomerTypeSubSetValidatorUnitTest.java similarity index 87% rename from javaxval/src/test/java/org/baeldung/javaxval/enums/CustomerTypeSubSetValidatorUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/enums/CustomerTypeSubSetValidatorUnitTest.java index 5aae504b23..08a51de81e 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/enums/CustomerTypeSubSetValidatorUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/enums/CustomerTypeSubSetValidatorUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums; +package com.baeldung.javaxval.enums; import static org.assertj.core.api.Assertions.assertThat; @@ -8,9 +8,9 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.enums.demo.Customer; -import org.baeldung.javaxval.enums.demo.CustomerType; -import org.baeldung.javaxval.enums.demo.CustomerUnitTest; +import com.baeldung.javaxval.enums.demo.CustomerUnitTest; +import com.baeldung.javaxval.enums.demo.Customer; +import com.baeldung.javaxval.enums.demo.CustomerType; import org.junit.BeforeClass; import org.junit.Test; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/enums/EnumNamePatternValidatorUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/enums/EnumNamePatternValidatorUnitTest.java similarity index 86% rename from javaxval/src/test/java/org/baeldung/javaxval/enums/EnumNamePatternValidatorUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/enums/EnumNamePatternValidatorUnitTest.java index 48f7de2c34..03bb1f73ba 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/enums/EnumNamePatternValidatorUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/enums/EnumNamePatternValidatorUnitTest.java @@ -1,8 +1,8 @@ -package org.baeldung.javaxval.enums; +package com.baeldung.javaxval.enums; import static org.assertj.core.api.Assertions.assertThat; -import static org.baeldung.javaxval.enums.demo.CustomerType.DEFAULT; -import static org.baeldung.javaxval.enums.demo.CustomerType.OLD; +import static com.baeldung.javaxval.enums.demo.CustomerType.DEFAULT; +import static com.baeldung.javaxval.enums.demo.CustomerType.OLD; import java.util.Set; @@ -10,8 +10,8 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.enums.demo.Customer; -import org.baeldung.javaxval.enums.demo.CustomerUnitTest; +import com.baeldung.javaxval.enums.demo.CustomerUnitTest; +import com.baeldung.javaxval.enums.demo.Customer; import org.junit.BeforeClass; import org.junit.Test; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/enums/ValueOfEnumValidatorUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/enums/ValueOfEnumValidatorUnitTest.java similarity index 89% rename from javaxval/src/test/java/org/baeldung/javaxval/enums/ValueOfEnumValidatorUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/enums/ValueOfEnumValidatorUnitTest.java index 0784b58b77..723ac3cc32 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/enums/ValueOfEnumValidatorUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/enums/ValueOfEnumValidatorUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums; +package com.baeldung.javaxval.enums; import static org.assertj.core.api.Assertions.assertThat; @@ -8,8 +8,8 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.enums.demo.Customer; -import org.baeldung.javaxval.enums.demo.CustomerUnitTest; +import com.baeldung.javaxval.enums.demo.CustomerUnitTest; +import com.baeldung.javaxval.enums.demo.Customer; import org.junit.BeforeClass; import org.junit.Test; @@ -47,6 +47,6 @@ public class ValueOfEnumValidatorUnitTest { assertThat(violations.size()).isEqualTo(1); assertThat(violations).anyMatch(CustomerUnitTest.havingPropertyPath("customerTypeString") - .and(CustomerUnitTest.havingMessage("must be any of enum class org.baeldung.javaxval.enums.demo.CustomerType"))); + .and(CustomerUnitTest.havingMessage("must be any of enum class com.baeldung.javaxval.enums.demo.CustomerType"))); } } \ No newline at end of file diff --git a/javaxval/src/test/java/org/baeldung/javaxval/enums/demo/CustomerUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/enums/demo/CustomerUnitTest.java similarity index 92% rename from javaxval/src/test/java/org/baeldung/javaxval/enums/demo/CustomerUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/enums/demo/CustomerUnitTest.java index 6a064b640f..2c810bc2fe 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/enums/demo/CustomerUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/enums/demo/CustomerUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.enums.demo; +package com.baeldung.javaxval.enums.demo; import static org.assertj.core.api.Assertions.assertThat; @@ -9,7 +9,7 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.LocaleAwareUnitTest; +import com.baeldung.javaxval.LocaleAwareUnitTest; import org.junit.BeforeClass; import org.junit.Test; @@ -50,7 +50,7 @@ public class CustomerUnitTest extends LocaleAwareUnitTest { Set> violations = validator.validate(customer); assertThat(violations.size()).isEqualTo(3); - assertThat(violations).anyMatch(havingPropertyPath("customerTypeString").and(havingMessage("must be any of enum class org.baeldung.javaxval.enums.demo.CustomerType"))); + assertThat(violations).anyMatch(havingPropertyPath("customerTypeString").and(havingMessage("must be any of enum class com.baeldung.javaxval.enums.demo.CustomerType"))); assertThat(violations).anyMatch(havingPropertyPath("customerTypeOfSubset").and(havingMessage("must be any of [NEW, OLD]"))); assertThat(violations).anyMatch(havingPropertyPath("customerTypeMatchesPattern").and(havingMessage("must match \"NEW|DEFAULT\""))); } diff --git a/javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotBlankUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotBlankUnitTest.java similarity index 93% rename from javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotBlankUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotBlankUnitTest.java index e3a51d4e27..5219004c6d 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotBlankUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotBlankUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.javabeanconstraints.test; +package com.baeldung.javaxval.javabeanconstraints.test; import static org.assertj.core.api.Assertions.assertThat; @@ -8,7 +8,7 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.javabeanconstraints.entities.UserNotBlank; +import com.baeldung.javaxval.javabeanconstraints.entities.UserNotBlank; import org.junit.BeforeClass; import org.junit.Test; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotEmptyUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotEmptyUnitTest.java similarity index 92% rename from javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotEmptyUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotEmptyUnitTest.java index 22fbab6997..7017848756 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotEmptyUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotEmptyUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.javabeanconstraints.test; +package com.baeldung.javaxval.javabeanconstraints.test; import static org.assertj.core.api.Assertions.assertThat; @@ -8,7 +8,7 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.javabeanconstraints.entities.UserNotEmpty; +import com.baeldung.javaxval.javabeanconstraints.entities.UserNotEmpty; import org.junit.BeforeClass; import org.junit.Test; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotNullUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotNullUnitTest.java similarity index 92% rename from javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotNullUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotNullUnitTest.java index a684668ae3..b0df88d72b 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/javabeanconstraints/test/UserNotNullUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/javabeanconstraints/test/UserNotNullUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.javabeanconstraints.test; +package com.baeldung.javaxval.javabeanconstraints.test; import static org.assertj.core.api.Assertions.assertThat; @@ -8,7 +8,7 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.javabeanconstraints.entities.UserNotNull; +import com.baeldung.javaxval.javabeanconstraints.entities.UserNotNull; import org.junit.BeforeClass; import org.junit.Test; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/messageinterpolator/ParameterMessageInterpolaterIntegrationTest.java b/javaxval/src/test/java/com/baeldung/javaxval/messageinterpolator/ParameterMessageInterpolaterIntegrationTest.java similarity index 97% rename from javaxval/src/test/java/org/baeldung/javaxval/messageinterpolator/ParameterMessageInterpolaterIntegrationTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/messageinterpolator/ParameterMessageInterpolaterIntegrationTest.java index 6ecb916ab4..a60550aca5 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/messageinterpolator/ParameterMessageInterpolaterIntegrationTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/messageinterpolator/ParameterMessageInterpolaterIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.messageinterpolator; +package com.baeldung.javaxval.messageinterpolator; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/methodvalidation/ContainerValidationIntegrationTest.java b/javaxval/src/test/java/com/baeldung/javaxval/methodvalidation/ContainerValidationIntegrationTest.java similarity index 92% rename from javaxval/src/test/java/org/baeldung/javaxval/methodvalidation/ContainerValidationIntegrationTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/methodvalidation/ContainerValidationIntegrationTest.java index 8febdca0ee..d9daf6c4ff 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/methodvalidation/ContainerValidationIntegrationTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/methodvalidation/ContainerValidationIntegrationTest.java @@ -1,13 +1,13 @@ -package org.baeldung.javaxval.methodvalidation; +package com.baeldung.javaxval.methodvalidation; import java.time.LocalDate; import java.util.List; import javax.validation.ConstraintViolationException; -import org.baeldung.javaxval.methodvalidation.model.Customer; -import org.baeldung.javaxval.methodvalidation.model.Reservation; -import org.baeldung.javaxval.methodvalidation.model.ReservationManagement; +import com.baeldung.javaxval.methodvalidation.model.Customer; +import com.baeldung.javaxval.methodvalidation.model.Reservation; +import com.baeldung.javaxval.methodvalidation.model.ReservationManagement; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/methodvalidation/ValidationIntegrationTest.java b/javaxval/src/test/java/com/baeldung/javaxval/methodvalidation/ValidationIntegrationTest.java similarity index 97% rename from javaxval/src/test/java/org/baeldung/javaxval/methodvalidation/ValidationIntegrationTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/methodvalidation/ValidationIntegrationTest.java index 9baeba7189..6f297a7c9c 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/methodvalidation/ValidationIntegrationTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/methodvalidation/ValidationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.methodvalidation; +package com.baeldung.javaxval.methodvalidation; import static org.junit.Assert.assertEquals; @@ -13,9 +13,9 @@ import javax.validation.Validation; import javax.validation.ValidatorFactory; import javax.validation.executable.ExecutableValidator; -import org.baeldung.javaxval.methodvalidation.model.Customer; -import org.baeldung.javaxval.methodvalidation.model.Reservation; -import org.baeldung.javaxval.methodvalidation.model.ReservationManagement; +import com.baeldung.javaxval.methodvalidation.model.Customer; +import com.baeldung.javaxval.methodvalidation.model.Reservation; +import com.baeldung.javaxval.methodvalidation.model.ReservationManagement; import org.junit.Before; import org.junit.Test; diff --git a/javaxval/src/test/java/org/baeldung/javaxval/validationgroup/RegistrationFormUnitTest.java b/javaxval/src/test/java/com/baeldung/javaxval/validationgroup/RegistrationFormUnitTest.java similarity index 98% rename from javaxval/src/test/java/org/baeldung/javaxval/validationgroup/RegistrationFormUnitTest.java rename to javaxval/src/test/java/com/baeldung/javaxval/validationgroup/RegistrationFormUnitTest.java index df70ca0bce..6b7600d201 100644 --- a/javaxval/src/test/java/org/baeldung/javaxval/validationgroup/RegistrationFormUnitTest.java +++ b/javaxval/src/test/java/com/baeldung/javaxval/validationgroup/RegistrationFormUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.javaxval.validationgroup; +package com.baeldung.javaxval.validationgroup; import static org.assertj.core.api.Assertions.assertThat; @@ -8,7 +8,7 @@ import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; -import org.baeldung.javaxval.LocaleAwareUnitTest; +import com.baeldung.javaxval.LocaleAwareUnitTest; import org.junit.BeforeClass; import org.junit.Test; diff --git a/libraries-io/src/test/java/org/baeldung/java/io/remote/SftpFileTransferLiveTest.java b/libraries-io/src/test/java/com/baeldung/java/io/remote/SftpFileTransferLiveTest.java similarity index 99% rename from libraries-io/src/test/java/org/baeldung/java/io/remote/SftpFileTransferLiveTest.java rename to libraries-io/src/test/java/com/baeldung/java/io/remote/SftpFileTransferLiveTest.java index 192153bc90..5846128082 100644 --- a/libraries-io/src/test/java/org/baeldung/java/io/remote/SftpFileTransferLiveTest.java +++ b/libraries-io/src/test/java/com/baeldung/java/io/remote/SftpFileTransferLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.java.io.remote; +package com.baeldung.java.io.remote; import java.io.IOException; diff --git a/linux-bash/read/src/main/bash/file.csv b/linux-bash/read/src/main/bash/file.csv new file mode 100644 index 0000000000..69a50772ab --- /dev/null +++ b/linux-bash/read/src/main/bash/file.csv @@ -0,0 +1 @@ +car,car model,car year,car vin;Mercury,Grand Marquis,2000,2G61S5S33F9986032;Mitsubishi,Truck,1995,SCFFDABE1CG137362;Ford,Mustang,1968,2G4WS55J351278031;Ford,Crown Victoria,1996,4T1BK1EB8EU586249;GMC,Envoy,2004,WVGEF9BP3FD720618; diff --git a/linux-bash/read/src/main/bash/read_inputs.sh b/linux-bash/read/src/main/bash/read_inputs.sh new file mode 100755 index 0000000000..30eb598ac3 --- /dev/null +++ b/linux-bash/read/src/main/bash/read_inputs.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +# section 2.1 +default_read(){ + read input1 input2 input3 + echo "[$input1] [$input2] [$input3]" +} + +# section 2.2 +custom_ifs_no_array(){ + OLDIFS=$IFS + IFS=";" + read input1 input2 input3 + echo "[$input1] [$input2] [$input3]" + # restore default IFS after we're finished so current shell behaves like before + IFS=$OLDIFS +} + +# Section 2.3 +prompt_read_password(){ + prompt="You shall not pass:" + read -p "$prompt" -s input + echo -e "\ninput password [$input]" +} + +array_read(){ + declare -a input_array + text="baeldung is a cool tech site" + read -e -i "$text" -a input_array + for input in ${input_array[@]} + do + echo " word [$input]" + done +} + +# section 3.1 +file_read(){ + exec {file_descriptor}<"./file.csv" + declare -a input_array + delimiter=";" + while IFS="," read -a input_array -d $delimiter -u $file_descriptor + do + echo "${input_array[0]},${input_array[2]}" + done + exec {file_descriptor}>&- +} + +# section 3.2 +command_pipe(){ + ls -ll / | { declare -a input + read + while read -a input; + do + echo "${input[0]} ${input[8]}" + done } +} + +# section 3.3 +timeout_input_read(){ + prompt="You shall not pass:" + read -p "$prompt" -s -r -t 5 input + if [ -z "$input" ]; then + echo -e "\ntimeout occured!" + else + echo -e "\ninput word [$input]" + fi +} + +exactly_n_read(){ + prompt="Reading exactly 11 chars:" + read -p "$prompt" -N 11 -t 5 input1 input2 + echo -e "\ninput word1 [$input1]" + echo "input word2 [$input2]" +} + +# main menu entry point +echo "****Read command samples menu*****" +PS3="Your choice (1,2,3 etc.):" +options=("default_read" "custom_ifs_no_array" "prompt_read_password" \ + "array_read" "file_read" "command_pipe" "timeout_input_read" \ + "exactly_n_read" "quit") +select option in "${options[@]}" +do + case $option in + "default_read") + echo "Enter something separated by spaces" + default_read + ;; + "custom_ifs_no_array") + echo "Enter something separated by ;" + custom_ifs_no_array + ;; + "prompt_read_password") + echo "Enter an invisible password after the prompt" + prompt_read_password + ;; + "array_read") + echo "Enter something else or just return" + array_read + ;; + "file_read") + echo "Reading from one liner csv file" + file_read + ;; + "command_pipe") + echo "Listing files and access rights from /" + command_pipe + ;; + "timeout_input_read") + echo "Enter something in 5 seconds or less" + timeout_input_read + ;; + "exactly_n_read") + echo "Enter at least 11 characters or wait 5 seconds" + exactly_n_read + ;; + "quit") + break + ;; + *) echo "Invalid option";; + esac +done \ No newline at end of file diff --git a/logging-modules/logback/pom.xml b/logging-modules/logback/pom.xml index 6ffc9e1235..ee430949df 100644 --- a/logging-modules/logback/pom.xml +++ b/logging-modules/logback/pom.xml @@ -50,12 +50,25 @@ + + javax.mail + mail + ${javax.mail.version} + + + javax.activation + activation + ${javax.activation.version} + runtime + 1.2.3 0.1.5 3.3.5 + 1.4.7 + 1.1.1 diff --git a/logging-modules/logback/src/main/resources/logback.xml b/logging-modules/logback/src/main/resources/logback.xml index 37ae2adbb0..76ddc2e3ee 100644 --- a/logging-modules/logback/src/main/resources/logback.xml +++ b/logging-modules/logback/src/main/resources/logback.xml @@ -10,9 +10,47 @@ + + OUR-SMTP-HOST-ADDRESS + + EMAIL-RECIPIENT-1 + EMAIL-RECIPIENT-2 + SENDER-EMAIL-ADDRESS + BAELDUNG: %logger{20} - %msg + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg%n + + + + + OUR-SMTP-HOST-ADDRESS + EMAIL-RECIPIENT + SENDER-EMAIL-ADDRESS + BAELDUNG: %logger{20} - %msg + + + + 5 + + + + + smtp.gmail.com + 587 + true + false + SENDER-EMAIL@gmail.com + GMAIL-ACCT-PASSWORD + EMAIL-RECIPIENT + SENDER-EMAIL@gmail.com + BAELDUNG: %logger{20} - %msg + + + + \ No newline at end of file diff --git a/maven-all/maven/custom-rule/src/main/java/com/baeldung/enforcer/MyCustomRule.java b/maven-all/maven/custom-rule/src/main/java/com/baeldung/enforcer/MyCustomRule.java index 9b72f40bf1..db636c2308 100644 --- a/maven-all/maven/custom-rule/src/main/java/com/baeldung/enforcer/MyCustomRule.java +++ b/maven-all/maven/custom-rule/src/main/java/com/baeldung/enforcer/MyCustomRule.java @@ -19,8 +19,8 @@ public class MyCustomRule implements EnforcerRule { String groupId = (String) enforcerRuleHelper.evaluate("${project.groupId}"); - if (groupId == null || !groupId.startsWith("org.baeldung")) { - throw new EnforcerRuleException("Project group id does not start with org.baeldung"); + if (groupId == null || !groupId.startsWith("com.baeldung")) { + throw new EnforcerRuleException("Project group id does not start with com.baeldung"); } } diff --git a/ninja/pom.xml b/ninja/pom.xml new file mode 100644 index 0000000000..8ec2422d9f --- /dev/null +++ b/ninja/pom.xml @@ -0,0 +1,183 @@ + + + 4.0.0 + + ninja + jar + com.baeldung + 1.0.0 + + http://www.ninjaframework.org + + + 6.5.0 + 9.4.18.v20190429 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.2 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.3.1 + + + enforce-banned-dependencies + + enforce + + + + + + commons-logging + + + + true + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} + + + / + + stop + 8889 + 1 + automatic + + + target/classes + + **/* + + + **/*.ftl.html + assets/** + + + + + + ninja.mode + dev + + + + + + + + + org.ninjaframework + ninja-maven-plugin + ${ninja.version} + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + true + + + + org.apache.maven.plugins + maven-shade-plugin + 2.2 + + true + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + package + + shade + + + + + + ninja.standalone.NinjaJetty + + + + + + + + + + src/main/java + + **/* + + + **/*.java + + + + src/main/resources + + **/* + + + + + + + org.webjars + bootstrap + 3.3.4 + + + org.webjars + jquery + 2.1.3 + + + com.h2database + h2 + 1.4.186 + + + org.ninjaframework + ninja-standalone + ${ninja.version} + + + org.ninjaframework + ninja-test-utilities + ${ninja.version} + test + + + \ No newline at end of file diff --git a/ninja/src/main/java/META-INF/persistence.xml b/ninja/src/main/java/META-INF/persistence.xml new file mode 100644 index 0000000000..e57cd5ecc0 --- /dev/null +++ b/ninja/src/main/java/META-INF/persistence.xml @@ -0,0 +1,29 @@ + + + + + + org.hibernate.jpa.HibernatePersistenceProvider + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ninja/src/main/java/assets/css/custom.css b/ninja/src/main/java/assets/css/custom.css new file mode 100644 index 0000000000..41d249d3cb --- /dev/null +++ b/ninja/src/main/java/assets/css/custom.css @@ -0,0 +1,3 @@ +/* Add additional stylesheets below +-------------------------------------------------- */ + diff --git a/ninja/src/main/java/conf/Filters.java b/ninja/src/main/java/conf/Filters.java new file mode 100644 index 0000000000..b201780fa1 --- /dev/null +++ b/ninja/src/main/java/conf/Filters.java @@ -0,0 +1,13 @@ +package conf; + +import java.util.List; +import ninja.Filter; + +public class Filters implements ninja.application.ApplicationFilters { + + @Override + public void addFilters(List> filters) { + // Add your application - wide filters here + // filters.add(MyFilter.class); + } +} diff --git a/ninja/src/main/java/conf/Module.java b/ninja/src/main/java/conf/Module.java new file mode 100644 index 0000000000..f7c03a4b26 --- /dev/null +++ b/ninja/src/main/java/conf/Module.java @@ -0,0 +1,18 @@ +package conf; + +import com.google.inject.AbstractModule; +import com.google.inject.Singleton; + +import services.UserService; +import services.UserServiceImpl; + +@Singleton +public class Module extends AbstractModule { + + protected void configure() { + + bind(UserService.class).to(UserServiceImpl.class); + + } + +} diff --git a/ninja/src/main/java/conf/Routes.java b/ninja/src/main/java/conf/Routes.java new file mode 100644 index 0000000000..a1727d55b0 --- /dev/null +++ b/ninja/src/main/java/conf/Routes.java @@ -0,0 +1,32 @@ +package conf; + +import ninja.AssetsController; +import ninja.Router; +import ninja.application.ApplicationRoutes; +import controllers.ApplicationController; + +public class Routes implements ApplicationRoutes { + + @Override + public void init(Router router) { + + router.GET().route("/index").with(ApplicationController::index); + router.GET().route("/home").with(ApplicationController::home); + router.GET().route("/hello").with(ApplicationController::helloWorld); + router.GET().route("/userJson").with(ApplicationController::userJson); + router.GET().route("/createUser").with(ApplicationController::createUser); + router.GET().route("/flash").with(ApplicationController::showFlashMsg); + + router.GET().route("/users").with(ApplicationController::fetchUsers); + router.POST().route("/users").with(ApplicationController::insertUser); + + //Assets + router.GET().route("/assets/webjars/{fileName: .*}").with(AssetsController::serveWebJars); + router.GET().route("/assets/{fileName: .*}").with(AssetsController::serveStatic); + + //Index + router.GET().route("/.*").with(ApplicationController::index); + + } + +} diff --git a/ninja/src/main/java/conf/application.conf b/ninja/src/main/java/conf/application.conf new file mode 100644 index 0000000000..0ae4c7ec40 --- /dev/null +++ b/ninja/src/main/java/conf/application.conf @@ -0,0 +1,21 @@ +application.name=baeldung ninja dev application +%test.application.name=baeldung ninja test application +%prod.application.name=baeldung ninja application + +application.cookie.prefix=NINJA + +application.languages=fr,en + +application.session.expire_time_in_seconds=3600 +application.session.send_only_if_changed=true +application.session.transferred_over_https_only=false + +ninja.port=8000 +ninja.ssl.port=8001 +application.secret = fxSjSL9Q017BSL7gBnkyo2Prln7uXaXIT35gotXRIED8c46OSa8s4QdoIQdTsEtj + +# h2 jpa configuration +ninja.jpa.persistence_unit_name=dev_unit +db.connection.url=jdbc:h2:./devDb +db.connection.username=sa +db.connection.password= diff --git a/ninja/src/main/java/conf/messages.properties b/ninja/src/main/java/conf/messages.properties new file mode 100644 index 0000000000..3bddfcd8c7 --- /dev/null +++ b/ninja/src/main/java/conf/messages.properties @@ -0,0 +1,2 @@ +header.home=Home! +helloMsg=Hello, welcome to Ninja Framework! \ No newline at end of file diff --git a/ninja/src/main/java/conf/messages_fr.properties b/ninja/src/main/java/conf/messages_fr.properties new file mode 100644 index 0000000000..89264e0cb9 --- /dev/null +++ b/ninja/src/main/java/conf/messages_fr.properties @@ -0,0 +1,2 @@ +header.home=Accueil! +helloMsg=Bonjour, bienvenue dans Ninja Framework! \ No newline at end of file diff --git a/ninja/src/main/java/controllers/ApplicationController.java b/ninja/src/main/java/controllers/ApplicationController.java new file mode 100644 index 0000000000..38dd598694 --- /dev/null +++ b/ninja/src/main/java/controllers/ApplicationController.java @@ -0,0 +1,102 @@ +package controllers; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import javax.inject.Inject; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.google.inject.Provider; +import com.google.inject.Singleton; +import com.google.inject.persist.Transactional; + +import models.User; +import ninja.Context; +import ninja.Result; +import ninja.Results; +import ninja.i18n.Lang; +import ninja.i18n.Messages; +import ninja.jpa.UnitOfWork; +import ninja.session.FlashScope; +import ninja.validation.JSR303Validation; +import ninja.validation.Validation; +import services.UserService; + +@Singleton +public class ApplicationController { + + @Inject + Lang lang; + + @Inject + Messages msg; + + private static Log logger = LogFactory.getLog(ApplicationController.class); + + @Inject + Provider entityManagerProvider; + + @Inject + UserService userService; + + public Result index() { + return Results.html(); + } + + public Result userJson() { + HashMap userMap = userService.getUserMap(); + logger.info(userMap); + return Results.json().render(userMap); + } + + public Result helloWorld(Context context) { + Optional language = Optional.of("fr"); + String helloMsg = msg.get("helloMsg", language).get(); + return Results.text().render(helloMsg); + } + + public Result showFlashMsg(FlashScope flashScope) { + flashScope.success("Success message"); + flashScope.error("Error message"); + return Results.redirect("/home"); + } + + public Result home() { + return Results.html(); + } + + public Result createUser() { + return Results.html(); + } + + @UnitOfWork + public Result fetchUsers() { + EntityManager entityManager = entityManagerProvider.get(); + Query q = entityManager.createQuery("SELECT x FROM User x"); + List users = (List) q.getResultList(); + return Results.json().render(users); + } + + @Transactional + public Result insertUser(FlashScope flashScope, @JSR303Validation User user, Validation validation) { + logger.info("Inserting User : " +user); + + if (validation.getViolations().size() > 0) { + flashScope.error("Validation Error: User can't be created"); + } else { + EntityManager entityManager = entityManagerProvider.get(); + entityManager.persist(user); + entityManager.flush(); + flashScope.success("User '" + user + "' is created successfully"); + } + + return Results.redirect("/home"); + } + +} diff --git a/ninja/src/main/java/ehcache.xml b/ninja/src/main/java/ehcache.xml new file mode 100644 index 0000000000..b401b61a36 --- /dev/null +++ b/ninja/src/main/java/ehcache.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/ninja/src/main/java/logback.xml b/ninja/src/main/java/logback.xml new file mode 100644 index 0000000000..ebdcf56f76 --- /dev/null +++ b/ninja/src/main/java/logback.xml @@ -0,0 +1,33 @@ + + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + diff --git a/ninja/src/main/java/models/User.java b/ninja/src/main/java/models/User.java new file mode 100644 index 0000000000..e021567bca --- /dev/null +++ b/ninja/src/main/java/models/User.java @@ -0,0 +1,25 @@ +package models; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.validation.constraints.NotNull; + +@Entity +public class User { + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + Long id; + + @NotNull + public String firstName; + + public String email; + + public String toString() { + return firstName + " : " + email; + } + +} diff --git a/ninja/src/main/java/services/UserService.java b/ninja/src/main/java/services/UserService.java new file mode 100644 index 0000000000..10d625c66f --- /dev/null +++ b/ninja/src/main/java/services/UserService.java @@ -0,0 +1,9 @@ +package services; + +import java.util.HashMap; + +public interface UserService { + + HashMap getUserMap(); + +} diff --git a/ninja/src/main/java/services/UserServiceImpl.java b/ninja/src/main/java/services/UserServiceImpl.java new file mode 100644 index 0000000000..0f8c2214cf --- /dev/null +++ b/ninja/src/main/java/services/UserServiceImpl.java @@ -0,0 +1,15 @@ +package services; + +import java.util.HashMap; + +public class UserServiceImpl implements UserService { + + @Override + public HashMap getUserMap() { + HashMap userMap = new HashMap<>(); + userMap.put("name", "Norman Lewis"); + userMap.put("email", "norman@email.com"); + return userMap; + } + +} diff --git a/ninja/src/main/java/views/ApplicationController/createUser.ftl.html b/ninja/src/main/java/views/ApplicationController/createUser.ftl.html new file mode 100644 index 0000000000..9156f7dbf2 --- /dev/null +++ b/ninja/src/main/java/views/ApplicationController/createUser.ftl.html @@ -0,0 +1,12 @@ +<#import "../layout/defaultLayout.ftl.html" as layout> +<@layout.myLayout "Create User"> + +
+ + First Name : +
+ Email : +
+ + + \ No newline at end of file diff --git a/ninja/src/main/java/views/ApplicationController/home.ftl.html b/ninja/src/main/java/views/ApplicationController/home.ftl.html new file mode 100644 index 0000000000..10f6612d54 --- /dev/null +++ b/ninja/src/main/java/views/ApplicationController/home.ftl.html @@ -0,0 +1,9 @@ +<#import "../layout/defaultLayout.ftl.html" as layout> +<@layout.myLayout "Home page"> + + +

${i18n("helloMsg")}

+ +User Json + + \ No newline at end of file diff --git a/ninja/src/main/java/views/ApplicationController/index.ftl.html b/ninja/src/main/java/views/ApplicationController/index.ftl.html new file mode 100644 index 0000000000..25d0a31229 --- /dev/null +++ b/ninja/src/main/java/views/ApplicationController/index.ftl.html @@ -0,0 +1,9 @@ + + + Ninja: Index + + +

${i18n("helloMsg")}

+ User Json + + \ No newline at end of file diff --git a/ninja/src/main/java/views/layout/defaultLayout.ftl.html b/ninja/src/main/java/views/layout/defaultLayout.ftl.html new file mode 100644 index 0000000000..a61edd19e6 --- /dev/null +++ b/ninja/src/main/java/views/layout/defaultLayout.ftl.html @@ -0,0 +1,58 @@ +<#macro myLayout title="Layout example"> + + + + + ${title} + + + + + + + + + + + + + + + + + + +
+ + <#include "header.ftl.html"/> + + <#if (flash.error)??> +
+ ${flash.error} +
+ + + <#if (flash.success)??> +
+ ${flash.success} +
+ + + <#nested/> + + <#include "footer.ftl.html"/> + +
+ + + + + \ No newline at end of file diff --git a/ninja/src/main/java/views/layout/footer.ftl.html b/ninja/src/main/java/views/layout/footer.ftl.html new file mode 100644 index 0000000000..0a2cb2721e --- /dev/null +++ b/ninja/src/main/java/views/layout/footer.ftl.html @@ -0,0 +1,5 @@ +
+ + diff --git a/ninja/src/main/java/views/layout/header.ftl.html b/ninja/src/main/java/views/layout/header.ftl.html new file mode 100644 index 0000000000..af79449bf2 --- /dev/null +++ b/ninja/src/main/java/views/layout/header.ftl.html @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/ninja/src/main/java/views/system/403forbidden.ftl.html b/ninja/src/main/java/views/system/403forbidden.ftl.html new file mode 100644 index 0000000000..0f4efd160a --- /dev/null +++ b/ninja/src/main/java/views/system/403forbidden.ftl.html @@ -0,0 +1,18 @@ +<#import "../layout/defaultLayout.ftl.html" as layout> +<@layout.myLayout "Error. Forbidden."> +
+
+
+
+

+ Oops!

+

+ 403 Forbidden

+
+ Sorry, an error has occured. Requested page is forbidden! +
+
+
+
+
+ \ No newline at end of file diff --git a/ninja/src/main/java/views/system/404notFound.ftl.html b/ninja/src/main/java/views/system/404notFound.ftl.html new file mode 100644 index 0000000000..c10e7c3949 --- /dev/null +++ b/ninja/src/main/java/views/system/404notFound.ftl.html @@ -0,0 +1,18 @@ +<#import "../layout/defaultLayout.ftl.html" as layout> +<@layout.myLayout "Error. Not found."> +
+
+
+
+

+ Oops!

+

+ 404 Not Found

+
+ Sorry, an error has occured. Requested page not found! +
+
+
+
+
+ \ No newline at end of file diff --git a/ninja/src/main/webapp/WEB-INF/web.xml b/ninja/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..fe4b2c95bf --- /dev/null +++ b/ninja/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + ninja + + + ninja.servlet.NinjaServletListener + + + + guiceFilter + com.google.inject.servlet.GuiceFilter + + + guiceFilter + /* + + + diff --git a/ninja/src/test/java/controllers/ApiControllerDocTesterTest.java b/ninja/src/test/java/controllers/ApiControllerDocTesterTest.java new file mode 100644 index 0000000000..d5f4f1811c --- /dev/null +++ b/ninja/src/test/java/controllers/ApiControllerDocTesterTest.java @@ -0,0 +1,27 @@ +package controllers; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertThat; +import org.doctester.testbrowser.Request; +import org.doctester.testbrowser.Response; +import org.junit.Test; +import ninja.NinjaDocTester; + +public class ApiControllerDocTesterTest extends NinjaDocTester { + + String URL_INDEX = "/"; + String URL_HELLO = "/hello"; + + @Test + public void testGetIndex() { + Response response = makeRequest(Request.GET().url(testServerUrl().path(URL_INDEX))); + assertThat(response.payload, containsString("Hello, welcome to Ninja Framework!")); + } + + @Test + public void testGetHello() { + Response response = makeRequest(Request.GET().url(testServerUrl().path(URL_HELLO))); + assertThat(response.payload, containsString("Bonjour, bienvenue dans Ninja Framework!")); + } + +} diff --git a/ninja/src/test/java/controllers/ApiControllerMockUnitTest.java b/ninja/src/test/java/controllers/ApiControllerMockUnitTest.java new file mode 100644 index 0000000000..cb53965678 --- /dev/null +++ b/ninja/src/test/java/controllers/ApiControllerMockUnitTest.java @@ -0,0 +1,32 @@ +package controllers; + +import static org.junit.Assert.assertEquals; +import javax.inject.Inject; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import ninja.NinjaRunner; +import ninja.Result; +import services.UserService; + +@RunWith(NinjaRunner.class) +public class ApiControllerMockUnitTest { + + @Inject private UserService userService; + + ApplicationController applicationController; + + @Before + public void setupTest() { + applicationController = new ApplicationController(); + applicationController.userService = userService; + } + + @Test + public void testThatGetUserJson() { + Result result = applicationController.userJson(); + System.out.println(result.getRenderable()); + assertEquals(userService.getUserMap().toString(), result.getRenderable().toString()); + } + +} diff --git a/parent-spring-5/pom.xml b/parent-spring-5/pom.xml index 9260f88de5..85a4645aa7 100644 --- a/parent-spring-5/pom.xml +++ b/parent-spring-5/pom.xml @@ -30,8 +30,8 @@ - 5.1.9.RELEASE - 5.1.6.RELEASE + 5.2.2.RELEASE + 5.2.1.RELEASE \ No newline at end of file diff --git a/persistence-modules/hibernate5-2/README.md b/persistence-modules/hibernate5-2/README.md index 0b6be27410..c41b5307d0 100644 --- a/persistence-modules/hibernate5-2/README.md +++ b/persistence-modules/hibernate5-2/README.md @@ -5,4 +5,5 @@ This module contains articles about Hibernate 5. ### Relevant Articles: - [Hibernate Error “Not all named parameters have been set”](https://www.baeldung.com/hibernate-error-named-parameters-not-set) - [FetchMode in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-fetchmode) -- [[<-- Prev]](/hibernate5) \ No newline at end of file +- [JPA/Hibernate Persistence Context](https://www.baeldung.com/jpa-hibernate-persistence-context) +- [[<-- Prev]](/hibernate5) diff --git a/persistence-modules/r2dbc/pom.xml b/persistence-modules/r2dbc/pom.xml index 3b2a57401c..2c06931487 100644 --- a/persistence-modules/r2dbc/pom.xml +++ b/persistence-modules/r2dbc/pom.xml @@ -61,32 +61,10 @@ - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - 1.8 - 0.8.0.M8 + 0.8.1.RELEASE + 1.4.200 diff --git a/persistence-modules/spring-data-dynamodb/pom.xml b/persistence-modules/spring-data-dynamodb/pom.xml index 7b936817d1..871f99125a 100644 --- a/persistence-modules/spring-data-dynamodb/pom.xml +++ b/persistence-modules/spring-data-dynamodb/pom.xml @@ -151,6 +151,25 @@ org.apache.maven.plugins maven-war-plugin + + org.apache.maven.plugins + maven-dependency-plugin + ${maven-dependency-plugin.version} + + + copy-dependencies + test-compile + + copy-dependencies + + + test + so,dll,dylib + ${project.basedir}/native-libs + + + + @@ -174,6 +193,7 @@ 1.11.106 1.11.86 https://s3-us-west-2.amazonaws.com/dynamodb-local/release + 3.1.1 diff --git a/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextTest.java b/persistence-modules/spring-data-dynamodb/src/test/java/com/baeldung/SpringContextTest.java similarity index 94% rename from persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextTest.java rename to persistence-modules/spring-data-dynamodb/src/test/java/com/baeldung/SpringContextTest.java index 5e68a8e64f..3ad54e2267 100644 --- a/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextTest.java +++ b/persistence-modules/spring-data-dynamodb/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java index 9b235776dc..f1256e2c72 100755 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java @@ -1,9 +1,14 @@ package com.baeldung.multipledb.dao.product; +import java.util.List; + +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.PagingAndSortingRepository; -import com.baeldung.multipledb.model.product.ProductMultipleDB; +import com.baeldung.multipledb.model.product.Product; -public interface ProductRepository extends PagingAndSortingRepository { +public interface ProductRepository extends PagingAndSortingRepository { -} \ No newline at end of file + + List findAllByPrice(double price, Pageable pageable); +} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/ProductMultipleDB.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/Product.java similarity index 80% rename from persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/ProductMultipleDB.java rename to persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/Product.java index 8bdff340ac..eaf471043c 100755 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/ProductMultipleDB.java +++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/Product.java @@ -6,7 +6,7 @@ import javax.persistence.Table; @Entity @Table(schema = "products") -public class ProductMultipleDB { +public class Product { @Id private int id; @@ -15,19 +15,19 @@ public class ProductMultipleDB { private double price; - public ProductMultipleDB() { + public Product() { super(); } - private ProductMultipleDB(int id, String name, double price) { + private Product(int id, String name, double price) { super(); this.id = id; this.name = name; this.price = price; } - public static ProductMultipleDB from(int id, String name, double price) { - return new ProductMultipleDB(id, name, price); + public static Product from(int id, String name, double price) { + return new Product(id, name, price); } public int getId() { diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java index 6ba10a4d49..a1f4a3fa2c 100644 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java @@ -19,7 +19,7 @@ import org.springframework.transaction.annotation.Transactional; import com.baeldung.multipledb.dao.product.ProductRepository; import com.baeldung.multipledb.dao.user.PossessionRepository; import com.baeldung.multipledb.dao.user.UserRepository; -import com.baeldung.multipledb.model.product.ProductMultipleDB; +import com.baeldung.multipledb.model.product.Product; import com.baeldung.multipledb.model.user.PossessionMultipleDB; import com.baeldung.multipledb.model.user.UserMultipleDB; @@ -84,7 +84,7 @@ public class JpaMultipleDBIntegrationTest { @Test @Transactional("productTransactionManager") public void whenCreatingProduct_thenCreated() { - ProductMultipleDB product = new ProductMultipleDB(); + Product product = new Product(); product.setName("Book"); product.setId(2); product.setPrice(20); diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java new file mode 100644 index 0000000000..9bfba61a3b --- /dev/null +++ b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java @@ -0,0 +1,144 @@ +package com.baeldung.multipledb; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.junit.Before; +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.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.multipledb.PersistenceProductConfiguration; +import com.baeldung.multipledb.dao.product.ProductRepository; +import com.baeldung.multipledb.model.product.Product; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes=MultipleDbApplication.class) +@EnableTransactionManagement +public class ProductRepositoryIntegrationTest { + + @Autowired + private ProductRepository productRepository; + + @Before + @Transactional("productTransactionManager") + public void setUp() { + productRepository.save(Product.from(1001, "Book", 21)); + productRepository.save(Product.from(1002, "Coffee", 10)); + productRepository.save(Product.from(1003, "Jeans", 30)); + productRepository.save(Product.from(1004, "Shirt", 32)); + productRepository.save(Product.from(1005, "Bacon", 10)); + } + + @Test + public void whenRequestingFirstPageOfSizeTwo_ThenReturnFirstPage() { + Pageable pageRequest = PageRequest.of(0, 2); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(2)); + assertTrue(result.stream() + .map(Product::getId) + .allMatch(id -> Arrays.asList(1001, 1002) + .contains(id))); + } + + @Test + public void whenRequestingSecondPageOfSizeTwo_ThenReturnSecondPage() { + Pageable pageRequest = PageRequest.of(1, 2); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(2)); + assertTrue(result.stream() + .map(Product::getId) + .allMatch(id -> Arrays.asList(1003, 1004) + .contains(id))); + } + + @Test + public void whenRequestingLastPage_ThenReturnLastPageWithRemData() { + Pageable pageRequest = PageRequest.of(2, 2); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(1)); + assertTrue(result.stream() + .map(Product::getId) + .allMatch(id -> Arrays.asList(1005) + .contains(id))); + } + + @Test + public void whenSortingByNameAscAndPaging_ThenReturnSortedPagedResult() { + Pageable pageRequest = PageRequest.of(0, 3, Sort.by("name")); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(3)); + assertThat(result.getContent() + .stream() + .map(Product::getId) + .collect(Collectors.toList()), equalTo(Arrays.asList(1005, 1001, 1002))); + + } + + @Test + public void whenSortingByPriceDescAndPaging_ThenReturnSortedPagedResult() { + Pageable pageRequest = PageRequest.of(0, 3, Sort.by("price") + .descending()); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(3)); + assertThat(result.getContent() + .stream() + .map(Product::getId) + .collect(Collectors.toList()), equalTo(Arrays.asList(1004, 1003, 1001))); + + } + + @Test + public void whenSortingByPriceDescAndNameAscAndPaging_ThenReturnSortedPagedResult() { + Pageable pageRequest = PageRequest.of(0, 5, Sort.by("price") + .descending() + .and(Sort.by("name"))); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(5)); + assertThat(result.getContent() + .stream() + .map(Product::getId) + .collect(Collectors.toList()), equalTo(Arrays.asList(1004, 1003, 1001, 1005, 1002))); + + } + + @Test + public void whenRequestingFirstPageOfSizeTwoUsingCustomMethod_ThenReturnFirstPage() { + Pageable pageRequest = PageRequest.of(0, 2); + + List result = productRepository.findAllByPrice(10, pageRequest); + + assertThat(result, hasSize(2)); + assertTrue(result.stream() + .map(Product::getId) + .allMatch(id -> Arrays.asList(1002, 1005) + .contains(id))); + } +} diff --git a/play-framework/websockets/README.md b/play-framework/websockets/README.md new file mode 100644 index 0000000000..d056b8f059 --- /dev/null +++ b/play-framework/websockets/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [WebSockets with the Play Framework and Akka](https://www.baeldung.com/akka-play-websockets) diff --git a/pom.xml b/pom.xml index ded191b574..9bb1f762c1 100644 --- a/pom.xml +++ b/pom.xml @@ -356,6 +356,7 @@ apache-opennlp apache-poi apache-pulsar + apache-rocketmq apache-shiro apache-solrj apache-spark @@ -506,19 +507,20 @@ jackson-conversions jackson-conversions-2 jackson-custom-conversions -java-async + java-async + jackson-modules java-collections-conversions java-collections-conversions-2 java-collections-maps java-collections-maps-2 java-jdi - java-lite java-math java-math-2 java-numbers java-numbers-2 + java-numbers-3 java-rmi java-spi java-vavr-stream @@ -592,7 +594,7 @@ mustache mybatis - + ninja netflix optaplanner @@ -630,13 +632,14 @@ spring-boot-mvc-2 spring-boot-performance spring-boot-properties - + spring-mvc-basics spring-security-modules/spring-security-kerberos oauth2-framework-impl spring-boot-nashorn java-blockchain machine-learning + webrtc wildfly quarkus-extension @@ -787,13 +790,14 @@ spring-mobile spring-mockito - spring-mvc-basics-2 + spring-websockets + spring-mvc-basics-4 spring-mvc-forms-jsp spring-mvc-forms-thymeleaf spring-mvc-java spring-mvc-kotlin - spring-mvc-simple - spring-mvc-simple-2 + spring-mvc-basics-2 + spring-mvc-basics-3 spring-mvc-views spring-mvc-velocity spring-mvc-webflow @@ -831,7 +835,7 @@ spring-security-modules/spring-security-mvc-login spring-security-modules/spring-security-mvc-persisted-remember-me spring-security-modules/spring-security-mvc-socket - spring-security-modules/spring-security-openid + spring-security-modules/spring-security-oidc spring-security-modules/spring-security-rest spring-security-modules/spring-security-rest-basic-auth @@ -885,7 +889,6 @@ spring-boot-nashorn java-blockchain - @@ -1004,6 +1007,7 @@ apache-opennlp apache-poi apache-pulsar + apache-rocketmq apache-shiro apache-solrj apache-spark @@ -1146,19 +1150,20 @@ jackson-conversions jackson-conversions-2 jackson-custom-conversions -java-async + java-async + jackson-modules java-collections-conversions java-collections-conversions-2 java-collections-maps java-collections-maps-2 java-jdi - java-ee-8-security-api java-lite java-math java-math-2 java-numbers java-numbers-2 + java-numbers-3 java-rmi java-spi java-vavr-stream @@ -1229,7 +1234,7 @@ mustache mybatis - + ninja netflix optaplanner @@ -1261,7 +1266,7 @@ spf4j spring-boot-performance spring-boot-properties - + spring-mvc-basics @@ -1393,13 +1398,14 @@ spring-mobile spring-mockito - spring-mvc-basics-2 + spring-websockets spring-mvc-forms-jsp spring-mvc-forms-thymeleaf spring-mvc-java spring-mvc-kotlin - spring-mvc-simple - spring-mvc-simple-2 + spring-mvc-basics-2 + spring-mvc-basics-3 + spring-mvc-basics-4 spring-mvc-views spring-mvc-velocity spring-mvc-webflow @@ -1437,7 +1443,7 @@ spring-security-modules/spring-security-mvc-login spring-security-modules/spring-security-mvc-persisted-remember-me spring-security-modules/spring-security-mvc-socket - spring-security-modules/spring-security-openid + spring-security-modules/spring-security-oidc spring-security-modules/spring-security-rest spring-security-modules/spring-security-rest-basic-auth diff --git a/spring-4/src/main/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java b/spring-4/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java similarity index 86% rename from spring-4/src/main/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java rename to spring-4/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java index df1d173bd2..d11ca10873 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java +++ b/spring-4/src/main/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationsTestController.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.attributeannotations; +package com.baeldung.spring43.attributeannotations; import org.springframework.web.bind.annotation.*; diff --git a/spring-4/src/main/java/org/baeldung/spring43/attributeannotations/ParamInterceptor.java b/spring-4/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java similarity index 91% rename from spring-4/src/main/java/org/baeldung/spring43/attributeannotations/ParamInterceptor.java rename to spring-4/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java index 9cf6020a93..3d6e0ad8b9 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/attributeannotations/ParamInterceptor.java +++ b/spring-4/src/main/java/com/baeldung/spring43/attributeannotations/ParamInterceptor.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.attributeannotations; +package com.baeldung.spring43.attributeannotations; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; diff --git a/spring-4/src/main/java/org/baeldung/spring43/cache/Foo.java b/spring-4/src/main/java/com/baeldung/spring43/cache/Foo.java similarity index 94% rename from spring-4/src/main/java/org/baeldung/spring43/cache/Foo.java rename to spring-4/src/main/java/com/baeldung/spring43/cache/Foo.java index ce34adf6c1..731ac68e70 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/cache/Foo.java +++ b/spring-4/src/main/java/com/baeldung/spring43/cache/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.cache; +package com.baeldung.spring43.cache; import java.util.concurrent.atomic.AtomicInteger; diff --git a/spring-4/src/main/java/org/baeldung/spring43/cache/FooService.java b/spring-4/src/main/java/com/baeldung/spring43/cache/FooService.java similarity index 87% rename from spring-4/src/main/java/org/baeldung/spring43/cache/FooService.java rename to spring-4/src/main/java/com/baeldung/spring43/cache/FooService.java index ad4c8b395f..9c0aa583c5 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/cache/FooService.java +++ b/spring-4/src/main/java/com/baeldung/spring43/cache/FooService.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.cache; +package com.baeldung.spring43.cache; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; diff --git a/spring-4/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java b/spring-4/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java new file mode 100644 index 0000000000..4d8ba86f4b --- /dev/null +++ b/spring-4/src/main/java/com/baeldung/spring43/composedmapping/Appointment.java @@ -0,0 +1,5 @@ +package com.baeldung.spring43.composedmapping; + +public class Appointment { + +} diff --git a/spring-4/src/main/java/org/baeldung/spring43/composedmapping/AppointmentService.java b/spring-4/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java similarity index 72% rename from spring-4/src/main/java/org/baeldung/spring43/composedmapping/AppointmentService.java rename to spring-4/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java index c4c5e82f65..1ca389e16b 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/composedmapping/AppointmentService.java +++ b/spring-4/src/main/java/com/baeldung/spring43/composedmapping/AppointmentService.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.composedmapping; +package com.baeldung.spring43.composedmapping; import java.util.Map; diff --git a/spring-4/src/main/java/org/baeldung/spring43/composedmapping/AppointmentsController.java b/spring-4/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java similarity index 94% rename from spring-4/src/main/java/org/baeldung/spring43/composedmapping/AppointmentsController.java rename to spring-4/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java index e83a33eb89..3ff3a237ac 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/composedmapping/AppointmentsController.java +++ b/spring-4/src/main/java/com/baeldung/spring43/composedmapping/AppointmentsController.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.composedmapping; +package com.baeldung.spring43.composedmapping; import java.util.Map; diff --git a/spring-4/src/main/java/com/baeldung/spring43/ctor/FooRepository.java b/spring-4/src/main/java/com/baeldung/spring43/ctor/FooRepository.java new file mode 100644 index 0000000000..f1d8425682 --- /dev/null +++ b/spring-4/src/main/java/com/baeldung/spring43/ctor/FooRepository.java @@ -0,0 +1,5 @@ +package com.baeldung.spring43.ctor; + +public class FooRepository { + +} diff --git a/spring-4/src/main/java/org/baeldung/spring43/ctor/FooService.java b/spring-4/src/main/java/com/baeldung/spring43/ctor/FooService.java similarity index 87% rename from spring-4/src/main/java/org/baeldung/spring43/ctor/FooService.java rename to spring-4/src/main/java/com/baeldung/spring43/ctor/FooService.java index bf92d1bd32..cb481f99b2 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/ctor/FooService.java +++ b/spring-4/src/main/java/com/baeldung/spring43/ctor/FooService.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.ctor; +package com.baeldung.spring43.ctor; public class FooService { diff --git a/spring-4/src/main/java/org/baeldung/spring43/defaultmethods/DateHolder.java b/spring-4/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java similarity index 87% rename from spring-4/src/main/java/org/baeldung/spring43/defaultmethods/DateHolder.java rename to spring-4/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java index 9ae62cf484..a5307ec37c 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/defaultmethods/DateHolder.java +++ b/spring-4/src/main/java/com/baeldung/spring43/defaultmethods/DateHolder.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.defaultmethods; +package com.baeldung.spring43.defaultmethods; import java.time.LocalDate; diff --git a/spring-4/src/main/java/org/baeldung/spring43/defaultmethods/IDateHolder.java b/spring-4/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java similarity index 87% rename from spring-4/src/main/java/org/baeldung/spring43/defaultmethods/IDateHolder.java rename to spring-4/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java index e37d27f9fc..66eca031c0 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/defaultmethods/IDateHolder.java +++ b/spring-4/src/main/java/com/baeldung/spring43/defaultmethods/IDateHolder.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.defaultmethods; +package com.baeldung.spring43.defaultmethods; import java.time.LocalDate; import java.time.format.DateTimeFormatter; diff --git a/spring-4/src/main/java/org/baeldung/spring43/depresolution/FooRepository.java b/spring-4/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java similarity index 68% rename from spring-4/src/main/java/org/baeldung/spring43/depresolution/FooRepository.java rename to spring-4/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java index 313f6fc8c5..281a4f29fd 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/depresolution/FooRepository.java +++ b/spring-4/src/main/java/com/baeldung/spring43/depresolution/FooRepository.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.depresolution; +package com.baeldung.spring43.depresolution; import org.springframework.stereotype.Repository; diff --git a/spring-4/src/main/java/org/baeldung/spring43/depresolution/FooService.java b/spring-4/src/main/java/com/baeldung/spring43/depresolution/FooService.java similarity index 90% rename from spring-4/src/main/java/org/baeldung/spring43/depresolution/FooService.java rename to spring-4/src/main/java/com/baeldung/spring43/depresolution/FooService.java index b76fa84749..1a6b13dc23 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/depresolution/FooService.java +++ b/spring-4/src/main/java/com/baeldung/spring43/depresolution/FooService.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.depresolution; +package com.baeldung.spring43.depresolution; import org.springframework.beans.factory.ObjectProvider; import org.springframework.stereotype.Service; diff --git a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/AppPreferences.java b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java similarity index 81% rename from spring-4/src/main/java/org/baeldung/spring43/scopeannotations/AppPreferences.java rename to spring-4/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java index 45b90c4609..ede2849a51 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/AppPreferences.java +++ b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/AppPreferences.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.scopeannotations; +package com.baeldung.spring43.scopeannotations; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.ApplicationScope; diff --git a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/InstanceCountingService.java b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java similarity index 86% rename from spring-4/src/main/java/org/baeldung/spring43/scopeannotations/InstanceCountingService.java rename to spring-4/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java index 4fb90566d8..e6879e0544 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/InstanceCountingService.java +++ b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/InstanceCountingService.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.scopeannotations; +package com.baeldung.spring43.scopeannotations; import java.util.concurrent.atomic.AtomicInteger; diff --git a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/LoginAction.java b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java similarity index 80% rename from spring-4/src/main/java/org/baeldung/spring43/scopeannotations/LoginAction.java rename to spring-4/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java index 60017b4b94..132e701b5a 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/LoginAction.java +++ b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/LoginAction.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.scopeannotations; +package com.baeldung.spring43.scopeannotations; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.RequestScope; diff --git a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/ScopeTestController.java b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java similarity index 95% rename from spring-4/src/main/java/org/baeldung/spring43/scopeannotations/ScopeTestController.java rename to spring-4/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java index 8f4390dfc0..bd3e3e9b92 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/ScopeTestController.java +++ b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/ScopeTestController.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.scopeannotations; +package com.baeldung.spring43.scopeannotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; diff --git a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/UserPreferences.java b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java similarity index 81% rename from spring-4/src/main/java/org/baeldung/spring43/scopeannotations/UserPreferences.java rename to spring-4/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java index ce49c4b1fe..27f313b2cb 100644 --- a/spring-4/src/main/java/org/baeldung/spring43/scopeannotations/UserPreferences.java +++ b/spring-4/src/main/java/com/baeldung/spring43/scopeannotations/UserPreferences.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.scopeannotations; +package com.baeldung.spring43.scopeannotations; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.SessionScope; diff --git a/spring-4/src/main/java/org/baeldung/spring43/composedmapping/Appointment.java b/spring-4/src/main/java/org/baeldung/spring43/composedmapping/Appointment.java deleted file mode 100644 index af06249768..0000000000 --- a/spring-4/src/main/java/org/baeldung/spring43/composedmapping/Appointment.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.spring43.composedmapping; - -public class Appointment { - -} diff --git a/spring-4/src/main/java/org/baeldung/spring43/ctor/FooRepository.java b/spring-4/src/main/java/org/baeldung/spring43/ctor/FooRepository.java deleted file mode 100644 index 96dbeb8642..0000000000 --- a/spring-4/src/main/java/org/baeldung/spring43/ctor/FooRepository.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.spring43.ctor; - -public class FooRepository { - -} diff --git a/spring-4/src/main/resources/defaultmethods-context.xml b/spring-4/src/main/resources/defaultmethods-context.xml index 2b55037405..5725d0cabf 100644 --- a/spring-4/src/main/resources/defaultmethods-context.xml +++ b/spring-4/src/main/resources/defaultmethods-context.xml @@ -3,7 +3,7 @@ xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/spring-4/src/main/resources/implicit-ctor-context.xml b/spring-4/src/main/resources/implicit-ctor-context.xml index c978ca17bd..3dc0058f94 100644 --- a/spring-4/src/main/resources/implicit-ctor-context.xml +++ b/spring-4/src/main/resources/implicit-ctor-context.xml @@ -3,8 +3,8 @@ xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + diff --git a/spring-4/src/test/java/org/baeldung/SpringContextTest.java b/spring-4/src/test/java/com/baeldung/SpringContextTest.java similarity index 96% rename from spring-4/src/test/java/org/baeldung/SpringContextTest.java rename to spring-4/src/test/java/com/baeldung/SpringContextTest.java index cccdaff0cd..46308d41ea 100644 --- a/spring-4/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-4/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-4/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java b/spring-4/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java similarity index 95% rename from spring-4/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java rename to spring-4/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java index 97ae651473..97b92a943c 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java +++ b/spring-4/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.attributeannotations; +package com.baeldung.spring43.attributeannotations; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; diff --git a/spring-4/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationIntegrationTest.java similarity index 96% rename from spring-4/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationIntegrationTest.java index fff2716a64..f696a6f537 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/attributeannotations/AttributeAnnotationIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/attributeannotations/AttributeAnnotationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.attributeannotations; +package com.baeldung.spring43.attributeannotations; import org.junit.Assert; import org.junit.Before; diff --git a/spring-4/src/test/java/org/baeldung/spring43/cache/CacheRefinementsConfiguration.java b/spring-4/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java similarity index 95% rename from spring-4/src/test/java/org/baeldung/spring43/cache/CacheRefinementsConfiguration.java rename to spring-4/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java index e4610e5a83..45acb11f72 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/cache/CacheRefinementsConfiguration.java +++ b/spring-4/src/test/java/com/baeldung/spring43/cache/CacheRefinementsConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.cache; +package com.baeldung.spring43.cache; import java.util.Collections; diff --git a/spring-4/src/test/java/org/baeldung/spring43/cache/CacheRefinementsIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/cache/CacheRefinementsIntegrationTest.java similarity index 96% rename from spring-4/src/test/java/org/baeldung/spring43/cache/CacheRefinementsIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/cache/CacheRefinementsIntegrationTest.java index fa72ed6d43..3f56bb21ff 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/cache/CacheRefinementsIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/cache/CacheRefinementsIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.cache; +package com.baeldung.spring43.cache; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; diff --git a/spring-4/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java b/spring-4/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java similarity index 96% rename from spring-4/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java rename to spring-4/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java index f1028ebefb..c3a0ceba36 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java +++ b/spring-4/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.composedmapping; +package com.baeldung.spring43.composedmapping; import java.util.Collections; diff --git a/spring-4/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingIntegrationTest.java similarity index 96% rename from spring-4/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingIntegrationTest.java index d0af48cd0e..d5c912b69b 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/composedmapping/ComposedMappingIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/composedmapping/ComposedMappingIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.composedmapping; +package com.baeldung.spring43.composedmapping; import org.junit.Before; import org.junit.Test; diff --git a/spring-4/src/test/java/org/baeldung/spring43/ctor/ConfigurationConstructorInjectionIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionIntegrationTest.java similarity index 94% rename from spring-4/src/test/java/org/baeldung/spring43/ctor/ConfigurationConstructorInjectionIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionIntegrationTest.java index 871a985479..848fa44365 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/ctor/ConfigurationConstructorInjectionIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/ctor/ConfigurationConstructorInjectionIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.ctor; +package com.baeldung.spring43.ctor; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-4/src/test/java/org/baeldung/spring43/ctor/FooRepositoryConfiguration.java b/spring-4/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java similarity index 88% rename from spring-4/src/test/java/org/baeldung/spring43/ctor/FooRepositoryConfiguration.java rename to spring-4/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java index a05a36529f..fb33942844 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/ctor/FooRepositoryConfiguration.java +++ b/spring-4/src/test/java/com/baeldung/spring43/ctor/FooRepositoryConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.ctor; +package com.baeldung.spring43.ctor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-4/src/test/java/org/baeldung/spring43/ctor/FooServiceConfiguration.java b/spring-4/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java similarity index 92% rename from spring-4/src/test/java/org/baeldung/spring43/ctor/FooServiceConfiguration.java rename to spring-4/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java index 41f1719320..5ab09e37ec 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/ctor/FooServiceConfiguration.java +++ b/spring-4/src/test/java/com/baeldung/spring43/ctor/FooServiceConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.ctor; +package com.baeldung.spring43.ctor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-4/src/test/java/org/baeldung/spring43/ctor/ImplicitConstructorIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorIntegrationTest.java similarity index 94% rename from spring-4/src/test/java/org/baeldung/spring43/ctor/ImplicitConstructorIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorIntegrationTest.java index 83fa11294e..5296927ef2 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/ctor/ImplicitConstructorIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/ctor/ImplicitConstructorIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.ctor; +package com.baeldung.spring43.ctor; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-4/src/test/java/org/baeldung/spring43/defaultmethods/DefaultMethodsInjectionIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionIntegrationTest.java similarity index 93% rename from spring-4/src/test/java/org/baeldung/spring43/defaultmethods/DefaultMethodsInjectionIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionIntegrationTest.java index 956df44821..f617d48920 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/defaultmethods/DefaultMethodsInjectionIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/defaultmethods/DefaultMethodsInjectionIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.defaultmethods; +package com.baeldung.spring43.defaultmethods; import java.time.LocalDate; diff --git a/spring-4/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java b/spring-4/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java similarity index 92% rename from spring-4/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java rename to spring-4/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java index 3c180e91c8..a8f44d722d 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.defaultmethods; +package com.baeldung.spring43.defaultmethods; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-4/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java similarity index 91% rename from spring-4/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java index dde153487d..7df6040456 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.defaultmethods; +package com.baeldung.spring43.defaultmethods; import org.junit.Test; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-4/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java b/spring-4/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java similarity index 95% rename from spring-4/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java rename to spring-4/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java index 8a8cec3f86..6323854099 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java +++ b/spring-4/src/test/java/com/baeldung/spring43/defaultmethods/TransactionalTestConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.defaultmethods; +package com.baeldung.spring43.defaultmethods; import javax.sql.DataSource; diff --git a/spring-4/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderConfiguration.java b/spring-4/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java similarity index 81% rename from spring-4/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderConfiguration.java rename to spring-4/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java index 530c4d9f4a..020b50ceb2 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderConfiguration.java +++ b/spring-4/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.depresolution; +package com.baeldung.spring43.depresolution; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/spring-4/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderIntegrationTest.java similarity index 93% rename from spring-4/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderIntegrationTest.java index 6d06bfdc2a..29ce530a50 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/depresolution/ObjectProviderIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/depresolution/ObjectProviderIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.depresolution; +package com.baeldung.spring43.depresolution; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-4/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java b/spring-4/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java similarity index 93% rename from spring-4/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java rename to spring-4/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java index 24c1ec2f34..a7d9c16721 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java +++ b/spring-4/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.scopeannotations; +package com.baeldung.spring43.scopeannotations; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; diff --git a/spring-4/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsIntegrationTest.java b/spring-4/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsIntegrationTest.java similarity index 98% rename from spring-4/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsIntegrationTest.java rename to spring-4/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsIntegrationTest.java index 69cce15029..f2cea121cc 100644 --- a/spring-4/src/test/java/org/baeldung/spring43/scopeannotations/ScopeAnnotationsIntegrationTest.java +++ b/spring-4/src/test/java/com/baeldung/spring43/scopeannotations/ScopeAnnotationsIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring43.scopeannotations; +package com.baeldung.spring43.scopeannotations; import org.junit.Before; import org.junit.Test; diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml index 230f25768e..aeaf6daf1a 100644 --- a/spring-5-data-reactive/pom.xml +++ b/spring-5-data-reactive/pom.xml @@ -17,6 +17,7 @@ io.projectreactor reactor-core + ${reactor-core.version} org.springframework.boot @@ -213,31 +214,16 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - 1.2.40 1.2.40 - 5.2.0.M2 - 1.0.0.M2 - 0.8.0.M8 + 5.2.2.RELEASE + 1.0.0.RELEASE + 0.8.1.RELEASE 4.5.2 - 1.4.199 + 1.4.200 1.5.23 + 3.3.1.RELEASE diff --git a/spring-5-data-reactive/src/main/java/com/baeldung/r2dbc/repository/PlayerRepository.java b/spring-5-data-reactive/src/main/java/com/baeldung/r2dbc/repository/PlayerRepository.java index 33b653140e..20f7642a7c 100644 --- a/spring-5-data-reactive/src/main/java/com/baeldung/r2dbc/repository/PlayerRepository.java +++ b/spring-5-data-reactive/src/main/java/com/baeldung/r2dbc/repository/PlayerRepository.java @@ -1,8 +1,10 @@ package com.baeldung.r2dbc.repository; -import com.baeldung.r2dbc.model.Player; -import org.springframework.data.r2dbc.repository.query.Query; +import org.springframework.data.r2dbc.repository.Query; import org.springframework.data.repository.reactive.ReactiveCrudRepository; + +import com.baeldung.r2dbc.model.Player; + import reactor.core.publisher.Flux; public interface PlayerRepository extends ReactiveCrudRepository { diff --git a/spring-5-data-reactive/src/test/java/com/baeldung/r2dbc/R2dbcApplicationIntegrationTest.java b/spring-5-data-reactive/src/test/java/com/baeldung/r2dbc/R2dbcApplicationIntegrationTest.java index ffd2e98f8e..1af570587e 100644 --- a/spring-5-data-reactive/src/test/java/com/baeldung/r2dbc/R2dbcApplicationIntegrationTest.java +++ b/spring-5-data-reactive/src/test/java/com/baeldung/r2dbc/R2dbcApplicationIntegrationTest.java @@ -43,8 +43,7 @@ public class R2dbcApplicationIntegrationTest { "DROP TABLE IF EXISTS player;", "CREATE table player (id INT AUTO_INCREMENT NOT NULL, name VARCHAR2, age INT NOT NULL);"); - statements.forEach(it -> client.execute() // - .sql(it) // + statements.forEach(it -> client.execute(it) // .fetch() // .rowsUpdated() // .as(StepVerifier::create) // diff --git a/spring-5-reactive-security/pom.xml b/spring-5-reactive-security/pom.xml index 2f4a31241b..58c993bda5 100644 --- a/spring-5-reactive-security/pom.xml +++ b/spring-5-reactive-security/pom.xml @@ -128,7 +128,7 @@ 1.0 4.1 3.1.6.RELEASE - 2.2.1.RELEASE + 2.2.2.RELEASE diff --git a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/functional/EmployeeSpringFunctionalIntegrationTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/functional/EmployeeSpringFunctionalIntegrationTest.java index 6e73e8072c..d8e2f0b23b 100644 --- a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/functional/EmployeeSpringFunctionalIntegrationTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/functional/EmployeeSpringFunctionalIntegrationTest.java @@ -1,11 +1,7 @@ package com.baeldung.reactive.functional; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.verify; - -import java.util.ArrayList; -import java.util.List; - +import com.baeldung.webflux.Employee; +import com.baeldung.webflux.EmployeeRepository; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; @@ -15,13 +11,15 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; - -import com.baeldung.webflux.Employee; -import com.baeldung.webflux.EmployeeRepository; - import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.util.Arrays; +import java.util.List; + +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.verify; + @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = EmployeeSpringFunctionalApplication.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -58,15 +56,11 @@ public class EmployeeSpringFunctionalIntegrationTest { .bindToRouterFunction(config.getAllEmployeesRoute()) .build(); - List employeeList = new ArrayList<>(); + List employees = Arrays.asList( + new Employee("1", "Employee 1"), + new Employee("2", "Employee 2")); - Employee employee1 = new Employee("1", "Employee 1"); - Employee employee2 = new Employee("2", "Employee 2"); - - employeeList.add(employee1); - employeeList.add(employee2); - - Flux employeeFlux = Flux.fromIterable(employeeList); + Flux employeeFlux = Flux.fromIterable(employees); given(employeeRepository.findAllEmployees()).willReturn(employeeFlux); client.get() @@ -75,7 +69,7 @@ public class EmployeeSpringFunctionalIntegrationTest { .expectStatus() .isOk() .expectBodyList(Employee.class) - .isEqualTo(employeeList); + .isEqualTo(employees); } @Test diff --git a/spring-5-webflux/pom.xml b/spring-5-webflux/pom.xml index 84ee3e332c..22f429da2a 100644 --- a/spring-5-webflux/pom.xml +++ b/spring-5-webflux/pom.xml @@ -64,38 +64,6 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - 2.2.0.RELEASE diff --git a/spring-akka/src/main/java/org/baeldung/akka/AppConfiguration.java b/spring-akka/src/main/java/com/baeldung/akka/AppConfiguration.java similarity index 76% rename from spring-akka/src/main/java/org/baeldung/akka/AppConfiguration.java rename to spring-akka/src/main/java/com/baeldung/akka/AppConfiguration.java index 9211ae0fdb..3568026d6d 100644 --- a/spring-akka/src/main/java/org/baeldung/akka/AppConfiguration.java +++ b/spring-akka/src/main/java/com/baeldung/akka/AppConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.akka; +package com.baeldung.akka; import akka.actor.ActorSystem; import org.springframework.beans.factory.annotation.Autowired; @@ -7,8 +7,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import static org.baeldung.akka.SpringExtension.SPRING_EXTENSION_PROVIDER; - @Configuration @ComponentScan public class AppConfiguration { @@ -19,7 +17,7 @@ public class AppConfiguration { @Bean public ActorSystem actorSystem() { ActorSystem system = ActorSystem.create("akka-spring-demo"); - SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext); + SpringExtension.SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext); return system; } diff --git a/spring-akka/src/main/java/org/baeldung/akka/GreetingActor.java b/spring-akka/src/main/java/com/baeldung/akka/GreetingActor.java similarity index 97% rename from spring-akka/src/main/java/org/baeldung/akka/GreetingActor.java rename to spring-akka/src/main/java/com/baeldung/akka/GreetingActor.java index 6366c277a4..35dcd254d6 100644 --- a/spring-akka/src/main/java/org/baeldung/akka/GreetingActor.java +++ b/spring-akka/src/main/java/com/baeldung/akka/GreetingActor.java @@ -1,4 +1,4 @@ -package org.baeldung.akka; +package com.baeldung.akka; import akka.actor.UntypedActor; import org.springframework.beans.factory.config.ConfigurableBeanFactory; diff --git a/spring-akka/src/main/java/org/baeldung/akka/GreetingService.java b/spring-akka/src/main/java/com/baeldung/akka/GreetingService.java similarity index 86% rename from spring-akka/src/main/java/org/baeldung/akka/GreetingService.java rename to spring-akka/src/main/java/com/baeldung/akka/GreetingService.java index 801921887d..aa6883648b 100644 --- a/spring-akka/src/main/java/org/baeldung/akka/GreetingService.java +++ b/spring-akka/src/main/java/com/baeldung/akka/GreetingService.java @@ -1,4 +1,4 @@ -package org.baeldung.akka; +package com.baeldung.akka; import org.springframework.stereotype.Component; diff --git a/spring-akka/src/main/java/org/baeldung/akka/SpringActorProducer.java b/spring-akka/src/main/java/com/baeldung/akka/SpringActorProducer.java similarity index 96% rename from spring-akka/src/main/java/org/baeldung/akka/SpringActorProducer.java rename to spring-akka/src/main/java/com/baeldung/akka/SpringActorProducer.java index 20813ab60a..289acb4447 100644 --- a/spring-akka/src/main/java/org/baeldung/akka/SpringActorProducer.java +++ b/spring-akka/src/main/java/com/baeldung/akka/SpringActorProducer.java @@ -1,4 +1,4 @@ -package org.baeldung.akka; +package com.baeldung.akka; import akka.actor.Actor; import akka.actor.IndirectActorProducer; diff --git a/spring-akka/src/main/java/org/baeldung/akka/SpringExtension.java b/spring-akka/src/main/java/com/baeldung/akka/SpringExtension.java similarity index 97% rename from spring-akka/src/main/java/org/baeldung/akka/SpringExtension.java rename to spring-akka/src/main/java/com/baeldung/akka/SpringExtension.java index aa5941c763..96f62da179 100644 --- a/spring-akka/src/main/java/org/baeldung/akka/SpringExtension.java +++ b/spring-akka/src/main/java/com/baeldung/akka/SpringExtension.java @@ -1,4 +1,4 @@ -package org.baeldung.akka; +package com.baeldung.akka; import akka.actor.AbstractExtensionId; import akka.actor.ExtendedActorSystem; diff --git a/spring-akka/src/test/java/org/baeldung/akka/SpringAkkaIntegrationTest.java b/spring-akka/src/test/java/com/baeldung/akka/SpringAkkaIntegrationTest.java similarity index 90% rename from spring-akka/src/test/java/org/baeldung/akka/SpringAkkaIntegrationTest.java rename to spring-akka/src/test/java/com/baeldung/akka/SpringAkkaIntegrationTest.java index c5da0f747e..3915a46507 100644 --- a/spring-akka/src/test/java/org/baeldung/akka/SpringAkkaIntegrationTest.java +++ b/spring-akka/src/test/java/com/baeldung/akka/SpringAkkaIntegrationTest.java @@ -1,11 +1,11 @@ -package org.baeldung.akka; +package com.baeldung.akka; import java.util.concurrent.TimeUnit; import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.util.Timeout; -import org.baeldung.akka.GreetingActor.Greet; +import com.baeldung.akka.GreetingActor.Greet; import org.junit.After; import org.junit.Assert; import org.junit.Test; @@ -17,7 +17,7 @@ import scala.concurrent.Future; import scala.concurrent.duration.FiniteDuration; import static akka.pattern.Patterns.ask; -import static org.baeldung.akka.SpringExtension.SPRING_EXTENSION_PROVIDER; +import static com.baeldung.akka.SpringExtension.SPRING_EXTENSION_PROVIDER; @ContextConfiguration(classes = AppConfiguration.class) public class SpringAkkaIntegrationTest extends AbstractJUnit4SpringContextTests { diff --git a/spring-aop/README.md b/spring-aop/README.md index 061e736d31..4522cd63c1 100644 --- a/spring-aop/README.md +++ b/spring-aop/README.md @@ -3,8 +3,9 @@ This module contains articles about Spring aspect oriented programming (AOP) ### Relevant articles - - [Implementing a Custom Spring AOP Annotation](https://www.baeldung.com/spring-aop-annotation) - [Intro to AspectJ](https://www.baeldung.com/aspectj) - [Spring Performance Logging](https://www.baeldung.com/spring-performance-logging) - [Introduction to Spring AOP](https://www.baeldung.com/spring-aop) +- [Introduction to Pointcut Expressions in Spring](https://www.baeldung.com/spring-aop-pointcut-tutorial) +- [Introduction to Advice Types in Spring](https://www.baeldung.com/spring-aop-advice-tutorial) \ No newline at end of file diff --git a/spring-aop/src/main/java/org/baeldung/Application.java b/spring-aop/src/main/java/com/baeldung/Application.java similarity index 92% rename from spring-aop/src/main/java/org/baeldung/Application.java rename to spring-aop/src/main/java/com/baeldung/Application.java index e5c764ef7e..c0490d50c6 100644 --- a/spring-aop/src/main/java/org/baeldung/Application.java +++ b/spring-aop/src/main/java/com/baeldung/Application.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -6,7 +6,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { - public static void main(String[] args) { SpringApplication.run(Application.class, args); } diff --git a/spring-aop/src/main/java/org/baeldung/ExampleAspect.java b/spring-aop/src/main/java/com/baeldung/ExampleAspect.java similarity index 88% rename from spring-aop/src/main/java/org/baeldung/ExampleAspect.java rename to spring-aop/src/main/java/com/baeldung/ExampleAspect.java index 7c3b5fb599..482f4b8c08 100644 --- a/spring-aop/src/main/java/org/baeldung/ExampleAspect.java +++ b/spring-aop/src/main/java/com/baeldung/ExampleAspect.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -9,7 +9,7 @@ import org.springframework.stereotype.Component; @Component public class ExampleAspect { - @Around("@annotation(LogExecutionTime)") + @Around("@annotation(com.baeldung.LogExecutionTime)") public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable { final long start = System.currentTimeMillis(); diff --git a/spring-aop/src/main/java/org/baeldung/LogExecutionTime.java b/spring-aop/src/main/java/com/baeldung/LogExecutionTime.java similarity index 92% rename from spring-aop/src/main/java/org/baeldung/LogExecutionTime.java rename to spring-aop/src/main/java/com/baeldung/LogExecutionTime.java index c10f97e78f..c58a3cb7ee 100644 --- a/spring-aop/src/main/java/org/baeldung/LogExecutionTime.java +++ b/spring-aop/src/main/java/com/baeldung/LogExecutionTime.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-aop/src/main/java/org/baeldung/Service.java b/spring-aop/src/main/java/com/baeldung/Service.java similarity index 90% rename from spring-aop/src/main/java/org/baeldung/Service.java rename to spring-aop/src/main/java/com/baeldung/Service.java index e4bee38438..01315c9723 100644 --- a/spring-aop/src/main/java/org/baeldung/Service.java +++ b/spring-aop/src/main/java/com/baeldung/Service.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.springframework.stereotype.Component; diff --git a/spring-aop/src/main/java/org/baeldung/aspectj/Account.java b/spring-aop/src/main/java/com/baeldung/aspectj/Account.java similarity index 88% rename from spring-aop/src/main/java/org/baeldung/aspectj/Account.java rename to spring-aop/src/main/java/com/baeldung/aspectj/Account.java index 2c551116f4..bc9ca375aa 100644 --- a/spring-aop/src/main/java/org/baeldung/aspectj/Account.java +++ b/spring-aop/src/main/java/com/baeldung/aspectj/Account.java @@ -1,4 +1,4 @@ -package org.baeldung.aspectj; +package com.baeldung.aspectj; public class Account { int balance = 20; diff --git a/spring-aop/src/main/java/org/baeldung/aspectj/AccountAspect.aj b/spring-aop/src/main/java/com/baeldung/aspectj/AccountAspect.aj similarity index 86% rename from spring-aop/src/main/java/org/baeldung/aspectj/AccountAspect.aj rename to spring-aop/src/main/java/com/baeldung/aspectj/AccountAspect.aj index f08d7dc281..0c79e5546a 100644 --- a/spring-aop/src/main/java/org/baeldung/aspectj/AccountAspect.aj +++ b/spring-aop/src/main/java/com/baeldung/aspectj/AccountAspect.aj @@ -1,4 +1,4 @@ -package org.baeldung.aspectj; +package com.baeldung.aspectj; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -8,7 +8,7 @@ public aspect AccountAspect { final int MIN_BALANCE = 10; pointcut callWithDraw(int amount, Account account): - call(boolean Account.withdraw(int)) && args(amount) && target(account); + call(boolean com.baeldung.aspectj.Account.withdraw(int)) && args(amount) && target(account); before(int amount, Account account) : callWithDraw(amount, account) { logger.info(" Balance before withdrawal: {}", account.balance); diff --git a/spring-aop/src/main/java/org/baeldung/aspectj/Secured.java b/spring-aop/src/main/java/com/baeldung/aspectj/Secured.java similarity index 90% rename from spring-aop/src/main/java/org/baeldung/aspectj/Secured.java rename to spring-aop/src/main/java/com/baeldung/aspectj/Secured.java index 08711d5db1..923f208c2f 100644 --- a/spring-aop/src/main/java/org/baeldung/aspectj/Secured.java +++ b/spring-aop/src/main/java/com/baeldung/aspectj/Secured.java @@ -1,4 +1,4 @@ -package org.baeldung.aspectj; +package com.baeldung.aspectj; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-aop/src/main/java/org/baeldung/aspectj/SecuredMethod.java b/spring-aop/src/main/java/com/baeldung/aspectj/SecuredMethod.java similarity index 94% rename from spring-aop/src/main/java/org/baeldung/aspectj/SecuredMethod.java rename to spring-aop/src/main/java/com/baeldung/aspectj/SecuredMethod.java index d1f7d43738..aa4b733a00 100644 --- a/spring-aop/src/main/java/org/baeldung/aspectj/SecuredMethod.java +++ b/spring-aop/src/main/java/com/baeldung/aspectj/SecuredMethod.java @@ -1,4 +1,4 @@ -package org.baeldung.aspectj; +package com.baeldung.aspectj; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-aop/src/main/java/org/baeldung/aspectj/SecuredMethodAspect.java b/spring-aop/src/main/java/com/baeldung/aspectj/SecuredMethodAspect.java similarity index 96% rename from spring-aop/src/main/java/org/baeldung/aspectj/SecuredMethodAspect.java rename to spring-aop/src/main/java/com/baeldung/aspectj/SecuredMethodAspect.java index b474f266ab..9ea45ec43b 100644 --- a/spring-aop/src/main/java/org/baeldung/aspectj/SecuredMethodAspect.java +++ b/spring-aop/src/main/java/com/baeldung/aspectj/SecuredMethodAspect.java @@ -1,4 +1,4 @@ -package org.baeldung.aspectj; +package com.baeldung.aspectj; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; diff --git a/spring-aop/src/main/java/org/baeldung/logger/AdderAfterAspect.java b/spring-aop/src/main/java/com/baeldung/logger/AdderAfterAspect.java similarity index 86% rename from spring-aop/src/main/java/org/baeldung/logger/AdderAfterAspect.java rename to spring-aop/src/main/java/com/baeldung/logger/AdderAfterAspect.java index 59afa38f06..658eb8a726 100644 --- a/spring-aop/src/main/java/org/baeldung/logger/AdderAfterAspect.java +++ b/spring-aop/src/main/java/com/baeldung/logger/AdderAfterAspect.java @@ -1,13 +1,13 @@ -package org.baeldung.logger; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AdderAfterAspect { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - public void afterAdvice() throws Throwable { - logger.info("I'm done calling the method"); - } -} +package com.baeldung.logger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AdderAfterAspect { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + public void afterAdvice() throws Throwable { + logger.info("I'm done calling the method"); + } +} diff --git a/spring-aop/src/main/java/org/baeldung/logger/AdderAfterReturnAspect.java b/spring-aop/src/main/java/com/baeldung/logger/AdderAfterReturnAspect.java similarity index 88% rename from spring-aop/src/main/java/org/baeldung/logger/AdderAfterReturnAspect.java rename to spring-aop/src/main/java/com/baeldung/logger/AdderAfterReturnAspect.java index a2b1959374..faec9547aa 100644 --- a/spring-aop/src/main/java/org/baeldung/logger/AdderAfterReturnAspect.java +++ b/spring-aop/src/main/java/com/baeldung/logger/AdderAfterReturnAspect.java @@ -1,13 +1,13 @@ -package org.baeldung.logger; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AdderAfterReturnAspect { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - public void afterReturn(final Object returnValue) throws Throwable { - logger.info("value return was {}", returnValue); - } -} +package com.baeldung.logger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AdderAfterReturnAspect { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + public void afterReturn(final Object returnValue) throws Throwable { + logger.info("value return was {}", returnValue); + } +} diff --git a/spring-aop/src/main/java/org/baeldung/logger/AdderAfterThrowAspect.java b/spring-aop/src/main/java/com/baeldung/logger/AdderAfterThrowAspect.java similarity index 88% rename from spring-aop/src/main/java/org/baeldung/logger/AdderAfterThrowAspect.java rename to spring-aop/src/main/java/com/baeldung/logger/AdderAfterThrowAspect.java index 1f19af05e4..8637730b8a 100644 --- a/spring-aop/src/main/java/org/baeldung/logger/AdderAfterThrowAspect.java +++ b/spring-aop/src/main/java/com/baeldung/logger/AdderAfterThrowAspect.java @@ -1,13 +1,13 @@ -package org.baeldung.logger; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AdderAfterThrowAspect { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - public void afterThrow(final Exception exception) throws Throwable { - logger.info("Exception thrown was {}", exception.getMessage()); - } -} +package com.baeldung.logger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AdderAfterThrowAspect { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + public void afterThrow(final Exception exception) throws Throwable { + logger.info("Exception thrown was {}", exception.getMessage()); + } +} diff --git a/spring-aop/src/main/java/org/baeldung/logger/AdderAroundAspect.java b/spring-aop/src/main/java/com/baeldung/logger/AdderAroundAspect.java similarity index 92% rename from spring-aop/src/main/java/org/baeldung/logger/AdderAroundAspect.java rename to spring-aop/src/main/java/com/baeldung/logger/AdderAroundAspect.java index fceba87d15..1524576085 100644 --- a/spring-aop/src/main/java/org/baeldung/logger/AdderAroundAspect.java +++ b/spring-aop/src/main/java/com/baeldung/logger/AdderAroundAspect.java @@ -1,18 +1,18 @@ -package org.baeldung.logger; - -import java.util.Arrays; -import org.aspectj.lang.ProceedingJoinPoint; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AdderAroundAspect { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - public Object aroundAdvice(final ProceedingJoinPoint joinPoint) throws Throwable { - logger.info("Arguments passed to method are: " + Arrays.toString(joinPoint.getArgs())); - final Object result = joinPoint.proceed(); - logger.info("Result from method is: " + result); - return result; - } -} +package com.baeldung.logger; + +import java.util.Arrays; +import org.aspectj.lang.ProceedingJoinPoint; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AdderAroundAspect { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + public Object aroundAdvice(final ProceedingJoinPoint joinPoint) throws Throwable { + logger.info("Arguments passed to method are: " + Arrays.toString(joinPoint.getArgs())); + final Object result = joinPoint.proceed(); + logger.info("Result from method is: " + result); + return result; + } +} diff --git a/spring-aop/src/main/java/org/baeldung/logger/AdderBeforeAspect.java b/spring-aop/src/main/java/com/baeldung/logger/AdderBeforeAspect.java similarity index 87% rename from spring-aop/src/main/java/org/baeldung/logger/AdderBeforeAspect.java rename to spring-aop/src/main/java/com/baeldung/logger/AdderBeforeAspect.java index 750e7ba122..0d30622088 100644 --- a/spring-aop/src/main/java/org/baeldung/logger/AdderBeforeAspect.java +++ b/spring-aop/src/main/java/com/baeldung/logger/AdderBeforeAspect.java @@ -1,13 +1,13 @@ -package org.baeldung.logger; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AdderBeforeAspect { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - public void beforeAdvice() throws Throwable { - logger.info("I would be executed just before method starts"); - } -} +package com.baeldung.logger; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AdderBeforeAspect { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + public void beforeAdvice() throws Throwable { + logger.info("I would be executed just before method starts"); + } +} diff --git a/spring-aop/src/main/java/org/baeldung/logger/SampleAdder.java b/spring-aop/src/main/java/com/baeldung/logger/SampleAdder.java similarity index 85% rename from spring-aop/src/main/java/org/baeldung/logger/SampleAdder.java rename to spring-aop/src/main/java/com/baeldung/logger/SampleAdder.java index 96fda1b0b9..0ef13ca7f0 100644 --- a/spring-aop/src/main/java/org/baeldung/logger/SampleAdder.java +++ b/spring-aop/src/main/java/com/baeldung/logger/SampleAdder.java @@ -1,12 +1,12 @@ -package org.baeldung.logger; - -public class SampleAdder { - - public int add(int a, int b) { - if (a < 0 || b < 0) { - throw new IllegalArgumentException("Make sure all the arguments are greater than zero."); - } - return a + b; - } - -} +package com.baeldung.logger; + +public class SampleAdder { + + public int add(int a, int b) { + if (a < 0 || b < 0) { + throw new IllegalArgumentException("Make sure all the arguments are greater than zero."); + } + return a + b; + } + +} diff --git a/spring-aop/src/main/java/org/baeldung/performancemonitor/AopConfiguration.java b/spring-aop/src/main/java/com/baeldung/performancemonitor/AopConfiguration.java similarity index 85% rename from spring-aop/src/main/java/org/baeldung/performancemonitor/AopConfiguration.java rename to spring-aop/src/main/java/com/baeldung/performancemonitor/AopConfiguration.java index 00026baf07..3df14e2f45 100644 --- a/spring-aop/src/main/java/org/baeldung/performancemonitor/AopConfiguration.java +++ b/spring-aop/src/main/java/com/baeldung/performancemonitor/AopConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.performancemonitor; +package com.baeldung.performancemonitor; import org.aspectj.lang.annotation.Pointcut; import org.springframework.aop.Advisor; @@ -16,10 +16,10 @@ import java.time.Month; @EnableAspectJAutoProxy public class AopConfiguration { - @Pointcut("execution(public String org.baeldung.performancemonitor.PersonService.getFullName(..))") + @Pointcut("execution(public String com.baeldung.performancemonitor.PersonService.getFullName(..))") public void monitor() { } - @Pointcut("execution(public int org.baeldung.performancemonitor.PersonService.getAge(..))") + @Pointcut("execution(public int com.baeldung.performancemonitor.PersonService.getAge(..))") public void myMonitor() { } @Bean @@ -30,7 +30,7 @@ public class AopConfiguration { @Bean public Advisor performanceMonitorAdvisor() { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); - pointcut.setExpression("org.baeldung.performancemonitor.AopConfiguration.monitor()"); + pointcut.setExpression("com.baeldung.performancemonitor.AopConfiguration.monitor()"); return new DefaultPointcutAdvisor(pointcut, performanceMonitorInterceptor()); } @@ -52,7 +52,7 @@ public class AopConfiguration { @Bean public Advisor myPerformanceMonitorAdvisor() { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); - pointcut.setExpression("org.baeldung.performancemonitor.AopConfiguration.myMonitor()"); + pointcut.setExpression("com.baeldung.performancemonitor.AopConfiguration.myMonitor()"); return new DefaultPointcutAdvisor(pointcut, myPerformanceMonitorInterceptor()); } diff --git a/spring-aop/src/main/java/org/baeldung/performancemonitor/MyPerformanceMonitorInterceptor.java b/spring-aop/src/main/java/com/baeldung/performancemonitor/MyPerformanceMonitorInterceptor.java similarity index 96% rename from spring-aop/src/main/java/org/baeldung/performancemonitor/MyPerformanceMonitorInterceptor.java rename to spring-aop/src/main/java/com/baeldung/performancemonitor/MyPerformanceMonitorInterceptor.java index d098d9466c..dfc6606c6a 100644 --- a/spring-aop/src/main/java/org/baeldung/performancemonitor/MyPerformanceMonitorInterceptor.java +++ b/spring-aop/src/main/java/com/baeldung/performancemonitor/MyPerformanceMonitorInterceptor.java @@ -1,4 +1,4 @@ -package org.baeldung.performancemonitor; +package com.baeldung.performancemonitor; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; diff --git a/spring-aop/src/main/java/org/baeldung/performancemonitor/PerfomanceApp.java b/spring-aop/src/main/java/com/baeldung/performancemonitor/PerfomanceApp.java similarity index 93% rename from spring-aop/src/main/java/org/baeldung/performancemonitor/PerfomanceApp.java rename to spring-aop/src/main/java/com/baeldung/performancemonitor/PerfomanceApp.java index d0fb3a5393..00268c978e 100644 --- a/spring-aop/src/main/java/org/baeldung/performancemonitor/PerfomanceApp.java +++ b/spring-aop/src/main/java/com/baeldung/performancemonitor/PerfomanceApp.java @@ -1,4 +1,4 @@ -package org.baeldung.performancemonitor; +package com.baeldung.performancemonitor; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/spring-aop/src/main/java/org/baeldung/performancemonitor/Person.java b/spring-aop/src/main/java/com/baeldung/performancemonitor/Person.java similarity index 95% rename from spring-aop/src/main/java/org/baeldung/performancemonitor/Person.java rename to spring-aop/src/main/java/com/baeldung/performancemonitor/Person.java index abd2465764..f16f28fdef 100644 --- a/spring-aop/src/main/java/org/baeldung/performancemonitor/Person.java +++ b/spring-aop/src/main/java/com/baeldung/performancemonitor/Person.java @@ -1,4 +1,4 @@ -package org.baeldung.performancemonitor; +package com.baeldung.performancemonitor; import java.time.LocalDate; diff --git a/spring-aop/src/main/java/org/baeldung/performancemonitor/PersonService.java b/spring-aop/src/main/java/com/baeldung/performancemonitor/PersonService.java similarity index 89% rename from spring-aop/src/main/java/org/baeldung/performancemonitor/PersonService.java rename to spring-aop/src/main/java/com/baeldung/performancemonitor/PersonService.java index 5b98aaf436..f5bfdddc12 100644 --- a/spring-aop/src/main/java/org/baeldung/performancemonitor/PersonService.java +++ b/spring-aop/src/main/java/com/baeldung/performancemonitor/PersonService.java @@ -1,4 +1,4 @@ -package org.baeldung.performancemonitor; +package com.baeldung.performancemonitor; import java.time.LocalDate; import java.time.Period; diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/Foo.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/Foo.java similarity index 76% rename from spring-mvc-java/src/main/java/com/baeldung/model/Foo.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/Foo.java index 01f5f43f60..b20c9a3ccf 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/model/Foo.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/Foo.java @@ -1,6 +1,6 @@ -package com.baeldung.model; +package com.baeldung.pointcutadvice; -import com.baeldung.aop.annotations.Entity; +import com.baeldung.pointcutadvice.annotations.Entity; @Entity public class Foo { diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/LoggingAspect.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/LoggingAspect.java similarity index 87% rename from spring-mvc-java/src/main/java/com/baeldung/aop/LoggingAspect.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/LoggingAspect.java index 169d664471..481e1d323a 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/LoggingAspect.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/LoggingAspect.java @@ -1,4 +1,4 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; @@ -23,15 +23,15 @@ public class LoggingAspect { } }; - @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))") + @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.*(..))") public void repositoryMethods() { } - @Pointcut("within(com.baeldung..*) && @annotation(com.baeldung.aop.annotations.Loggable)") + @Pointcut("within(com.baeldung..*) && @annotation(com.baeldung.pointcutadvice.annotations.Loggable)") public void loggableMethods() { } - @Pointcut("within(com.baeldung..*) && @args(com.baeldung.aop.annotations.Entity)") + @Pointcut("within(com.baeldung..*) && @args(com.baeldung.pointcutadvice.annotations.Entity)") public void methodsAcceptingEntities() { } diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/PerformanceAspect.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java similarity index 93% rename from spring-mvc-java/src/main/java/com/baeldung/aop/PerformanceAspect.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java index 8f374cc1e5..4f445e301e 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/PerformanceAspect.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java @@ -1,4 +1,4 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -15,7 +15,7 @@ public class PerformanceAspect { private static Logger logger = Logger.getLogger(PerformanceAspect.class.getName()); - @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))") + @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.*(..))") public void repositoryClassMethods() { } diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/PublishingAspect.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PublishingAspect.java similarity index 86% rename from spring-mvc-java/src/main/java/com/baeldung/aop/PublishingAspect.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/PublishingAspect.java index a45402dc18..bb96e08772 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/PublishingAspect.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PublishingAspect.java @@ -1,6 +1,6 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.events.FooCreationEvent; +import com.baeldung.pointcutadvice.events.FooCreationEvent; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; @@ -20,11 +20,11 @@ public class PublishingAspect { this.eventPublisher = eventPublisher; } - @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))") + @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.*(..))") public void repositoryMethods() { } - @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.create*(Long,..))") + @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.create*(Long,..))") public void firstLongParamMethods() { } diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Entity.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Entity.java similarity index 83% rename from spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Entity.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Entity.java index 61d91b0777..e6753cdd61 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Entity.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Entity.java @@ -1,4 +1,4 @@ -package com.baeldung.aop.annotations; +package com.baeldung.pointcutadvice.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Loggable.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Loggable.java similarity index 84% rename from spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Loggable.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Loggable.java index 92aa950e58..921003be63 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Loggable.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Loggable.java @@ -1,4 +1,4 @@ -package com.baeldung.aop.annotations; +package com.baeldung.pointcutadvice.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-mvc-java/src/main/java/com/baeldung/dao/FooDao.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/dao/FooDao.java similarity index 69% rename from spring-mvc-java/src/main/java/com/baeldung/dao/FooDao.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/dao/FooDao.java index 1d28b082ec..72a9762991 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/dao/FooDao.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/dao/FooDao.java @@ -1,7 +1,7 @@ -package com.baeldung.dao; +package com.baeldung.pointcutadvice.dao; -import com.baeldung.aop.annotations.Loggable; -import com.baeldung.model.Foo; +import com.baeldung.pointcutadvice.Foo; +import com.baeldung.pointcutadvice.annotations.Loggable; import org.springframework.stereotype.Repository; @Repository diff --git a/spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEvent.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEvent.java similarity index 81% rename from spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEvent.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEvent.java index 5ea4b46c04..8cee80fa0c 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEvent.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEvent.java @@ -1,4 +1,4 @@ -package com.baeldung.events; +package com.baeldung.pointcutadvice.events; import org.springframework.context.ApplicationEvent; diff --git a/spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEventListener.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEventListener.java similarity index 91% rename from spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEventListener.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEventListener.java index c0aa744bc1..4a55b2138d 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEventListener.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEventListener.java @@ -1,4 +1,4 @@ -package com.baeldung.events; +package com.baeldung.pointcutadvice.events; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; diff --git a/spring-aop/src/main/resources/META-INF/aop.xml b/spring-aop/src/main/resources/META-INF/aop.xml index e5bddcc30c..f930cde942 100644 --- a/spring-aop/src/main/resources/META-INF/aop.xml +++ b/spring-aop/src/main/resources/META-INF/aop.xml @@ -1,6 +1,6 @@ - + diff --git a/spring-aop/src/main/resources/org.baeldung.logger/springAop-applicationContext.xml b/spring-aop/src/main/resources/com.baeldung.logger/springAop-applicationContext.xml similarity index 75% rename from spring-aop/src/main/resources/org.baeldung.logger/springAop-applicationContext.xml rename to spring-aop/src/main/resources/com.baeldung.logger/springAop-applicationContext.xml index 058beaa7a1..595e7e46e6 100644 --- a/spring-aop/src/main/resources/org.baeldung.logger/springAop-applicationContext.xml +++ b/spring-aop/src/main/resources/com.baeldung.logger/springAop-applicationContext.xml @@ -1,54 +1,54 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-aop/src/main/resources/logback.xml b/spring-aop/src/main/resources/logback.xml index 7c15f603a0..4eaa556705 100644 --- a/spring-aop/src/main/resources/logback.xml +++ b/spring-aop/src/main/resources/logback.xml @@ -13,7 +13,7 @@ - + diff --git a/spring-mvc-java/src/main/resources/com/baeldung/aop/beans.xml b/spring-aop/src/main/resources/pointcutadvice/beans.xml similarity index 83% rename from spring-mvc-java/src/main/resources/com/baeldung/aop/beans.xml rename to spring-aop/src/main/resources/pointcutadvice/beans.xml index e6aa9d77c4..ad96827a13 100644 --- a/spring-mvc-java/src/main/resources/com/baeldung/aop/beans.xml +++ b/spring-aop/src/main/resources/pointcutadvice/beans.xml @@ -7,8 +7,8 @@ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd"> - - + + diff --git a/spring-aop/src/test/java/org/baeldung/CustomAnnotationIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/CustomAnnotationIntegrationTest.java similarity index 95% rename from spring-aop/src/test/java/org/baeldung/CustomAnnotationIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/CustomAnnotationIntegrationTest.java index b109e3a39e..155f8e1c96 100644 --- a/spring-aop/src/test/java/org/baeldung/CustomAnnotationIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/CustomAnnotationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-aop/src/test/java/org/baeldung/SpringContextTest.java b/spring-aop/src/test/java/com/baeldung/SpringContextTest.java similarity index 94% rename from spring-aop/src/test/java/org/baeldung/SpringContextTest.java rename to spring-aop/src/test/java/com/baeldung/SpringContextTest.java index 4d3ed953c4..13c1c162f1 100644 --- a/spring-aop/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-aop/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-aop/src/test/java/org/baeldung/aspectj/AccountUnitTest.java b/spring-aop/src/test/java/com/baeldung/aspectj/AccountUnitTest.java similarity index 94% rename from spring-aop/src/test/java/org/baeldung/aspectj/AccountUnitTest.java rename to spring-aop/src/test/java/com/baeldung/aspectj/AccountUnitTest.java index 3d5384a7f7..3af1f963da 100644 --- a/spring-aop/src/test/java/org/baeldung/aspectj/AccountUnitTest.java +++ b/spring-aop/src/test/java/com/baeldung/aspectj/AccountUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.aspectj; +package com.baeldung.aspectj; import org.junit.Before; import org.junit.Test; diff --git a/spring-aop/src/test/java/org/baeldung/aspectj/SecuredMethodUnitTest.java b/spring-aop/src/test/java/com/baeldung/aspectj/SecuredMethodUnitTest.java similarity index 89% rename from spring-aop/src/test/java/org/baeldung/aspectj/SecuredMethodUnitTest.java rename to spring-aop/src/test/java/com/baeldung/aspectj/SecuredMethodUnitTest.java index cbdb2db057..e1a2553610 100644 --- a/spring-aop/src/test/java/org/baeldung/aspectj/SecuredMethodUnitTest.java +++ b/spring-aop/src/test/java/com/baeldung/aspectj/SecuredMethodUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.aspectj; +package com.baeldung.aspectj; import org.junit.Test; diff --git a/spring-aop/src/test/java/org/baeldung/logger/CalculatorIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/logger/CalculatorIntegrationTest.java similarity index 93% rename from spring-aop/src/test/java/org/baeldung/logger/CalculatorIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/logger/CalculatorIntegrationTest.java index 8c31b7f892..66e06f7928 100644 --- a/spring-aop/src/test/java/org/baeldung/logger/CalculatorIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/logger/CalculatorIntegrationTest.java @@ -1,29 +1,29 @@ -package org.baeldung.logger; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(value = {"classpath:springAop-applicationContext.xml"}) -public class CalculatorIntegrationTest { - - @Autowired - private SampleAdder sampleAdder; - - @Test - public void whenAddValidValues_returnsSucessfully() { - final int addedValue = sampleAdder.add(12, 12); - - assertEquals(24, addedValue); - } - - @Test (expected = IllegalArgumentException.class) - public void whenAddInValidValues_throwsException() { - sampleAdder.add(12, -12); - } - -} +package com.baeldung.logger; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(value = {"classpath:springAop-applicationContext.xml"}) +public class CalculatorIntegrationTest { + + @Autowired + private SampleAdder sampleAdder; + + @Test + public void whenAddValidValues_returnsSucessfully() { + final int addedValue = sampleAdder.add(12, 12); + + assertEquals(24, addedValue); + } + + @Test (expected = IllegalArgumentException.class) + public void whenAddInValidValues_throwsException() { + sampleAdder.add(12, -12); + } + +} diff --git a/spring-mvc-java/src/test/java/com/baeldung/aop/AopLoggingIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java similarity index 91% rename from spring-mvc-java/src/test/java/com/baeldung/aop/AopLoggingIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java index 698bae4c0f..a687eec388 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/aop/AopLoggingIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java @@ -1,8 +1,7 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.config.TestConfig; -import com.baeldung.dao.FooDao; -import com.baeldung.model.Foo; +import com.baeldung.Application; +import com.baeldung.pointcutadvice.dao.FooDao; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -24,7 +23,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = {TestConfig.class}, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration(classes = {Application.class}, loader = AnnotationConfigContextLoader.class) public class AopLoggingIntegrationTest { @Before diff --git a/spring-mvc-java/src/test/java/com/baeldung/aop/AopPerformanceIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java similarity index 89% rename from spring-mvc-java/src/test/java/com/baeldung/aop/AopPerformanceIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java index c9ab2fb4bb..5a7797e5cd 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/aop/AopPerformanceIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java @@ -1,7 +1,7 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.config.TestConfig; -import com.baeldung.dao.FooDao; +import com.baeldung.Application; +import com.baeldung.pointcutadvice.dao.FooDao; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -23,7 +23,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { TestConfig.class }, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration(classes = {Application.class}, loader = AnnotationConfigContextLoader.class) public class AopPerformanceIntegrationTest { @Before diff --git a/spring-mvc-java/src/test/java/com/baeldung/aop/AopPublishingIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPublishingIntegrationTest.java similarity index 85% rename from spring-mvc-java/src/test/java/com/baeldung/aop/AopPublishingIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPublishingIntegrationTest.java index 2503900e69..996b56d61e 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/aop/AopPublishingIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPublishingIntegrationTest.java @@ -1,9 +1,8 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.config.TestConfig; -import com.baeldung.dao.FooDao; -import com.baeldung.events.FooCreationEventListener; -import com.baeldung.model.Foo; +import com.baeldung.Application; +import com.baeldung.pointcutadvice.dao.FooDao; +import com.baeldung.pointcutadvice.events.FooCreationEventListener; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -22,7 +21,7 @@ import java.util.regex.Pattern; import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = {TestConfig.class}, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration(classes = {Application.class}, loader = AnnotationConfigContextLoader.class) public class AopPublishingIntegrationTest { @Before diff --git a/spring-mvc-java/src/test/java/com/baeldung/aop/AopXmlConfigPerformanceIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java similarity index 93% rename from spring-mvc-java/src/test/java/com/baeldung/aop/AopXmlConfigPerformanceIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java index 3b380315e8..5727cfd7bc 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/aop/AopXmlConfigPerformanceIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java @@ -1,6 +1,6 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.dao.FooDao; +import com.baeldung.pointcutadvice.dao.FooDao; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,7 +21,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("/com/baeldung/aop/beans.xml") +@ContextConfiguration("/pointcutadvice/beans.xml") public class AopXmlConfigPerformanceIntegrationTest { @Before diff --git a/spring-aop/src/test/resources/springAop-applicationContext.xml b/spring-aop/src/test/resources/springAop-applicationContext.xml index 4d88bd3711..fb71052567 100644 --- a/spring-aop/src/test/resources/springAop-applicationContext.xml +++ b/spring-aop/src/test/resources/springAop-applicationContext.xml @@ -6,45 +6,45 @@ xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd"> + class="com.baeldung.logger.SampleAdder" /> - - - - - + + + + + + expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" /> + expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" /> + expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" /> + expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" /> + expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" /> diff --git a/spring-boot-data/pom.xml b/spring-boot-data/pom.xml index 663ee640f3..f9e51920c2 100644 --- a/spring-boot-data/pom.xml +++ b/spring-boot-data/pom.xml @@ -97,8 +97,8 @@ org.apache.maven.plugins maven-compiler-plugin - 8 - 8 + ${source.version} + ${target.version} @@ -121,8 +121,8 @@ org.apache.maven.plugins maven-compiler-plugin - 8 - 8 + ${source.version} + ${target.version} @@ -156,8 +156,8 @@ org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + ${source.version} + ${target.version} @@ -168,6 +168,8 @@ 5.6.3 2.2.4 + 1.8 + 1.8 diff --git a/spring-boot-mvc-2/README.md b/spring-boot-mvc-2/README.md index 0ff0f1f156..81a969bf87 100644 --- a/spring-boot-mvc-2/README.md +++ b/spring-boot-mvc-2/README.md @@ -5,4 +5,5 @@ This module contains articles about Spring Web MVC in Spring Boot projects. ### Relevant Articles: - [Functional Controllers in Spring MVC](https://www.baeldung.com/spring-mvc-functional-controllers) +- [Specify an array of strings as body parameter in Swagger API](https://www.baeldung.com/array-of-strings-as-body-parameter-in-swagger-api) - More articles: [[prev -->]](/spring-boot-mvc) diff --git a/spring-boot-mvc-2/pom.xml b/spring-boot-mvc-2/pom.xml index e6538c4418..0f5a4bcd77 100644 --- a/spring-boot-mvc-2/pom.xml +++ b/spring-boot-mvc-2/pom.xml @@ -1,7 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-boot-mvc-2 spring-boot-mvc-2 @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent 2.2.0.BUILD-SNAPSHOT - + @@ -20,6 +20,36 @@ org.springframework.boot spring-boot-starter-web + + + org.springframework.boot + spring-boot-devtools + true + + + + + io.springfox + springfox-swagger2 + ${spring.fox.version} + + + + io.springfox + springfox-swagger-ui + ${spring.fox.version} + + + + io.springfox + springfox-spring-webmvc + ${spring.fox.version} + + + + org.apache.commons + commons-lang3 + @@ -28,7 +58,7 @@ org.springframework.boot spring-boot-maven-plugin - com.baeldung.springbootmvc.SpringBootMvcFnApplication + ${start-class} JAR @@ -49,6 +79,7 @@ Spring Milestones https://repo.spring.io/milestone + @@ -67,4 +98,10 @@ + + 3.0.0-SNAPSHOT + com.baeldung.swagger2boot.SpringBootSwaggerApplication + + + \ No newline at end of file diff --git a/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/SpringBootSwaggerApplication.java b/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/SpringBootSwaggerApplication.java new file mode 100644 index 0000000000..0f68f75d16 --- /dev/null +++ b/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/SpringBootSwaggerApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.swagger2boot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootSwaggerApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootSwaggerApplication.class, args); + } + +} diff --git a/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/config/Swagger2Config.java b/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/config/Swagger2Config.java new file mode 100644 index 0000000000..a0048eb505 --- /dev/null +++ b/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/config/Swagger2Config.java @@ -0,0 +1,34 @@ +package com.baeldung.swagger2boot.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; + +@Configuration +@EnableSwagger2WebMvc +public class Swagger2Config { + @Bean + public Docket api() { + return new Docket(DocumentationType.SWAGGER_2).select() + .apis(RequestHandlerSelectors.basePackage("com.baeldung.swagger2boot.controller")) + .paths(PathSelectors.regex("/.*")) + .build() + .apiInfo(apiEndPointsInfo()); + } + + private ApiInfo apiEndPointsInfo() { + return new ApiInfoBuilder().title("Swagger Array") + .description("This is a sample Swagger description for an Array server") + .license("Apache 2.0") + .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") + .version("1.0.0") + .build(); + } +} \ No newline at end of file diff --git a/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/controller/FooController.java b/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/controller/FooController.java new file mode 100644 index 0000000000..ac6d99c40c --- /dev/null +++ b/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/controller/FooController.java @@ -0,0 +1,35 @@ +package com.baeldung.swagger2boot.controller; + +import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; + +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +import com.baeldung.swagger2boot.model.Foo; + +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; + +@Controller +public class FooController { + + public FooController() { + super(); + } + + // API - write + @RequestMapping(method = RequestMethod.POST, value = "/foos") + @ResponseStatus(HttpStatus.CREATED) + @ResponseBody + @ApiImplicitParams({ @ApiImplicitParam(name = "foo", value = "List of strings", paramType = "body", dataType = "Foo") }) + public Foo create(@RequestBody final Foo foo) { + foo.setId(Long.parseLong(randomNumeric(2))); + return foo; + } + +} diff --git a/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/model/Foo.java b/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/model/Foo.java new file mode 100644 index 0000000000..e48c2016c0 --- /dev/null +++ b/spring-boot-mvc-2/src/main/java/com/baeldung/swagger2boot/model/Foo.java @@ -0,0 +1,44 @@ +package com.baeldung.swagger2boot.model; + +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel +public class Foo { + private long id; + + @ApiModelProperty(name = "name", dataType = "List", example = "[\"str1\", \"str2\", \"str3\"]") + private List name; + + public Foo() { + super(); + } + + public Foo(final long id, final List name) { + super(); + + this.id = id; + this.name = name; + } + + // + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public List getName() { + return name; + } + + public void setName(final List name) { + this.name = name; + } + +} \ No newline at end of file diff --git a/spring-boot-mvc-2/src/main/resources/swagger-description.yml b/spring-boot-mvc-2/src/main/resources/swagger-description.yml new file mode 100644 index 0000000000..b40ddc80f0 --- /dev/null +++ b/spring-boot-mvc-2/src/main/resources/swagger-description.yml @@ -0,0 +1,33 @@ +swagger: "2.0" +info: + description: "This is a sample Swagger description for an Array server" + version: "1.0.0" + title: "Swagger Array" + license: + name: "Apache 2.0" + url: "http://www.apache.org/licenses/LICENSE-2.0.html" +basePath: "/localhost:8080/" +tags: +- name: "foo-controller" + description: "Foo controller" + +paths: + /foos: + post: + tags: + - "foo-controller" + summary: "create" + description: "" + parameters: + - in: body + description: "" + required: true + name: name + schema: + type: array + items: + type: string + example: ["str1", "str2", "str3"] + responses: + default: + description: OK \ No newline at end of file diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index 1c79a423bf..06400a3502 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -47,9 +47,16 @@ org.springframework.boot spring-boot-starter-data-jpa + - com.h2database - h2 + mysql + mysql-connector-java + + + + org.hsqldb + hsqldb + runtime @@ -111,12 +118,6 @@ ${spring.fox.version} - - org.apache.tomcat.embed - tomcat-embed-jasper - provided - - org.aspectj diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootannotations/MySQLAutoconfiguration.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootannotations/MySQLAutoconfiguration.java new file mode 100644 index 0000000000..62b1329a54 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootannotations/MySQLAutoconfiguration.java @@ -0,0 +1,118 @@ +package com.baeldung.springbootannotations; + +import java.util.Arrays; +import java.util.Properties; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureOrder; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionMessage.Style; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnResource; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.Ordered; +import org.springframework.core.env.Environment; +import org.springframework.core.type.AnnotatedTypeMetadata; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.util.ClassUtils; + +@Configuration +@ConditionalOnClass(DataSource.class) +@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE) +@PropertySource("classpath:mysql.properties") +public class MySQLAutoconfiguration { + + @Autowired + private Environment env; + + @Bean + @ConditionalOnProperty(name = "usemysql", havingValue = "local") + @ConditionalOnMissingBean + public DataSource dataSource() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + + dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSource.setUrl("jdbc:mysql://localhost:3306/myDb?createDatabaseIfNotExist=true&&serverTimezone=UTC"); + dataSource.setUsername("mysqluser"); + dataSource.setPassword("mysqlpass"); + + return dataSource; + } + + @Bean(name = "dataSource") + @ConditionalOnProperty(name = "usemysql", havingValue = "custom") + @ConditionalOnMissingBean + public DataSource dataSource2() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + + dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSource.setUrl(env.getProperty("mysql.url")); + dataSource.setUsername(env.getProperty("mysql.user") != null ? env.getProperty("mysql.user") : ""); + dataSource.setPassword(env.getProperty("mysql.pass") != null ? env.getProperty("mysql.pass") : ""); + + return dataSource; + } + + @Bean + @ConditionalOnBean(name = "dataSource") + @ConditionalOnMissingBean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource()); + em.setPackagesToScan("com.baeldung.autoconfiguration.example"); + em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); + if (additionalProperties() != null) { + em.setJpaProperties(additionalProperties()); + } + return em; + } + + @Bean + @ConditionalOnMissingBean(type = "JpaTransactionManager") + JpaTransactionManager transactionManager(final EntityManagerFactory entityManagerFactory) { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory); + return transactionManager; + } + + @ConditionalOnResource(resources = "classpath:mysql.properties") + @Conditional(HibernateCondition.class) + final Properties additionalProperties() { + final Properties hibernateProperties = new Properties(); + + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("mysql-hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("mysql-hibernate.dialect")); + hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("mysql-hibernate.show_sql") != null ? env.getProperty("mysql-hibernate.show_sql") : "false"); + + return hibernateProperties; + } + + static class HibernateCondition extends SpringBootCondition { + + private static final String[] CLASS_NAMES = { "org.hibernate.ejb.HibernateEntityManager", "org.hibernate.jpa.HibernateEntityManager" }; + + @Override + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { + ConditionMessage.Builder message = ConditionMessage.forCondition("Hibernate"); + + return Arrays.stream(CLASS_NAMES).filter(className -> ClassUtils.isPresent(className, context.getClassLoader())).map(className -> ConditionOutcome.match(message.found("class").items(Style.NORMAL, className))).findAny() + .orElseGet(() -> ConditionOutcome.noMatch(message.didNotFind("class", "classes").items(Style.NORMAL, Arrays.asList(CLASS_NAMES)))); + } + + } +} diff --git a/spring-boot-mvc/src/main/resources/mysql.properties b/spring-boot-mvc/src/main/resources/mysql.properties new file mode 100644 index 0000000000..74f1ee1373 --- /dev/null +++ b/spring-boot-mvc/src/main/resources/mysql.properties @@ -0,0 +1,5 @@ +usemysql=local + +mysql-hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +mysql-hibernate.show_sql=true +mysql-hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/spring-boot-mvc/src/test/java/org/baeldung/SpringContextLiveTest.java b/spring-boot-mvc/src/test/java/org/baeldung/SpringContextLiveTest.java new file mode 100644 index 0000000000..069dd41b8d --- /dev/null +++ b/spring-boot-mvc/src/test/java/org/baeldung/SpringContextLiveTest.java @@ -0,0 +1,19 @@ +package org.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.web.WebAppConfiguration; + +import com.baeldung.springbootannotations.MySQLAutoconfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = MySQLAutoconfiguration.class) +@WebAppConfiguration +public class SpringContextLiveTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} \ No newline at end of file diff --git a/spring-boot-parent/spring-boot-with-starter-parent/pom.xml b/spring-boot-parent/spring-boot-with-starter-parent/pom.xml index 9ea26e49fe..ed2cb8646c 100644 --- a/spring-boot-parent/spring-boot-with-starter-parent/pom.xml +++ b/spring-boot-parent/spring-boot-with-starter-parent/pom.xml @@ -20,7 +20,7 @@ org.springframework.boot spring-boot-starter-data-jpa - 2.1.1.RELEASE + ${spring-boot.version} @@ -38,6 +38,7 @@ 1.8 + 2.1.1.RELEASE 4.11 diff --git a/spring-boot-property-exp/property-exp-custom-config/pom.xml b/spring-boot-property-exp/property-exp-custom-config/pom.xml index f9c3d6ef62..0118de7396 100644 --- a/spring-boot-property-exp/property-exp-custom-config/pom.xml +++ b/spring-boot-property-exp/property-exp-custom-config/pom.xml @@ -52,7 +52,7 @@ org.apache.maven.plugins maven-resources-plugin - 2.7 + ${apache-maven.version} @ @@ -63,7 +63,7 @@ org.codehaus.mojo exec-maven-plugin - 1.6.0 + ${exec-maven-plugin.version} com.baeldung.propertyexpansion.SpringBootPropertyExpansionApp @@ -74,6 +74,8 @@ 1.5.10.RELEASE Custom Property Value + 2.7 + 1.6.0 diff --git a/spring-boot-rest/pom.xml b/spring-boot-rest/pom.xml index 3787e21493..10dacf99e8 100644 --- a/spring-boot-rest/pom.xml +++ b/spring-boot-rest/pom.xml @@ -45,6 +45,11 @@ spring-boot-starter-data-jpa + + org.springframework.boot + spring-boot-starter-data-rest + + org.springframework.boot diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/IUserService.java b/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/IUserService.java deleted file mode 100644 index 79934114c1..0000000000 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/IUserService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.modelmapper.service; - -import com.baeldung.modelmapper.model.User; - -public interface IUserService { - - User getCurrentUser(); - -} diff --git a/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java b/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java index 2e967751ad..8887510eca 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java +++ b/spring-boot-rest/src/main/java/com/baeldung/spring/PersistenceConfig.java @@ -24,8 +24,8 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-${envTarget:h2}.properties" }) -@ComponentScan(basePackages = { "com.baeldung.persistence", "com.baeldung.modelmapper" }) -@EnableJpaRepositories(basePackages = {"com.baeldung.persistence.dao", "com.baeldung.modelmapper.repository"}) +@ComponentScan(basePackages = { "com.baeldung.persistence", "com.baeldung.springpagination" }) +@EnableJpaRepositories(basePackages = {"com.baeldung.persistence.dao", "com.baeldung.springpagination.repository"}) public class PersistenceConfig { @Autowired @@ -39,7 +39,7 @@ public class PersistenceConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "com.baeldung.persistence.model", "com.baeldung.modelmapper.model" }); + em.setPackagesToScan(new String[] { "com.baeldung.persistence.model", "com.baeldung.springpagination.model" }); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); // vendorAdapter.set diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/controller/PostRestController.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/controller/PostRestController.java similarity index 91% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/controller/PostRestController.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/controller/PostRestController.java index e2def62466..c52960b365 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/controller/PostRestController.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/controller/PostRestController.java @@ -1,9 +1,9 @@ -package com.baeldung.modelmapper.controller; +package com.baeldung.springpagination.controller; -import com.baeldung.modelmapper.dto.PostDto; -import com.baeldung.modelmapper.model.Post; -import com.baeldung.modelmapper.service.IPostService; -import com.baeldung.modelmapper.service.IUserService; +import com.baeldung.springpagination.dto.PostDto; +import com.baeldung.springpagination.model.Post; +import com.baeldung.springpagination.service.IPostService; +import com.baeldung.springpagination.service.IUserService; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/dto/PostDto.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/dto/PostDto.java similarity index 96% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/dto/PostDto.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/dto/PostDto.java index 6fe2b23888..81cec5ed8c 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/dto/PostDto.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/dto/PostDto.java @@ -1,4 +1,4 @@ -package com.baeldung.modelmapper.dto; +package com.baeldung.springpagination.dto; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/dto/UserDto.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/dto/UserDto.java similarity index 80% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/dto/UserDto.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/dto/UserDto.java index 23110ecbaa..2e4f667b30 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/dto/UserDto.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/dto/UserDto.java @@ -1,4 +1,4 @@ -package com.baeldung.modelmapper.dto; +package com.baeldung.springpagination.dto; public class UserDto { diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/Post.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Post.java similarity index 97% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/Post.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Post.java index be65ce34a2..88e9ef67bb 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/Post.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Post.java @@ -1,4 +1,4 @@ -package com.baeldung.modelmapper.model; +package com.baeldung.springpagination.model; import java.util.Date; diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/Preference.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Preference.java similarity index 92% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/Preference.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Preference.java index 0ab5b1eddf..44f8f41aff 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/Preference.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Preference.java @@ -1,4 +1,4 @@ -package com.baeldung.modelmapper.model; +package com.baeldung.springpagination.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Subject.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Subject.java new file mode 100644 index 0000000000..80598ae07d --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/Subject.java @@ -0,0 +1,37 @@ +package com.baeldung.springpagination.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Subject { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(nullable = false) + private String name; + + public Subject() { + } + + 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; + } +} \ No newline at end of file diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/User.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/User.java similarity index 94% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/User.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/model/User.java index a458b26f4a..4d33834b28 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/model/User.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/model/User.java @@ -1,4 +1,4 @@ -package com.baeldung.modelmapper.model; +package com.baeldung.springpagination.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/repository/PostRepository.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/repository/PostRepository.java similarity index 82% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/repository/PostRepository.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/repository/PostRepository.java index fc3f5733c3..acdc01df94 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/repository/PostRepository.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/repository/PostRepository.java @@ -1,4 +1,4 @@ -package com.baeldung.modelmapper.repository; +package com.baeldung.springpagination.repository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -7,8 +7,8 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; -import com.baeldung.modelmapper.model.Post; -import com.baeldung.modelmapper.model.User; +import com.baeldung.springpagination.model.Post; +import com.baeldung.springpagination.model.User; public interface PostRepository extends JpaRepository, PagingAndSortingRepository { diff --git a/spring-boot-rest/src/main/java/com/baeldung/springpagination/repository/SubjectRepository.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/repository/SubjectRepository.java new file mode 100644 index 0000000000..03c66f8d72 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/repository/SubjectRepository.java @@ -0,0 +1,16 @@ +package com.baeldung.springpagination.repository; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RestResource; + +import com.baeldung.springpagination.model.Subject; + +public interface SubjectRepository extends PagingAndSortingRepository { + + @RestResource(path = "nameContains") + public Page findByNameContaining(@Param("name") String name, Pageable p); + +} \ No newline at end of file diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/IPostService.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/IPostService.java similarity index 71% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/IPostService.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/service/IPostService.java index 0182a0da41..d1d9bee2c6 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/IPostService.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/IPostService.java @@ -1,8 +1,8 @@ -package com.baeldung.modelmapper.service; +package com.baeldung.springpagination.service; import java.util.List; -import com.baeldung.modelmapper.model.Post; +import com.baeldung.springpagination.model.Post; public interface IPostService { diff --git a/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/IUserService.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/IUserService.java new file mode 100644 index 0000000000..92dce3ed78 --- /dev/null +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/IUserService.java @@ -0,0 +1,9 @@ +package com.baeldung.springpagination.service; + +import com.baeldung.springpagination.model.User; + +public interface IUserService { + + User getCurrentUser(); + +} diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/PostService.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/PostService.java similarity index 87% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/PostService.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/service/PostService.java index 5980c30837..bb4869dd33 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/PostService.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/PostService.java @@ -1,4 +1,4 @@ -package com.baeldung.modelmapper.service; +package com.baeldung.springpagination.service; import java.util.List; @@ -8,8 +8,8 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; -import com.baeldung.modelmapper.model.Post; -import com.baeldung.modelmapper.repository.PostRepository; +import com.baeldung.springpagination.model.Post; +import com.baeldung.springpagination.repository.PostRepository; @Service public class PostService implements IPostService { diff --git a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/UserService.java b/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/UserService.java similarity index 76% rename from spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/UserService.java rename to spring-boot-rest/src/main/java/com/baeldung/springpagination/service/UserService.java index e445f836a4..0694450f44 100644 --- a/spring-boot-rest/src/main/java/com/baeldung/modelmapper/service/UserService.java +++ b/spring-boot-rest/src/main/java/com/baeldung/springpagination/service/UserService.java @@ -1,9 +1,9 @@ -package com.baeldung.modelmapper.service; +package com.baeldung.springpagination.service; import org.springframework.stereotype.Service; -import com.baeldung.modelmapper.model.Preference; -import com.baeldung.modelmapper.model.User; +import com.baeldung.springpagination.model.Preference; +import com.baeldung.springpagination.model.User; @Service public class UserService implements IUserService { diff --git a/spring-boot-rest/src/test/java/com/baeldung/modelmapper/PostDtoUnitTest.java b/spring-boot-rest/src/test/java/com/baeldung/springpagination/PostDtoUnitTest.java similarity index 89% rename from spring-boot-rest/src/test/java/com/baeldung/modelmapper/PostDtoUnitTest.java rename to spring-boot-rest/src/test/java/com/baeldung/springpagination/PostDtoUnitTest.java index 6e94cc4289..948247e166 100644 --- a/spring-boot-rest/src/test/java/com/baeldung/modelmapper/PostDtoUnitTest.java +++ b/spring-boot-rest/src/test/java/com/baeldung/springpagination/PostDtoUnitTest.java @@ -1,12 +1,12 @@ -package com.baeldung.modelmapper; +package com.baeldung.springpagination; import static org.junit.Assert.assertEquals; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import org.junit.Test; import org.modelmapper.ModelMapper; -import com.baeldung.modelmapper.dto.PostDto; -import com.baeldung.modelmapper.model.Post; +import com.baeldung.springpagination.dto.PostDto; +import com.baeldung.springpagination.model.Post; public class PostDtoUnitTest { diff --git a/spring-boot-testing/pom.xml b/spring-boot-testing/pom.xml index ebe87fdd70..5f358072d3 100644 --- a/spring-boot-testing/pom.xml +++ b/spring-boot-testing/pom.xml @@ -42,7 +42,7 @@ it.ozimov embedded-redis - 0.7.2 + ${redis.version} test @@ -131,6 +131,7 @@ 2.2.4 1.2-groovy-2.4 1.6 + 0.7.2 diff --git a/spring-caching/src/main/java/org/baeldung/caching/config/ApplicationCacheConfig.java b/spring-caching/src/main/java/com/baeldung/caching/config/ApplicationCacheConfig.java similarity index 96% rename from spring-caching/src/main/java/org/baeldung/caching/config/ApplicationCacheConfig.java rename to spring-caching/src/main/java/com/baeldung/caching/config/ApplicationCacheConfig.java index 8bf23de2cc..9a8759cbff 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/config/ApplicationCacheConfig.java +++ b/spring-caching/src/main/java/com/baeldung/caching/config/ApplicationCacheConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.config; +package com.baeldung.caching.config; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; diff --git a/spring-caching/src/main/java/org/baeldung/caching/config/CachingConfig.java b/spring-caching/src/main/java/com/baeldung/caching/config/CachingConfig.java similarity index 90% rename from spring-caching/src/main/java/org/baeldung/caching/config/CachingConfig.java rename to spring-caching/src/main/java/com/baeldung/caching/config/CachingConfig.java index c995bca68d..d245b05502 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/config/CachingConfig.java +++ b/spring-caching/src/main/java/com/baeldung/caching/config/CachingConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.config; +package com.baeldung.caching.config; import java.util.Arrays; @@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration; @Configuration @EnableCaching -@ComponentScan("org.baeldung.caching.example") +@ComponentScan("com.baeldung.caching.example") public class CachingConfig { @Bean diff --git a/spring-caching/src/main/java/org/baeldung/caching/config/CustomKeyGenerator.java b/spring-caching/src/main/java/com/baeldung/caching/config/CustomKeyGenerator.java similarity index 92% rename from spring-caching/src/main/java/org/baeldung/caching/config/CustomKeyGenerator.java rename to spring-caching/src/main/java/com/baeldung/caching/config/CustomKeyGenerator.java index c1da9493e0..173f44bfbc 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/config/CustomKeyGenerator.java +++ b/spring-caching/src/main/java/com/baeldung/caching/config/CustomKeyGenerator.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.config; +package com.baeldung.caching.config; import org.springframework.cache.interceptor.KeyGenerator; import org.springframework.util.StringUtils; diff --git a/spring-caching/src/main/java/org/baeldung/caching/eviction/controllers/CachingController.java b/spring-caching/src/main/java/com/baeldung/caching/eviction/controllers/CachingController.java similarity index 78% rename from spring-caching/src/main/java/org/baeldung/caching/eviction/controllers/CachingController.java rename to spring-caching/src/main/java/com/baeldung/caching/eviction/controllers/CachingController.java index aaaf8a5918..2980e32763 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/eviction/controllers/CachingController.java +++ b/spring-caching/src/main/java/com/baeldung/caching/eviction/controllers/CachingController.java @@ -1,6 +1,6 @@ -package org.baeldung.caching.eviction.controllers; +package com.baeldung.caching.eviction.controllers; -import org.baeldung.caching.eviction.service.CachingService; +import com.baeldung.caching.eviction.service.CachingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/spring-caching/src/main/java/org/baeldung/caching/eviction/service/CachingService.java b/spring-caching/src/main/java/com/baeldung/caching/eviction/service/CachingService.java similarity index 97% rename from spring-caching/src/main/java/org/baeldung/caching/eviction/service/CachingService.java rename to spring-caching/src/main/java/com/baeldung/caching/eviction/service/CachingService.java index a0dd30c329..d44da332d4 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/eviction/service/CachingService.java +++ b/spring-caching/src/main/java/com/baeldung/caching/eviction/service/CachingService.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.eviction.service; +package com.baeldung.caching.eviction.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.CacheManager; diff --git a/spring-caching/src/main/java/org/baeldung/caching/example/AbstractService.java b/spring-caching/src/main/java/com/baeldung/caching/example/AbstractService.java similarity index 98% rename from spring-caching/src/main/java/org/baeldung/caching/example/AbstractService.java rename to spring-caching/src/main/java/com/baeldung/caching/example/AbstractService.java index 02b8c3c159..5893ffdfcf 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/example/AbstractService.java +++ b/spring-caching/src/main/java/com/baeldung/caching/example/AbstractService.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.example; +package com.baeldung.caching.example; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CachePut; diff --git a/spring-caching/src/main/java/org/baeldung/caching/example/BookService.java b/spring-caching/src/main/java/com/baeldung/caching/example/BookService.java similarity index 87% rename from spring-caching/src/main/java/org/baeldung/caching/example/BookService.java rename to spring-caching/src/main/java/com/baeldung/caching/example/BookService.java index 9f3aaf89cf..2b335ac10d 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/example/BookService.java +++ b/spring-caching/src/main/java/com/baeldung/caching/example/BookService.java @@ -1,6 +1,6 @@ -package org.baeldung.caching.example; +package com.baeldung.caching.example; -import org.baeldung.caching.model.Book; +import com.baeldung.caching.model.Book; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Component; diff --git a/spring-caching/src/main/java/org/baeldung/caching/example/Customer.java b/spring-caching/src/main/java/com/baeldung/caching/example/Customer.java similarity index 95% rename from spring-caching/src/main/java/org/baeldung/caching/example/Customer.java rename to spring-caching/src/main/java/com/baeldung/caching/example/Customer.java index a57f08e35b..52de4bc1cc 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/example/Customer.java +++ b/spring-caching/src/main/java/com/baeldung/caching/example/Customer.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.example; +package com.baeldung.caching.example; public class Customer { diff --git a/spring-caching/src/main/java/org/baeldung/caching/example/CustomerDataService.java b/spring-caching/src/main/java/com/baeldung/caching/example/CustomerDataService.java similarity index 98% rename from spring-caching/src/main/java/org/baeldung/caching/example/CustomerDataService.java rename to spring-caching/src/main/java/com/baeldung/caching/example/CustomerDataService.java index 1c595057a8..005a85fcb4 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/example/CustomerDataService.java +++ b/spring-caching/src/main/java/com/baeldung/caching/example/CustomerDataService.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.example; +package com.baeldung.caching.example; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; diff --git a/spring-caching/src/main/java/org/baeldung/caching/example/CustomerServiceWithParent.java b/spring-caching/src/main/java/com/baeldung/caching/example/CustomerServiceWithParent.java similarity index 86% rename from spring-caching/src/main/java/org/baeldung/caching/example/CustomerServiceWithParent.java rename to spring-caching/src/main/java/com/baeldung/caching/example/CustomerServiceWithParent.java index a5ded7daf9..be201413b4 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/example/CustomerServiceWithParent.java +++ b/spring-caching/src/main/java/com/baeldung/caching/example/CustomerServiceWithParent.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.example; +package com.baeldung.caching.example; import org.springframework.cache.annotation.CacheConfig; import org.springframework.stereotype.Component; diff --git a/spring-caching/src/main/java/org/baeldung/caching/model/Book.java b/spring-caching/src/main/java/com/baeldung/caching/model/Book.java similarity index 94% rename from spring-caching/src/main/java/org/baeldung/caching/model/Book.java rename to spring-caching/src/main/java/com/baeldung/caching/model/Book.java index c110c79db0..fd8abf1816 100644 --- a/spring-caching/src/main/java/org/baeldung/caching/model/Book.java +++ b/spring-caching/src/main/java/com/baeldung/caching/model/Book.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.model; +package com.baeldung.caching.model; public class Book { diff --git a/spring-caching/src/main/java/org/baeldung/ehcache/calculator/SquaredCalculator.java b/spring-caching/src/main/java/com/baeldung/ehcache/calculator/SquaredCalculator.java similarity index 86% rename from spring-caching/src/main/java/org/baeldung/ehcache/calculator/SquaredCalculator.java rename to spring-caching/src/main/java/com/baeldung/ehcache/calculator/SquaredCalculator.java index 25957539df..caf1df2a1b 100644 --- a/spring-caching/src/main/java/org/baeldung/ehcache/calculator/SquaredCalculator.java +++ b/spring-caching/src/main/java/com/baeldung/ehcache/calculator/SquaredCalculator.java @@ -1,6 +1,6 @@ -package org.baeldung.ehcache.calculator; +package com.baeldung.ehcache.calculator; -import org.baeldung.ehcache.config.CacheHelper; +import com.baeldung.ehcache.config.CacheHelper; public class SquaredCalculator { private CacheHelper cache; diff --git a/spring-caching/src/main/java/org/baeldung/ehcache/config/CacheHelper.java b/spring-caching/src/main/java/com/baeldung/ehcache/config/CacheHelper.java similarity index 96% rename from spring-caching/src/main/java/org/baeldung/ehcache/config/CacheHelper.java rename to spring-caching/src/main/java/com/baeldung/ehcache/config/CacheHelper.java index 7f59ad8cfb..d138f6e84c 100644 --- a/spring-caching/src/main/java/org/baeldung/ehcache/config/CacheHelper.java +++ b/spring-caching/src/main/java/com/baeldung/ehcache/config/CacheHelper.java @@ -1,4 +1,4 @@ -package org.baeldung.ehcache.config; +package com.baeldung.ehcache.config; import org.ehcache.Cache; import org.ehcache.CacheManager; diff --git a/spring-caching/src/main/resources/config.xml b/spring-caching/src/main/resources/config.xml index 23458539b0..666e91e173 100644 --- a/spring-caching/src/main/resources/config.xml +++ b/spring-caching/src/main/resources/config.xml @@ -13,7 +13,7 @@ - + @@ -34,7 +34,7 @@ - + diff --git a/spring-caching/src/test/java/org/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java b/spring-caching/src/test/java/com/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java similarity index 96% rename from spring-caching/src/test/java/org/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java rename to spring-caching/src/test/java/com/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java index 28b0d26bed..7363022268 100644 --- a/spring-caching/src/test/java/org/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java +++ b/spring-caching/src/test/java/com/baeldung/caching/test/CacheEvictAnnotationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.test; +package com.baeldung.caching.test; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; @@ -7,7 +7,7 @@ import static org.junit.Assert.assertThat; import java.util.ArrayList; import java.util.List; -import org.baeldung.caching.eviction.service.CachingService; +import com.baeldung.caching.eviction.service.CachingService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-caching/src/test/java/org/baeldung/caching/test/CacheManagerEvictIntegrationTest.java b/spring-caching/src/test/java/com/baeldung/caching/test/CacheManagerEvictIntegrationTest.java similarity index 97% rename from spring-caching/src/test/java/org/baeldung/caching/test/CacheManagerEvictIntegrationTest.java rename to spring-caching/src/test/java/com/baeldung/caching/test/CacheManagerEvictIntegrationTest.java index ffcc88febc..fa3168fc62 100644 --- a/spring-caching/src/test/java/org/baeldung/caching/test/CacheManagerEvictIntegrationTest.java +++ b/spring-caching/src/test/java/com/baeldung/caching/test/CacheManagerEvictIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.caching.test; +package com.baeldung.caching.test; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; @@ -7,7 +7,7 @@ import static org.junit.Assert.assertThat; import java.util.ArrayList; import java.util.List; -import org.baeldung.caching.eviction.service.CachingService; +import com.baeldung.caching.eviction.service.CachingService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-caching/src/test/java/org/baeldung/caching/test/SpringCachingIntegrationTest.java b/spring-caching/src/test/java/com/baeldung/caching/test/SpringCachingIntegrationTest.java similarity index 88% rename from spring-caching/src/test/java/org/baeldung/caching/test/SpringCachingIntegrationTest.java rename to spring-caching/src/test/java/com/baeldung/caching/test/SpringCachingIntegrationTest.java index 8c4ebaa7ec..080044f359 100644 --- a/spring-caching/src/test/java/org/baeldung/caching/test/SpringCachingIntegrationTest.java +++ b/spring-caching/src/test/java/com/baeldung/caching/test/SpringCachingIntegrationTest.java @@ -1,9 +1,9 @@ -package org.baeldung.caching.test; +package com.baeldung.caching.test; -import org.baeldung.caching.config.CachingConfig; -import org.baeldung.caching.example.Customer; -import org.baeldung.caching.example.CustomerDataService; -import org.baeldung.caching.example.CustomerServiceWithParent; +import com.baeldung.caching.config.CachingConfig; +import com.baeldung.caching.example.Customer; +import com.baeldung.caching.example.CustomerDataService; +import com.baeldung.caching.example.CustomerServiceWithParent; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-caching/src/test/java/org/baeldung/ehcache/SquareCalculatorUnitTest.java b/spring-caching/src/test/java/com/baeldung/ehcache/SquareCalculatorUnitTest.java similarity index 90% rename from spring-caching/src/test/java/org/baeldung/ehcache/SquareCalculatorUnitTest.java rename to spring-caching/src/test/java/com/baeldung/ehcache/SquareCalculatorUnitTest.java index 0e6ac6fd8e..37df749bab 100644 --- a/spring-caching/src/test/java/org/baeldung/ehcache/SquareCalculatorUnitTest.java +++ b/spring-caching/src/test/java/com/baeldung/ehcache/SquareCalculatorUnitTest.java @@ -1,7 +1,7 @@ -package org.baeldung.ehcache; +package com.baeldung.ehcache; -import org.baeldung.ehcache.calculator.SquaredCalculator; -import org.baeldung.ehcache.config.CacheHelper; +import com.baeldung.ehcache.calculator.SquaredCalculator; +import com.baeldung.ehcache.config.CacheHelper; import org.junit.Before; import org.junit.Test; diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml index c1fc458a24..abf9363288 100644 --- a/spring-cloud/spring-cloud-aws/pom.xml +++ b/spring-cloud/spring-cloud-aws/pom.xml @@ -50,7 +50,7 @@ org.springframework.cloud spring-cloud-aws - 2.0.1.RELEASE + ${spring-cloud} pom import @@ -60,6 +60,7 @@ com.baeldung.spring.cloud.aws.SpringCloudAwsApplication Dalston.SR4 + 2.0.1.RELEASE diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml index c41ad687ed..e909dbc253 100644 --- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml @@ -36,7 +36,7 @@ org.springframework.cloud spring-cloud-contract-maven-plugin - 2.1.1.RELEASE + ${spring-cloud.version} true com.baeldung.spring.cloud.springcloudcontractproducer.BaseTestClass @@ -45,4 +45,8 @@ + + + 2.1.1.RELEASE + diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml index 2e1b747c2e..03510d0504 100644 --- a/spring-cloud/spring-cloud-functions/pom.xml +++ b/spring-cloud/spring-cloud-functions/pom.xml @@ -65,7 +65,7 @@ org.springframework.boot.experimental spring-boot-thin-layout - 1.0.10.RELEASE + ${spring-boot-thin.version} @@ -88,6 +88,7 @@ 2.0.2 1.1.0 2.0.4.RELEASE + 1.0.10.RELEASE diff --git a/spring-cloud/spring-cloud-gateway/README.md b/spring-cloud/spring-cloud-gateway/README.md index e87bc547e1..d3323947e8 100644 --- a/spring-cloud/spring-cloud-gateway/README.md +++ b/spring-cloud/spring-cloud-gateway/README.md @@ -4,3 +4,4 @@ This module contains articles about Spring Cloud Gateway ### Relevant Articles: - [Exploring the new Spring Cloud Gateway](http://www.baeldung.com/spring-cloud-gateway) +- [Writing Custom Spring Cloud Gateway Filters](https://www.baeldung.com/spring-cloud-custom-gateway-filters) diff --git a/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/pom.xml index 93734a19a7..5459b77682 100644 --- a/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-guide/travel-agency-service/pom.xml @@ -24,7 +24,7 @@ ch.qos.logback logback-classic - 1.2.3 + ${logback.version} @@ -71,6 +71,7 @@ Finchley.SR2 + 1.2.3 \ No newline at end of file diff --git a/spring-core-2/pom.xml b/spring-core-2/pom.xml index f89a093f30..78b94880d0 100644 --- a/spring-core-2/pom.xml +++ b/spring-core-2/pom.xml @@ -174,7 +174,7 @@ org.apache.maven.plugins maven-war-plugin - 3.2.2 + ${maven.version} false @@ -201,7 +201,7 @@ - org.baeldung.sample.App + com.baeldung.sample.App 5.0.6.RELEASE 1.3.2 @@ -214,6 +214,7 @@ 3.6.1 2.1.0 3.22.0-GA + 3.2.2 diff --git a/spring-core-2/src/main/java/org/baeldung/autowire/sample/App.java b/spring-core-2/src/main/java/com/baeldung/autowire/sample/App.java similarity index 90% rename from spring-core-2/src/main/java/org/baeldung/autowire/sample/App.java rename to spring-core-2/src/main/java/com/baeldung/autowire/sample/App.java index ed0c90d5b1..18ff11a49c 100644 --- a/spring-core-2/src/main/java/org/baeldung/autowire/sample/App.java +++ b/spring-core-2/src/main/java/com/baeldung/autowire/sample/App.java @@ -1,4 +1,4 @@ -package org.baeldung.autowire.sample; +package com.baeldung.autowire.sample; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/spring-core-2/src/main/java/org/baeldung/autowire/sample/AppConfig.java b/spring-core-2/src/main/java/com/baeldung/autowire/sample/AppConfig.java similarity index 66% rename from spring-core-2/src/main/java/org/baeldung/autowire/sample/AppConfig.java rename to spring-core-2/src/main/java/com/baeldung/autowire/sample/AppConfig.java index 117dfe1027..f948e2bf8e 100644 --- a/spring-core-2/src/main/java/org/baeldung/autowire/sample/AppConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/autowire/sample/AppConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.autowire.sample; +package com.baeldung.autowire.sample; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.autowire.sample") +@ComponentScan("com.baeldung.autowire.sample") public class AppConfig { } diff --git a/spring-core-2/src/main/java/org/baeldung/autowire/sample/BarFormatter.java b/spring-core-2/src/main/java/com/baeldung/autowire/sample/BarFormatter.java similarity index 83% rename from spring-core-2/src/main/java/org/baeldung/autowire/sample/BarFormatter.java rename to spring-core-2/src/main/java/com/baeldung/autowire/sample/BarFormatter.java index f7e730fdc6..e67a376d25 100644 --- a/spring-core-2/src/main/java/org/baeldung/autowire/sample/BarFormatter.java +++ b/spring-core-2/src/main/java/com/baeldung/autowire/sample/BarFormatter.java @@ -1,4 +1,4 @@ -package org.baeldung.autowire.sample; +package com.baeldung.autowire.sample; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/com/baeldung/autowire/sample/FooDAO.java b/spring-core-2/src/main/java/com/baeldung/autowire/sample/FooDAO.java new file mode 100644 index 0000000000..aec26202ab --- /dev/null +++ b/spring-core-2/src/main/java/com/baeldung/autowire/sample/FooDAO.java @@ -0,0 +1,5 @@ +package com.baeldung.autowire.sample; + +public class FooDAO { + +} diff --git a/spring-core-2/src/main/java/org/baeldung/autowire/sample/FooFormatter.java b/spring-core-2/src/main/java/com/baeldung/autowire/sample/FooFormatter.java similarity index 83% rename from spring-core-2/src/main/java/org/baeldung/autowire/sample/FooFormatter.java rename to spring-core-2/src/main/java/com/baeldung/autowire/sample/FooFormatter.java index 5fdacbadd4..57f93a53d7 100644 --- a/spring-core-2/src/main/java/org/baeldung/autowire/sample/FooFormatter.java +++ b/spring-core-2/src/main/java/com/baeldung/autowire/sample/FooFormatter.java @@ -1,4 +1,4 @@ -package org.baeldung.autowire.sample; +package com.baeldung.autowire.sample; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/com/baeldung/autowire/sample/FooService.java b/spring-core-2/src/main/java/com/baeldung/autowire/sample/FooService.java new file mode 100644 index 0000000000..8a073279bc --- /dev/null +++ b/spring-core-2/src/main/java/com/baeldung/autowire/sample/FooService.java @@ -0,0 +1,31 @@ +package com.baeldung.autowire.sample; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * This class presents a field, a constructor, and a setter injection type. + * Usually, we'd stick with a single approach for a given property. This is just an educational code. + */ +@Component +public class FooService { + + @Autowired + @FormatterType("Foo") + private Formatter formatter; + + @Autowired + public FooService(@FormatterType("Foo") Formatter formatter) { + this.formatter = formatter; + } + + @Autowired + public void setFormatter(@FormatterType("Foo") Formatter formatter) { + this.formatter = formatter; + } + + public String doStuff() { + return formatter.format(); + } + +} diff --git a/spring-core-2/src/main/java/org/baeldung/autowire/sample/Formatter.java b/spring-core-2/src/main/java/com/baeldung/autowire/sample/Formatter.java similarity index 59% rename from spring-core-2/src/main/java/org/baeldung/autowire/sample/Formatter.java rename to spring-core-2/src/main/java/com/baeldung/autowire/sample/Formatter.java index 05cd5f1c26..59d718050a 100644 --- a/spring-core-2/src/main/java/org/baeldung/autowire/sample/Formatter.java +++ b/spring-core-2/src/main/java/com/baeldung/autowire/sample/Formatter.java @@ -1,4 +1,4 @@ -package org.baeldung.autowire.sample; +package com.baeldung.autowire.sample; public interface Formatter { diff --git a/spring-core-2/src/main/java/org/baeldung/autowire/sample/FormatterType.java b/spring-core-2/src/main/java/com/baeldung/autowire/sample/FormatterType.java similarity index 91% rename from spring-core-2/src/main/java/org/baeldung/autowire/sample/FormatterType.java rename to spring-core-2/src/main/java/com/baeldung/autowire/sample/FormatterType.java index ea1eec055a..f2961745b5 100644 --- a/spring-core-2/src/main/java/org/baeldung/autowire/sample/FormatterType.java +++ b/spring-core-2/src/main/java/com/baeldung/autowire/sample/FormatterType.java @@ -1,4 +1,4 @@ -package org.baeldung.autowire.sample; +package com.baeldung.autowire.sample; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-core-2/src/main/java/org/baeldung/bean/config/ConstructorBasedShipConfig.java b/spring-core-2/src/main/java/com/baeldung/bean/config/ConstructorBasedShipConfig.java similarity index 73% rename from spring-core-2/src/main/java/org/baeldung/bean/config/ConstructorBasedShipConfig.java rename to spring-core-2/src/main/java/com/baeldung/bean/config/ConstructorBasedShipConfig.java index f0e6e8868e..f9f23ee304 100644 --- a/spring-core-2/src/main/java/org/baeldung/bean/config/ConstructorBasedShipConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/bean/config/ConstructorBasedShipConfig.java @@ -1,7 +1,7 @@ -package org.baeldung.bean.config; +package com.baeldung.bean.config; -import org.baeldung.bean.injection.Helm; -import org.baeldung.bean.injection.Ship; +import com.baeldung.bean.injection.Helm; +import com.baeldung.bean.injection.Ship; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-core-2/src/main/java/org/baeldung/bean/config/SetterBasedShipConfig.java b/spring-core-2/src/main/java/com/baeldung/bean/config/SetterBasedShipConfig.java similarity index 66% rename from spring-core-2/src/main/java/org/baeldung/bean/config/SetterBasedShipConfig.java rename to spring-core-2/src/main/java/com/baeldung/bean/config/SetterBasedShipConfig.java index 7cd6de1c74..cea6385fd9 100644 --- a/spring-core-2/src/main/java/org/baeldung/bean/config/SetterBasedShipConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/bean/config/SetterBasedShipConfig.java @@ -1,7 +1,7 @@ -package org.baeldung.bean.config; +package com.baeldung.bean.config; -import org.baeldung.bean.injection.Helm; -import org.baeldung.bean.injection.Ship; +import com.baeldung.bean.injection.Helm; +import com.baeldung.bean.injection.Ship; import org.springframework.context.annotation.Bean; public class SetterBasedShipConfig { diff --git a/spring-core-2/src/main/java/org/baeldung/bean/injection/Helm.java b/spring-core-2/src/main/java/com/baeldung/bean/injection/Helm.java similarity index 86% rename from spring-core-2/src/main/java/org/baeldung/bean/injection/Helm.java rename to spring-core-2/src/main/java/com/baeldung/bean/injection/Helm.java index 86f71ce795..e1477bd0d9 100644 --- a/spring-core-2/src/main/java/org/baeldung/bean/injection/Helm.java +++ b/spring-core-2/src/main/java/com/baeldung/bean/injection/Helm.java @@ -1,4 +1,4 @@ -package org.baeldung.bean.injection; +package com.baeldung.bean.injection; public class Helm { diff --git a/spring-core-2/src/main/java/org/baeldung/bean/injection/Ship.java b/spring-core-2/src/main/java/com/baeldung/bean/injection/Ship.java similarity index 91% rename from spring-core-2/src/main/java/org/baeldung/bean/injection/Ship.java rename to spring-core-2/src/main/java/com/baeldung/bean/injection/Ship.java index 69d9fa1276..f69a3a51ca 100644 --- a/spring-core-2/src/main/java/org/baeldung/bean/injection/Ship.java +++ b/spring-core-2/src/main/java/com/baeldung/bean/injection/Ship.java @@ -1,4 +1,4 @@ -package org.baeldung.bean.injection; +package com.baeldung.bean.injection; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-core-2/src/main/java/org/baeldung/customannotation/CustomAnnotationConfiguration.java b/spring-core-2/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java similarity index 68% rename from spring-core-2/src/main/java/org/baeldung/customannotation/CustomAnnotationConfiguration.java rename to spring-core-2/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java index b8f312d778..2e42a3f744 100644 --- a/spring-core-2/src/main/java/org/baeldung/customannotation/CustomAnnotationConfiguration.java +++ b/spring-core-2/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java @@ -1,9 +1,9 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.customannotation") +@ComponentScan("com.baeldung.customannotation") public class CustomAnnotationConfiguration { } diff --git a/spring-core-2/src/main/java/org/baeldung/customannotation/DataAccess.java b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccess.java similarity index 90% rename from spring-core-2/src/main/java/org/baeldung/customannotation/DataAccess.java rename to spring-core-2/src/main/java/com/baeldung/customannotation/DataAccess.java index 9a8a493a6d..4160bad16d 100644 --- a/spring-core-2/src/main/java/org/baeldung/customannotation/DataAccess.java +++ b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccess.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-core-2/src/main/java/org/baeldung/customannotation/DataAccessAnnotationProcessor.java b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java similarity index 97% rename from spring-core-2/src/main/java/org/baeldung/customannotation/DataAccessAnnotationProcessor.java rename to spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java index c792073745..27008176a8 100644 --- a/spring-core-2/src/main/java/org/baeldung/customannotation/DataAccessAnnotationProcessor.java +++ b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-core-2/src/main/java/org/baeldung/customannotation/DataAccessFieldCallback.java b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java similarity index 99% rename from spring-core-2/src/main/java/org/baeldung/customannotation/DataAccessFieldCallback.java rename to spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java index 8cb62affc4..07b5298ea9 100644 --- a/spring-core-2/src/main/java/org/baeldung/customannotation/DataAccessFieldCallback.java +++ b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import java.lang.reflect.Constructor; import java.lang.reflect.Field; diff --git a/spring-core-2/src/main/java/org/baeldung/customannotation/GenericDAO.java b/spring-core-2/src/main/java/com/baeldung/customannotation/GenericDAO.java similarity index 94% rename from spring-core-2/src/main/java/org/baeldung/customannotation/GenericDAO.java rename to spring-core-2/src/main/java/com/baeldung/customannotation/GenericDAO.java index 1916b7de6e..0edd33b049 100644 --- a/spring-core-2/src/main/java/org/baeldung/customannotation/GenericDAO.java +++ b/spring-core-2/src/main/java/com/baeldung/customannotation/GenericDAO.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import java.util.Collections; import java.util.List; diff --git a/spring-core-2/src/main/java/org/baeldung/customscope/TenantBean.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBean.java similarity index 89% rename from spring-core-2/src/main/java/org/baeldung/customscope/TenantBean.java rename to spring-core-2/src/main/java/com/baeldung/customscope/TenantBean.java index 874fcda9f2..e892ae9d9b 100644 --- a/spring-core-2/src/main/java/org/baeldung/customscope/TenantBean.java +++ b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBean.java @@ -1,4 +1,4 @@ -package org.baeldung.customscope; +package com.baeldung.customscope; public class TenantBean { diff --git a/spring-core-2/src/main/java/org/baeldung/customscope/TenantBeanFactoryPostProcessor.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java similarity index 93% rename from spring-core-2/src/main/java/org/baeldung/customscope/TenantBeanFactoryPostProcessor.java rename to spring-core-2/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java index 2757399fa6..84ed0b46d7 100644 --- a/spring-core-2/src/main/java/org/baeldung/customscope/TenantBeanFactoryPostProcessor.java +++ b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java @@ -1,4 +1,4 @@ -package org.baeldung.customscope; +package com.baeldung.customscope; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; diff --git a/spring-core-2/src/main/java/org/baeldung/customscope/TenantBeansConfig.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeansConfig.java similarity index 93% rename from spring-core-2/src/main/java/org/baeldung/customscope/TenantBeansConfig.java rename to spring-core-2/src/main/java/com/baeldung/customscope/TenantBeansConfig.java index be3ac001fb..c219000fe6 100644 --- a/spring-core-2/src/main/java/org/baeldung/customscope/TenantBeansConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeansConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.customscope; +package com.baeldung.customscope; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-core-2/src/main/java/org/baeldung/customscope/TenantScope.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantScope.java similarity index 97% rename from spring-core-2/src/main/java/org/baeldung/customscope/TenantScope.java rename to spring-core-2/src/main/java/com/baeldung/customscope/TenantScope.java index 144d092be6..f3077bc4c2 100644 --- a/spring-core-2/src/main/java/org/baeldung/customscope/TenantScope.java +++ b/spring-core-2/src/main/java/com/baeldung/customscope/TenantScope.java @@ -1,4 +1,4 @@ -package org.baeldung.customscope; +package com.baeldung.customscope; import java.util.Collections; import java.util.HashMap; diff --git a/spring-core-2/src/main/java/org/baeldung/customscope/TenantScopeConfig.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantScopeConfig.java similarity index 91% rename from spring-core-2/src/main/java/org/baeldung/customscope/TenantScopeConfig.java rename to spring-core-2/src/main/java/com/baeldung/customscope/TenantScopeConfig.java index d1159b0f60..1829e1e8c4 100644 --- a/spring-core-2/src/main/java/org/baeldung/customscope/TenantScopeConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/customscope/TenantScopeConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.customscope; +package com.baeldung.customscope; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.context.annotation.Bean; diff --git a/spring-core-2/src/main/java/org/baeldung/nullibility/Person.java b/spring-core-2/src/main/java/com/baeldung/nullibility/Person.java similarity index 95% rename from spring-core-2/src/main/java/org/baeldung/nullibility/Person.java rename to spring-core-2/src/main/java/com/baeldung/nullibility/Person.java index 08c77c9e9c..8fb60fb7a7 100644 --- a/spring-core-2/src/main/java/org/baeldung/nullibility/Person.java +++ b/spring-core-2/src/main/java/com/baeldung/nullibility/Person.java @@ -1,4 +1,4 @@ -package org.baeldung.nullibility; +package com.baeldung.nullibility; import org.springframework.lang.NonNull; import org.springframework.lang.Nullable; diff --git a/spring-core-2/src/main/java/org/baeldung/nullibility/package-info.java b/spring-core-2/src/main/java/com/baeldung/nullibility/package-info.java similarity index 77% rename from spring-core-2/src/main/java/org/baeldung/nullibility/package-info.java rename to spring-core-2/src/main/java/com/baeldung/nullibility/package-info.java index 446f2e316e..11a3f7c7aa 100644 --- a/spring-core-2/src/main/java/org/baeldung/nullibility/package-info.java +++ b/spring-core-2/src/main/java/com/baeldung/nullibility/package-info.java @@ -1,6 +1,6 @@ @NonNullApi @NonNullFields -package org.baeldung.nullibility; +package com.baeldung.nullibility; import org.springframework.lang.NonNullApi; import org.springframework.lang.NonNullFields; \ No newline at end of file diff --git a/spring-core-2/src/main/java/org/baeldung/order/Average.java b/spring-core-2/src/main/java/com/baeldung/order/Average.java similarity index 91% rename from spring-core-2/src/main/java/org/baeldung/order/Average.java rename to spring-core-2/src/main/java/com/baeldung/order/Average.java index 3deffaf1ae..0f84f1b436 100644 --- a/spring-core-2/src/main/java/org/baeldung/order/Average.java +++ b/spring-core-2/src/main/java/com/baeldung/order/Average.java @@ -1,4 +1,4 @@ -package org.baeldung.order; +package com.baeldung.order; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; diff --git a/spring-core-2/src/main/java/org/baeldung/order/Excellent.java b/spring-core-2/src/main/java/com/baeldung/order/Excellent.java similarity index 89% rename from spring-core-2/src/main/java/org/baeldung/order/Excellent.java rename to spring-core-2/src/main/java/com/baeldung/order/Excellent.java index 96fea4ac9b..5fd1d18796 100644 --- a/spring-core-2/src/main/java/org/baeldung/order/Excellent.java +++ b/spring-core-2/src/main/java/com/baeldung/order/Excellent.java @@ -1,4 +1,4 @@ -package org.baeldung.order; +package com.baeldung.order; import org.springframework.stereotype.Component; import org.springframework.core.annotation.Order; diff --git a/spring-core-2/src/main/java/org/baeldung/order/Good.java b/spring-core-2/src/main/java/com/baeldung/order/Good.java similarity index 89% rename from spring-core-2/src/main/java/org/baeldung/order/Good.java rename to spring-core-2/src/main/java/com/baeldung/order/Good.java index 4b3e268504..a176904c64 100644 --- a/spring-core-2/src/main/java/org/baeldung/order/Good.java +++ b/spring-core-2/src/main/java/com/baeldung/order/Good.java @@ -1,4 +1,4 @@ -package org.baeldung.order; +package com.baeldung.order; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/order/Rating.java b/spring-core-2/src/main/java/com/baeldung/order/Rating.java similarity index 66% rename from spring-core-2/src/main/java/org/baeldung/order/Rating.java rename to spring-core-2/src/main/java/com/baeldung/order/Rating.java index 10f2780522..9125019b5c 100644 --- a/spring-core-2/src/main/java/org/baeldung/order/Rating.java +++ b/spring-core-2/src/main/java/com/baeldung/order/Rating.java @@ -1,4 +1,4 @@ -package org.baeldung.order; +package com.baeldung.order; public interface Rating { diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/Setup.java b/spring-core-2/src/main/java/com/baeldung/persistence/Setup.java similarity index 94% rename from spring-exceptions/src/main/java/org/baeldung/persistence/Setup.java rename to spring-core-2/src/main/java/com/baeldung/persistence/Setup.java index 5cba4e70fb..251ea4654c 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/Setup.java +++ b/spring-core-2/src/main/java/com/baeldung/persistence/Setup.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence; +package com.baeldung.persistence; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; diff --git a/spring-core-2/src/main/java/org/baeldung/primary/Config.java b/spring-core-2/src/main/java/com/baeldung/primary/Config.java similarity index 84% rename from spring-core-2/src/main/java/org/baeldung/primary/Config.java rename to spring-core-2/src/main/java/com/baeldung/primary/Config.java index bdcfe019e6..eec9fb2ceb 100644 --- a/spring-core-2/src/main/java/org/baeldung/primary/Config.java +++ b/spring-core-2/src/main/java/com/baeldung/primary/Config.java @@ -1,4 +1,4 @@ -package org.baeldung.primary; +package com.baeldung.primary; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -6,7 +6,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @Configuration -@ComponentScan(basePackages="org.baeldung.primary") +@ComponentScan(basePackages="com.baeldung.primary") public class Config { @Bean diff --git a/spring-core-2/src/main/java/org/baeldung/primary/DepartmentManager.java b/spring-core-2/src/main/java/com/baeldung/primary/DepartmentManager.java similarity index 87% rename from spring-core-2/src/main/java/org/baeldung/primary/DepartmentManager.java rename to spring-core-2/src/main/java/com/baeldung/primary/DepartmentManager.java index 2603951b4e..161b39337b 100644 --- a/spring-core-2/src/main/java/org/baeldung/primary/DepartmentManager.java +++ b/spring-core-2/src/main/java/com/baeldung/primary/DepartmentManager.java @@ -1,4 +1,4 @@ -package org.baeldung.primary; +package com.baeldung.primary; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/primary/Employee.java b/spring-core-2/src/main/java/com/baeldung/primary/Employee.java similarity index 91% rename from spring-core-2/src/main/java/org/baeldung/primary/Employee.java rename to spring-core-2/src/main/java/com/baeldung/primary/Employee.java index 9168387613..48c5502921 100644 --- a/spring-core-2/src/main/java/org/baeldung/primary/Employee.java +++ b/spring-core-2/src/main/java/com/baeldung/primary/Employee.java @@ -1,4 +1,4 @@ -package org.baeldung.primary; +package com.baeldung.primary; /** * Created by Gebruiker on 7/17/2018. diff --git a/spring-core-2/src/main/java/org/baeldung/primary/GeneralManager.java b/spring-core-2/src/main/java/com/baeldung/primary/GeneralManager.java similarity index 89% rename from spring-core-2/src/main/java/org/baeldung/primary/GeneralManager.java rename to spring-core-2/src/main/java/com/baeldung/primary/GeneralManager.java index 0a94f0f96a..80b5a79471 100644 --- a/spring-core-2/src/main/java/org/baeldung/primary/GeneralManager.java +++ b/spring-core-2/src/main/java/com/baeldung/primary/GeneralManager.java @@ -1,4 +1,4 @@ -package org.baeldung.primary; +package com.baeldung.primary; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/primary/Manager.java b/spring-core-2/src/main/java/com/baeldung/primary/Manager.java similarity index 77% rename from spring-core-2/src/main/java/org/baeldung/primary/Manager.java rename to spring-core-2/src/main/java/com/baeldung/primary/Manager.java index 4666a1babf..45e02b2b05 100644 --- a/spring-core-2/src/main/java/org/baeldung/primary/Manager.java +++ b/spring-core-2/src/main/java/com/baeldung/primary/Manager.java @@ -1,4 +1,4 @@ -package org.baeldung.primary; +package com.baeldung.primary; /** * Created by Gebruiker on 7/19/2018. diff --git a/spring-core-2/src/main/java/org/baeldung/primary/ManagerService.java b/spring-core-2/src/main/java/com/baeldung/primary/ManagerService.java similarity index 91% rename from spring-core-2/src/main/java/org/baeldung/primary/ManagerService.java rename to spring-core-2/src/main/java/com/baeldung/primary/ManagerService.java index 94ea6785c9..86390327c2 100644 --- a/spring-core-2/src/main/java/org/baeldung/primary/ManagerService.java +++ b/spring-core-2/src/main/java/com/baeldung/primary/ManagerService.java @@ -1,4 +1,4 @@ -package org.baeldung.primary; +package com.baeldung.primary; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/spring-core-2/src/main/java/org/baeldung/primary/PrimaryApplication.java b/spring-core-2/src/main/java/com/baeldung/primary/PrimaryApplication.java similarity index 95% rename from spring-core-2/src/main/java/org/baeldung/primary/PrimaryApplication.java rename to spring-core-2/src/main/java/com/baeldung/primary/PrimaryApplication.java index ffa2a4028d..f66bf8285b 100644 --- a/spring-core-2/src/main/java/org/baeldung/primary/PrimaryApplication.java +++ b/spring-core-2/src/main/java/com/baeldung/primary/PrimaryApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.primary; +package com.baeldung.primary; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/spring-core-2/src/main/java/org/baeldung/profiles/DatasourceConfig.java b/spring-core-2/src/main/java/com/baeldung/profiles/DatasourceConfig.java similarity index 64% rename from spring-core-2/src/main/java/org/baeldung/profiles/DatasourceConfig.java rename to spring-core-2/src/main/java/com/baeldung/profiles/DatasourceConfig.java index 8fde925fd8..9724477666 100644 --- a/spring-core-2/src/main/java/org/baeldung/profiles/DatasourceConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/profiles/DatasourceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; public interface DatasourceConfig { void setup(); diff --git a/spring-core-2/src/main/java/org/baeldung/profiles/DevDatasourceConfig.java b/spring-core-2/src/main/java/com/baeldung/profiles/DevDatasourceConfig.java similarity index 91% rename from spring-core-2/src/main/java/org/baeldung/profiles/DevDatasourceConfig.java rename to spring-core-2/src/main/java/com/baeldung/profiles/DevDatasourceConfig.java index e357280c43..b4b14eaf50 100644 --- a/spring-core-2/src/main/java/org/baeldung/profiles/DevDatasourceConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/profiles/DevDatasourceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/profiles/ProductionDatasourceConfig.java b/spring-core-2/src/main/java/com/baeldung/profiles/ProductionDatasourceConfig.java similarity index 91% rename from spring-core-2/src/main/java/org/baeldung/profiles/ProductionDatasourceConfig.java rename to spring-core-2/src/main/java/com/baeldung/profiles/ProductionDatasourceConfig.java index f1adff9c96..57943d1b17 100644 --- a/spring-core-2/src/main/java/org/baeldung/profiles/ProductionDatasourceConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/profiles/ProductionDatasourceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/profiles/ProfileManager.java b/spring-core-2/src/main/java/com/baeldung/profiles/ProfileManager.java similarity index 93% rename from spring-core-2/src/main/java/org/baeldung/profiles/ProfileManager.java rename to spring-core-2/src/main/java/com/baeldung/profiles/ProfileManager.java index b4cb10e690..81d4592782 100644 --- a/spring-core-2/src/main/java/org/baeldung/profiles/ProfileManager.java +++ b/spring-core-2/src/main/java/com/baeldung/profiles/ProfileManager.java @@ -1,4 +1,4 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; diff --git a/spring-core-2/src/main/java/org/baeldung/profiles/SpringProfilesConfig.java b/spring-core-2/src/main/java/com/baeldung/profiles/SpringProfilesConfig.java similarity index 80% rename from spring-core-2/src/main/java/org/baeldung/profiles/SpringProfilesConfig.java rename to spring-core-2/src/main/java/com/baeldung/profiles/SpringProfilesConfig.java index 2d1905ee9c..cdd96ad953 100644 --- a/spring-core-2/src/main/java/org/baeldung/profiles/SpringProfilesConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/profiles/SpringProfilesConfig.java @@ -1,11 +1,11 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @Configuration -@ComponentScan("org.baeldung.profiles") +@ComponentScan("com.baeldung.profiles") @PropertySource(value = "classpath:application.properties") public class SpringProfilesConfig { diff --git a/spring-core-2/src/main/java/com/baeldung/sample/Bar.java b/spring-core-2/src/main/java/com/baeldung/sample/Bar.java new file mode 100644 index 0000000000..42302b5563 --- /dev/null +++ b/spring-core-2/src/main/java/com/baeldung/sample/Bar.java @@ -0,0 +1,5 @@ +package com.baeldung.sample; + +public class Bar { + +} diff --git a/spring-core-2/src/main/java/com/baeldung/sample/Foo.java b/spring-core-2/src/main/java/com/baeldung/sample/Foo.java new file mode 100644 index 0000000000..b25c9ecfb5 --- /dev/null +++ b/spring-core-2/src/main/java/com/baeldung/sample/Foo.java @@ -0,0 +1,5 @@ +package com.baeldung.sample; + +public class Foo { + +} diff --git a/spring-core-2/src/main/java/org/baeldung/sampleabstract/BallService.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/BallService.java similarity index 94% rename from spring-core-2/src/main/java/org/baeldung/sampleabstract/BallService.java rename to spring-core-2/src/main/java/com/baeldung/sampleabstract/BallService.java index 9a75de7fa1..0d951aac8b 100644 --- a/spring-core-2/src/main/java/org/baeldung/sampleabstract/BallService.java +++ b/spring-core-2/src/main/java/com/baeldung/sampleabstract/BallService.java @@ -1,4 +1,4 @@ -package org.baeldung.sampleabstract; +package com.baeldung.sampleabstract; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-core-2/src/main/java/org/baeldung/sampleabstract/BasketballService.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/BasketballService.java similarity index 88% rename from spring-core-2/src/main/java/org/baeldung/sampleabstract/BasketballService.java rename to spring-core-2/src/main/java/com/baeldung/sampleabstract/BasketballService.java index c117231d3c..4d6345b069 100644 --- a/spring-core-2/src/main/java/org/baeldung/sampleabstract/BasketballService.java +++ b/spring-core-2/src/main/java/com/baeldung/sampleabstract/BasketballService.java @@ -1,4 +1,4 @@ -package org.baeldung.sampleabstract; +package com.baeldung.sampleabstract; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/sampleabstract/DemoApp.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/DemoApp.java similarity index 82% rename from spring-core-2/src/main/java/org/baeldung/sampleabstract/DemoApp.java rename to spring-core-2/src/main/java/com/baeldung/sampleabstract/DemoApp.java index 615d354ecf..5a308b2671 100644 --- a/spring-core-2/src/main/java/org/baeldung/sampleabstract/DemoApp.java +++ b/spring-core-2/src/main/java/com/baeldung/sampleabstract/DemoApp.java @@ -1,4 +1,4 @@ -package org.baeldung.sampleabstract; +package com.baeldung.sampleabstract; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -6,7 +6,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan(basePackages = "org.baeldung.sampleabstract") +@ComponentScan(basePackages = "com.baeldung.sampleabstract") public class DemoApp { diff --git a/spring-core-2/src/main/java/org/baeldung/sampleabstract/LogRepository.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/LogRepository.java similarity index 82% rename from spring-core-2/src/main/java/org/baeldung/sampleabstract/LogRepository.java rename to spring-core-2/src/main/java/com/baeldung/sampleabstract/LogRepository.java index 3a65671493..84979768b5 100644 --- a/spring-core-2/src/main/java/org/baeldung/sampleabstract/LogRepository.java +++ b/spring-core-2/src/main/java/com/baeldung/sampleabstract/LogRepository.java @@ -1,4 +1,4 @@ -package org.baeldung.sampleabstract; +package com.baeldung.sampleabstract; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/sampleabstract/RuleRepository.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/RuleRepository.java similarity index 82% rename from spring-core-2/src/main/java/org/baeldung/sampleabstract/RuleRepository.java rename to spring-core-2/src/main/java/com/baeldung/sampleabstract/RuleRepository.java index fd42178ab6..a1c5b5067f 100644 --- a/spring-core-2/src/main/java/org/baeldung/sampleabstract/RuleRepository.java +++ b/spring-core-2/src/main/java/com/baeldung/sampleabstract/RuleRepository.java @@ -1,4 +1,4 @@ -package org.baeldung.sampleabstract; +package com.baeldung.sampleabstract; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/scopes/HelloMessageGenerator.java b/spring-core-2/src/main/java/com/baeldung/scopes/HelloMessageGenerator.java similarity index 88% rename from spring-core-2/src/main/java/org/baeldung/scopes/HelloMessageGenerator.java rename to spring-core-2/src/main/java/com/baeldung/scopes/HelloMessageGenerator.java index 562069bc9a..9b912fc04e 100644 --- a/spring-core-2/src/main/java/org/baeldung/scopes/HelloMessageGenerator.java +++ b/spring-core-2/src/main/java/com/baeldung/scopes/HelloMessageGenerator.java @@ -1,4 +1,4 @@ -package org.baeldung.scopes; +package com.baeldung.scopes; public class HelloMessageGenerator { diff --git a/spring-core-2/src/main/java/org/baeldung/scopes/Person.java b/spring-core-2/src/main/java/com/baeldung/scopes/Person.java similarity index 93% rename from spring-core-2/src/main/java/org/baeldung/scopes/Person.java rename to spring-core-2/src/main/java/com/baeldung/scopes/Person.java index b070007a5c..e2ea2ce1d7 100644 --- a/spring-core-2/src/main/java/org/baeldung/scopes/Person.java +++ b/spring-core-2/src/main/java/com/baeldung/scopes/Person.java @@ -1,4 +1,4 @@ -package org.baeldung.scopes; +package com.baeldung.scopes; public class Person { private String name; diff --git a/spring-core-2/src/main/java/org/baeldung/scopes/ScopesController.java b/spring-core-2/src/main/java/com/baeldung/scopes/ScopesController.java similarity index 98% rename from spring-core-2/src/main/java/org/baeldung/scopes/ScopesController.java rename to spring-core-2/src/main/java/com/baeldung/scopes/ScopesController.java index 9257a3aa3a..1ca4dc4050 100644 --- a/spring-core-2/src/main/java/org/baeldung/scopes/ScopesController.java +++ b/spring-core-2/src/main/java/com/baeldung/scopes/ScopesController.java @@ -1,4 +1,4 @@ -package org.baeldung.scopes; +package com.baeldung.scopes; import javax.annotation.Resource; diff --git a/spring-core-2/src/main/java/org/baeldung/spring/config/CleanupBean.java b/spring-core-2/src/main/java/com/baeldung/spring/config/CleanupBean.java similarity index 95% rename from spring-core-2/src/main/java/org/baeldung/spring/config/CleanupBean.java rename to spring-core-2/src/main/java/com/baeldung/spring/config/CleanupBean.java index ac90319745..155b8af9c4 100644 --- a/spring-core-2/src/main/java/org/baeldung/spring/config/CleanupBean.java +++ b/spring-core-2/src/main/java/com/baeldung/spring/config/CleanupBean.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import java.util.concurrent.ExecutorService; diff --git a/spring-core-2/src/main/java/org/baeldung/spring/config/CoreConfig.java b/spring-core-2/src/main/java/com/baeldung/spring/config/CoreConfig.java similarity index 92% rename from spring-core-2/src/main/java/org/baeldung/spring/config/CoreConfig.java rename to spring-core-2/src/main/java/com/baeldung/spring/config/CoreConfig.java index 0d753dc447..35d245a17e 100644 --- a/spring-core-2/src/main/java/org/baeldung/spring/config/CoreConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/spring/config/CoreConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration -@ComponentScan("org.baeldung.core") +@ComponentScan("com.baeldung.core") public class CoreConfig implements WebMvcConfigurer { public CoreConfig() { diff --git a/spring-core-2/src/main/java/org/baeldung/spring/config/MainWebAppInitializer.java b/spring-core-2/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java similarity index 95% rename from spring-core-2/src/main/java/org/baeldung/spring/config/MainWebAppInitializer.java rename to spring-core-2/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java index 9f4b73f609..dd396a653f 100644 --- a/spring-core-2/src/main/java/org/baeldung/spring/config/MainWebAppInitializer.java +++ b/spring-core-2/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import java.util.Set; @@ -26,7 +26,7 @@ public class MainWebAppInitializer implements WebApplicationInitializer // Create the 'root' Spring application context final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); - root.scan("org.baeldung.spring.config"); + root.scan("com.baeldung.spring.config"); // root.getEnvironment().setDefaultProfiles("embedded"); sc.addListener(new ContextLoaderListener(root)); diff --git a/spring-core-2/src/main/java/org/baeldung/spring/config/MvcConfig.java b/spring-core-2/src/main/java/com/baeldung/spring/config/MvcConfig.java similarity index 96% rename from spring-core-2/src/main/java/org/baeldung/spring/config/MvcConfig.java rename to spring-core-2/src/main/java/com/baeldung/spring/config/MvcConfig.java index e550733c47..cd31cd1128 100644 --- a/spring-core-2/src/main/java/org/baeldung/spring/config/MvcConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/spring/config/MvcConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-core-2/src/main/java/org/baeldung/spring/config/PersistenceConfig.java b/spring-core-2/src/main/java/com/baeldung/spring/config/PersistenceConfig.java similarity index 94% rename from spring-core-2/src/main/java/org/baeldung/spring/config/PersistenceConfig.java rename to spring-core-2/src/main/java/com/baeldung/spring/config/PersistenceConfig.java index ffe88596fa..f27543af46 100644 --- a/spring-core-2/src/main/java/org/baeldung/spring/config/PersistenceConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/spring/config/PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import java.util.Properties; @@ -20,7 +20,7 @@ import com.google.common.base.Preconditions; // @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-mysql.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence" }) public class PersistenceConfig { @Autowired @@ -34,7 +34,7 @@ public class PersistenceConfig { public LocalSessionFactoryBean sessionFactory() { final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "org.baeldung.spring.persistence.model" }); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.spring.persistence.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; diff --git a/spring-core-2/src/main/java/org/baeldung/spring/config/ScopesConfig.java b/spring-core-2/src/main/java/com/baeldung/spring/config/ScopesConfig.java similarity index 100% rename from spring-core-2/src/main/java/org/baeldung/spring/config/ScopesConfig.java rename to spring-core-2/src/main/java/com/baeldung/spring/config/ScopesConfig.java diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/asynchronous/AsynchronousSpringEventsConfig.java b/spring-core-2/src/main/java/com/baeldung/springevents/asynchronous/AsynchronousSpringEventsConfig.java similarity index 89% rename from spring-core-2/src/main/java/org/baeldung/springevents/asynchronous/AsynchronousSpringEventsConfig.java rename to spring-core-2/src/main/java/com/baeldung/springevents/asynchronous/AsynchronousSpringEventsConfig.java index 082a986974..085f3b0706 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/asynchronous/AsynchronousSpringEventsConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/asynchronous/AsynchronousSpringEventsConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.asynchronous; +package com.baeldung.springevents.asynchronous; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -8,7 +8,7 @@ import org.springframework.context.event.SimpleApplicationEventMulticaster; import org.springframework.core.task.SimpleAsyncTaskExecutor; @Configuration -@ComponentScan("org.baeldung.springevents.synchronous") +@ComponentScan("com.baeldung.springevents.synchronous") public class AsynchronousSpringEventsConfig { @Bean(name = "applicationEventMulticaster") diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java similarity index 97% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java index f750c40a6e..bbb2b5f008 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/AnnotationDrivenEventListener.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.springframework.context.event.ContextStartedEvent; import org.springframework.context.event.EventListener; diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/ContextRefreshedListener.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/ContextRefreshedListener.java similarity index 93% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/ContextRefreshedListener.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/ContextRefreshedListener.java index 9f8b2e6e83..31a6c78d00 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/ContextRefreshedListener.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/ContextRefreshedListener.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEvent.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEvent.java similarity index 89% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEvent.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEvent.java index 1631801ffe..3cf4980be3 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEvent.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEvent.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.springframework.context.ApplicationEvent; diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventListener.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventListener.java similarity index 89% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventListener.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventListener.java index 69f96966ec..ff7ca7fe39 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventListener.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventListener.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventPublisher.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventPublisher.java similarity index 96% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventPublisher.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventPublisher.java index 3182090d5d..e4d7fcdc99 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/CustomSpringEventPublisher.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventPublisher.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringAppEvent.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringAppEvent.java similarity index 87% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringAppEvent.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringAppEvent.java index 6804312189..8a50a55f31 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringAppEvent.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringAppEvent.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.springframework.context.ApplicationEvent; diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEvent.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringEvent.java similarity index 88% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEvent.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringEvent.java index ce2c223fec..86471221d2 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEvent.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringEvent.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; public class GenericSpringEvent { diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEventListener.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringEventListener.java similarity index 93% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEventListener.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringEventListener.java index 1f5e3e7068..7b0a9727e4 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericSpringEventListener.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericSpringEventListener.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.springframework.context.ApplicationListener; import org.springframework.lang.NonNull; diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java similarity index 80% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java index fd214696e7..74839b4708 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericStringSpringAppEvent.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; class GenericStringSpringAppEvent extends GenericSpringAppEvent { diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringEvent.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericStringSpringEvent.java similarity index 80% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringEvent.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericStringSpringEvent.java index dd4e4e3ed4..70dda99aa3 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/GenericStringSpringEvent.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/GenericStringSpringEvent.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; public class GenericStringSpringEvent extends GenericSpringEvent { diff --git a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/SynchronousSpringEventsConfig.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/SynchronousSpringEventsConfig.java similarity index 64% rename from spring-core-2/src/main/java/org/baeldung/springevents/synchronous/SynchronousSpringEventsConfig.java rename to spring-core-2/src/main/java/com/baeldung/springevents/synchronous/SynchronousSpringEventsConfig.java index fff8a7e4b5..58cb220ecb 100644 --- a/spring-core-2/src/main/java/org/baeldung/springevents/synchronous/SynchronousSpringEventsConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/SynchronousSpringEventsConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.springevents.synchronous") +@ComponentScan("com.baeldung.springevents.synchronous") public class SynchronousSpringEventsConfig { } diff --git a/spring-core-2/src/main/java/org/baeldung/startup/AllStrategiesExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java similarity index 96% rename from spring-core-2/src/main/java/org/baeldung/startup/AllStrategiesExampleBean.java rename to spring-core-2/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java index f36b8703ea..e08309d474 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/AllStrategiesExampleBean.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-core-2/src/main/java/org/baeldung/startup/EventListenerExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/EventListenerExampleBean.java similarity index 94% rename from spring-core-2/src/main/java/org/baeldung/startup/EventListenerExampleBean.java rename to spring-core-2/src/main/java/com/baeldung/startup/EventListenerExampleBean.java index 58e42337cc..a76fc6a2b2 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/EventListenerExampleBean.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/EventListenerExampleBean.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-core-2/src/main/java/org/baeldung/startup/InitMethodExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/InitMethodExampleBean.java similarity index 95% rename from spring-core-2/src/main/java/org/baeldung/startup/InitMethodExampleBean.java rename to spring-core-2/src/main/java/com/baeldung/startup/InitMethodExampleBean.java index f3d30011f8..a3b12028d1 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/InitMethodExampleBean.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/InitMethodExampleBean.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import java.util.Arrays; diff --git a/spring-core-2/src/main/java/org/baeldung/startup/InitializingBeanExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java similarity index 96% rename from spring-core-2/src/main/java/org/baeldung/startup/InitializingBeanExampleBean.java rename to spring-core-2/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java index 5d6f8c9d88..c625a172fd 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/InitializingBeanExampleBean.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import java.util.Arrays; diff --git a/spring-core-2/src/main/java/org/baeldung/startup/InvalidInitExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java similarity index 93% rename from spring-core-2/src/main/java/org/baeldung/startup/InvalidInitExampleBean.java rename to spring-core-2/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java index 0b9c6f0c7d..d31aee8acd 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/InvalidInitExampleBean.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; diff --git a/spring-core-2/src/main/java/org/baeldung/startup/LogicInConstructorExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java similarity index 95% rename from spring-core-2/src/main/java/org/baeldung/startup/LogicInConstructorExampleBean.java rename to spring-core-2/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java index d25a83942a..ade7573bbe 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/LogicInConstructorExampleBean.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import java.util.Arrays; diff --git a/spring-core-2/src/main/java/org/baeldung/startup/PostConstructExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/PostConstructExampleBean.java similarity index 95% rename from spring-core-2/src/main/java/org/baeldung/startup/PostConstructExampleBean.java rename to spring-core-2/src/main/java/com/baeldung/startup/PostConstructExampleBean.java index 2397c3a0a2..1001043d86 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/PostConstructExampleBean.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/PostConstructExampleBean.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import java.util.Arrays; diff --git a/spring-core-2/src/main/java/org/baeldung/startup/SpringStartupConfig.java b/spring-core-2/src/main/java/com/baeldung/startup/SpringStartupConfig.java similarity index 71% rename from spring-core-2/src/main/java/org/baeldung/startup/SpringStartupConfig.java rename to spring-core-2/src/main/java/com/baeldung/startup/SpringStartupConfig.java index 12854e1be5..ad6492dadc 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/SpringStartupConfig.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/SpringStartupConfig.java @@ -1,9 +1,9 @@ -package org.baeldung.startup; +package com.baeldung.startup; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.startup") +@ComponentScan("com.baeldung.startup") public class SpringStartupConfig { } \ No newline at end of file diff --git a/spring-core-2/src/main/java/org/baeldung/startup/StartupApplicationListenerExample.java b/spring-core-2/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java similarity index 95% rename from spring-core-2/src/main/java/org/baeldung/startup/StartupApplicationListenerExample.java rename to spring-core-2/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java index e02388dea3..2cc5e6abcb 100644 --- a/spring-core-2/src/main/java/org/baeldung/startup/StartupApplicationListenerExample.java +++ b/spring-core-2/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-core-2/src/main/java/org/baeldung/autowire/sample/FooDAO.java b/spring-core-2/src/main/java/org/baeldung/autowire/sample/FooDAO.java deleted file mode 100644 index 3d3deaa077..0000000000 --- a/spring-core-2/src/main/java/org/baeldung/autowire/sample/FooDAO.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.autowire.sample; - -public class FooDAO { - -} diff --git a/spring-core-2/src/main/java/org/baeldung/autowire/sample/FooService.java b/spring-core-2/src/main/java/org/baeldung/autowire/sample/FooService.java deleted file mode 100644 index a3638960cc..0000000000 --- a/spring-core-2/src/main/java/org/baeldung/autowire/sample/FooService.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung.autowire.sample; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class FooService { - - @Autowired - @FormatterType("Foo") - private Formatter formatter; - - public String doStuff() { - return formatter.format(); - } - -} diff --git a/spring-core-2/src/main/java/org/baeldung/sample/Bar.java b/spring-core-2/src/main/java/org/baeldung/sample/Bar.java deleted file mode 100644 index 54e8d54418..0000000000 --- a/spring-core-2/src/main/java/org/baeldung/sample/Bar.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.sample; - -public class Bar { - -} diff --git a/spring-core-2/src/main/java/org/baeldung/sample/Foo.java b/spring-core-2/src/main/java/org/baeldung/sample/Foo.java deleted file mode 100644 index 562a00121a..0000000000 --- a/spring-core-2/src/main/java/org/baeldung/sample/Foo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.sample; - -public class Foo { - -} diff --git a/spring-core-2/src/main/resources/beanInjection-constructor.xml b/spring-core-2/src/main/resources/beanInjection-constructor.xml index 5a2ffe767c..cbb8f98bb9 100644 --- a/spring-core-2/src/main/resources/beanInjection-constructor.xml +++ b/spring-core-2/src/main/resources/beanInjection-constructor.xml @@ -4,12 +4,12 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + \ No newline at end of file diff --git a/spring-core-2/src/main/resources/beanInjection-setter.xml b/spring-core-2/src/main/resources/beanInjection-setter.xml index 0e82e3be1c..1440df9702 100644 --- a/spring-core-2/src/main/resources/beanInjection-setter.xml +++ b/spring-core-2/src/main/resources/beanInjection-setter.xml @@ -4,11 +4,11 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + \ No newline at end of file diff --git a/spring-core-2/src/main/resources/jdbc/springJdbc-config.xml b/spring-core-2/src/main/resources/jdbc/springJdbc-config.xml index 5fd2699b41..e3d7452eb1 100644 --- a/spring-core-2/src/main/resources/jdbc/springJdbc-config.xml +++ b/spring-core-2/src/main/resources/jdbc/springJdbc-config.xml @@ -4,7 +4,7 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd" > - + diff --git a/spring-core-2/src/main/resources/scopes.xml b/spring-core-2/src/main/resources/scopes.xml index 8fdb186c28..f7b554ec49 100644 --- a/spring-core-2/src/main/resources/scopes.xml +++ b/spring-core-2/src/main/resources/scopes.xml @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + - + diff --git a/spring-core-2/src/main/resources/springProfiles-config.xml b/spring-core-2/src/main/resources/springProfiles-config.xml index 985ab6ba86..5eb6bfcd7f 100644 --- a/spring-core-2/src/main/resources/springProfiles-config.xml +++ b/spring-core-2/src/main/resources/springProfiles-config.xml @@ -6,10 +6,10 @@ > - + - + \ No newline at end of file diff --git a/spring-core-2/src/main/resources/startupConfig.xml b/spring-core-2/src/main/resources/startupConfig.xml index 8226665a90..d42e0f6c2b 100644 --- a/spring-core-2/src/main/resources/startupConfig.xml +++ b/spring-core-2/src/main/resources/startupConfig.xml @@ -4,13 +4,13 @@ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> \ No newline at end of file diff --git a/spring-core-2/src/test/java/org/baeldung/autowire/sample/FooServiceIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/autowire/sample/FooServiceIntegrationTest.java similarity index 94% rename from spring-core-2/src/test/java/org/baeldung/autowire/sample/FooServiceIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/autowire/sample/FooServiceIntegrationTest.java index 941fc4baff..34ba7902ca 100644 --- a/spring-core-2/src/test/java/org/baeldung/autowire/sample/FooServiceIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/autowire/sample/FooServiceIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.autowire.sample; +package com.baeldung.autowire.sample; import org.junit.Assert; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/bean/injection/ConstructorBasedBeanInjectionWithJavaConfigIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/bean/injection/ConstructorBasedBeanInjectionWithJavaConfigIntegrationTest.java similarity index 87% rename from spring-core-2/src/test/java/org/baeldung/bean/injection/ConstructorBasedBeanInjectionWithJavaConfigIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/bean/injection/ConstructorBasedBeanInjectionWithJavaConfigIntegrationTest.java index 447a09d69e..fb3f973f29 100644 --- a/spring-core-2/src/test/java/org/baeldung/bean/injection/ConstructorBasedBeanInjectionWithJavaConfigIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/bean/injection/ConstructorBasedBeanInjectionWithJavaConfigIntegrationTest.java @@ -1,6 +1,6 @@ -package org.baeldung.bean.injection; +package com.baeldung.bean.injection; -import org.baeldung.bean.config.ConstructorBasedShipConfig; +import com.baeldung.bean.config.ConstructorBasedShipConfig; import org.junit.Assert; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/spring-core-2/src/test/java/org/baeldung/bean/injection/ConstructorBasedBeanInjectionWithXMLConfigIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/bean/injection/ConstructorBasedBeanInjectionWithXMLConfigIntegrationTest.java similarity index 95% rename from spring-core-2/src/test/java/org/baeldung/bean/injection/ConstructorBasedBeanInjectionWithXMLConfigIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/bean/injection/ConstructorBasedBeanInjectionWithXMLConfigIntegrationTest.java index 9f6011d851..18ce5ce8ed 100644 --- a/spring-core-2/src/test/java/org/baeldung/bean/injection/ConstructorBasedBeanInjectionWithXMLConfigIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/bean/injection/ConstructorBasedBeanInjectionWithXMLConfigIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.bean.injection; +package com.baeldung.bean.injection; import org.junit.Assert; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/bean/injection/SetterBasedBeanInjectionWithJavaConfigIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/bean/injection/SetterBasedBeanInjectionWithJavaConfigIntegrationTest.java similarity index 87% rename from spring-core-2/src/test/java/org/baeldung/bean/injection/SetterBasedBeanInjectionWithJavaConfigIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/bean/injection/SetterBasedBeanInjectionWithJavaConfigIntegrationTest.java index 1c15775093..1e2147d2bc 100644 --- a/spring-core-2/src/test/java/org/baeldung/bean/injection/SetterBasedBeanInjectionWithJavaConfigIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/bean/injection/SetterBasedBeanInjectionWithJavaConfigIntegrationTest.java @@ -1,6 +1,6 @@ -package org.baeldung.bean.injection; +package com.baeldung.bean.injection; -import org.baeldung.bean.config.SetterBasedShipConfig; +import com.baeldung.bean.config.SetterBasedShipConfig; import org.junit.Assert; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/spring-core-2/src/test/java/org/baeldung/bean/injection/SetterBasedBeanInjectionWithXMLConfigIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/bean/injection/SetterBasedBeanInjectionWithXMLConfigIntegrationTest.java similarity index 94% rename from spring-core-2/src/test/java/org/baeldung/bean/injection/SetterBasedBeanInjectionWithXMLConfigIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/bean/injection/SetterBasedBeanInjectionWithXMLConfigIntegrationTest.java index bc17a08383..9c7526a7be 100644 --- a/spring-core-2/src/test/java/org/baeldung/bean/injection/SetterBasedBeanInjectionWithXMLConfigIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/bean/injection/SetterBasedBeanInjectionWithXMLConfigIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.bean.injection; +package com.baeldung.bean.injection; import org.junit.Assert; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/customannotation/Account.java b/spring-core-2/src/test/java/com/baeldung/customannotation/Account.java similarity index 94% rename from spring-core-2/src/test/java/org/baeldung/customannotation/Account.java rename to spring-core-2/src/test/java/com/baeldung/customannotation/Account.java index 04545e5b83..cfdd8815e4 100644 --- a/spring-core-2/src/test/java/org/baeldung/customannotation/Account.java +++ b/spring-core-2/src/test/java/com/baeldung/customannotation/Account.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import java.io.Serializable; diff --git a/spring-core-2/src/test/java/org/baeldung/customannotation/BeanWithGenericDAO.java b/spring-core-2/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java similarity index 89% rename from spring-core-2/src/test/java/org/baeldung/customannotation/BeanWithGenericDAO.java rename to spring-core-2/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java index 9ba915f296..a0707f263b 100644 --- a/spring-core-2/src/test/java/org/baeldung/customannotation/BeanWithGenericDAO.java +++ b/spring-core-2/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import org.springframework.stereotype.Repository; diff --git a/spring-core-2/src/test/java/org/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java similarity index 98% rename from spring-core-2/src/test/java/org/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java index ae3d53fb9b..1baea4505b 100644 --- a/spring-core-2/src/test/java/org/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; diff --git a/spring-core-2/src/test/java/org/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java similarity index 98% rename from spring-core-2/src/test/java/org/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java index bab2574cd2..bc7a5f7246 100644 --- a/spring-core-2/src/test/java/org/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; diff --git a/spring-core-2/src/test/java/org/baeldung/customannotation/Person.java b/spring-core-2/src/test/java/com/baeldung/customannotation/Person.java similarity index 92% rename from spring-core-2/src/test/java/org/baeldung/customannotation/Person.java rename to spring-core-2/src/test/java/com/baeldung/customannotation/Person.java index 3babc8f0a2..4fa70e51af 100644 --- a/spring-core-2/src/test/java/org/baeldung/customannotation/Person.java +++ b/spring-core-2/src/test/java/com/baeldung/customannotation/Person.java @@ -1,4 +1,4 @@ -package org.baeldung.customannotation; +package com.baeldung.customannotation; import java.io.Serializable; diff --git a/spring-core-2/src/test/java/org/baeldung/customscope/TenantScopeIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java similarity index 96% rename from spring-core-2/src/test/java/org/baeldung/customscope/TenantScopeIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java index e873ac5065..1cd7357a09 100644 --- a/spring-core-2/src/test/java/org/baeldung/customscope/TenantScopeIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.customscope; +package com.baeldung.customscope; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; @@ -46,7 +46,7 @@ public class TenantScopeIntegrationTest { public final void whenComponentScan_thenContextContainsFooAndBar() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); try { - ctx.scan("org.baeldung.customscope"); + ctx.scan("com.baeldung.customscope"); ctx.refresh(); TenantBean foo = (TenantBean) ctx.getBean("foo", TenantBean.class); diff --git a/spring-core-2/src/test/java/org/baeldung/order/RatingRetrieverUnitTest.java b/spring-core-2/src/test/java/com/baeldung/order/RatingRetrieverUnitTest.java similarity index 93% rename from spring-core-2/src/test/java/org/baeldung/order/RatingRetrieverUnitTest.java rename to spring-core-2/src/test/java/com/baeldung/order/RatingRetrieverUnitTest.java index 96993ccd7c..342a4c5f05 100644 --- a/spring-core-2/src/test/java/org/baeldung/order/RatingRetrieverUnitTest.java +++ b/spring-core-2/src/test/java/com/baeldung/order/RatingRetrieverUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.order; +package com.baeldung.order; import static org.hamcrest.CoreMatchers.equalTo; @@ -21,7 +21,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader; public class RatingRetrieverUnitTest { @Configuration - @ComponentScan(basePackages = {"org.baeldung.order"}) + @ComponentScan(basePackages = {"com.baeldung.order"}) static class ContextConfiguration {} @Autowired diff --git a/spring-core-2/src/test/java/org/baeldung/profiles/DevProfileWithAnnotationIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/profiles/DevProfileWithAnnotationIntegrationTest.java similarity index 96% rename from spring-core-2/src/test/java/org/baeldung/profiles/DevProfileWithAnnotationIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/profiles/DevProfileWithAnnotationIntegrationTest.java index cf5ca132e6..81b136f5ba 100644 --- a/spring-core-2/src/test/java/org/baeldung/profiles/DevProfileWithAnnotationIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/profiles/DevProfileWithAnnotationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; import org.junit.Assert; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/profiles/ProductionProfileWithAnnotationIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/profiles/ProductionProfileWithAnnotationIntegrationTest.java similarity index 97% rename from spring-core-2/src/test/java/org/baeldung/profiles/ProductionProfileWithAnnotationIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/profiles/ProductionProfileWithAnnotationIntegrationTest.java index 5bacaef07b..b863fe30c1 100644 --- a/spring-core-2/src/test/java/org/baeldung/profiles/ProductionProfileWithAnnotationIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/profiles/ProductionProfileWithAnnotationIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; import org.junit.Assert; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java similarity index 96% rename from spring-core-2/src/test/java/org/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java index 929d088a14..60e9499d4b 100644 --- a/spring-core-2/src/test/java/org/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; import org.junit.Assert; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/profiles/SpringProfilesWithXMLIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithXMLIntegrationTest.java similarity index 98% rename from spring-core-2/src/test/java/org/baeldung/profiles/SpringProfilesWithXMLIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithXMLIntegrationTest.java index 2b46a50588..4fc90b2e7c 100644 --- a/spring-core-2/src/test/java/org/baeldung/profiles/SpringProfilesWithXMLIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithXMLIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.profiles; +package com.baeldung.profiles; import org.junit.Assert; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/scopes/ScopesIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/scopes/ScopesIntegrationTest.java similarity index 98% rename from spring-core-2/src/test/java/org/baeldung/scopes/ScopesIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/scopes/ScopesIntegrationTest.java index 0ae99610f6..ae4df3b632 100644 --- a/spring-core-2/src/test/java/org/baeldung/scopes/ScopesIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/scopes/ScopesIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.scopes; +package com.baeldung.scopes; import org.junit.Assert; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java similarity index 88% rename from spring-core-2/src/test/java/org/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java index e12baed7e0..4f8035bcbe 100644 --- a/spring-core-2/src/test/java/org/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java @@ -1,6 +1,6 @@ -package org.baeldung.springevents.asynchronous; +package com.baeldung.springevents.asynchronous; -import org.baeldung.springevents.synchronous.CustomSpringEventPublisher; +import com.baeldung.springevents.synchronous.CustomSpringEventPublisher; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-core-2/src/test/java/org/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java similarity index 87% rename from spring-core-2/src/test/java/org/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java index e8e6f91b06..0ba43cdcbb 100644 --- a/spring-core-2/src/test/java/org/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/ContextRefreshedListenerIntegrationTest.java @@ -1,6 +1,5 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; -import org.baeldung.springevents.synchronous.SynchronousSpringEventsConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-core-2/src/test/java/org/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java similarity index 95% rename from spring-core-2/src/test/java/org/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java index f183314b6d..7f5314b420 100644 --- a/spring-core-2/src/test/java/org/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/GenericAppEventListenerIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-core-2/src/test/java/org/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java similarity index 97% rename from spring-core-2/src/test/java/org/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java index b169cfec36..1d624d2289 100644 --- a/spring-core-2/src/test/java/org/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.springevents.synchronous; +package com.baeldung.springevents.synchronous; import org.junit.Ignore; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/startup/SpringStartupIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java similarity index 98% rename from spring-core-2/src/test/java/org/baeldung/startup/SpringStartupIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java index 6263482948..b58c093c31 100644 --- a/spring-core-2/src/test/java/org/baeldung/startup/SpringStartupIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import org.assertj.core.api.Assertions; import org.junit.Test; diff --git a/spring-core-2/src/test/java/org/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java similarity index 96% rename from spring-core-2/src/test/java/org/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java index a46d24fa3b..3dfd4835df 100644 --- a/spring-core-2/src/test/java/org/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.startup; +package com.baeldung.startup; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-data-rest-querydsl/pom.xml b/spring-data-rest-querydsl/pom.xml index 9f53f6b55f..c0ad43fe0b 100644 --- a/spring-data-rest-querydsl/pom.xml +++ b/spring-data-rest-querydsl/pom.xml @@ -72,8 +72,8 @@ org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + ${maven.source} + ${maven.target} -verbose -parameters @@ -83,7 +83,7 @@ com.mysema.maven apt-maven-plugin - 1.1.3 + ${mysema.version} generate-sources @@ -99,5 +99,10 @@ + + 1.8 + 1.8 + 1.1.3 + diff --git a/spring-data-rest/pom.xml b/spring-data-rest/pom.xml index 05f2ccbbae..bb592c08d5 100644 --- a/spring-data-rest/pom.xml +++ b/spring-data-rest/pom.xml @@ -66,7 +66,7 @@ com.mysema.maven maven-apt-plugin - 1.0 + ${maven.version} generate-sources @@ -90,6 +90,7 @@ UTF-8 com.baeldung.books.SpringDataRestApplication + 1.0 \ No newline at end of file diff --git a/spring-ejb/wildfly/wildfly-ear/pom.xml b/spring-ejb/wildfly/wildfly-ear/pom.xml index 9393820b12..07f53358bf 100644 --- a/spring-ejb/wildfly/wildfly-ear/pom.xml +++ b/spring-ejb/wildfly/wildfly-ear/pom.xml @@ -45,7 +45,7 @@ ${maven-ear-plugin.version} lib/ - 7 + ${defaultLibBundleDir.version} com.baeldung.wildfly @@ -66,6 +66,7 @@ 2.10.1 1.2.0.Final + 7 \ No newline at end of file diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause1/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause1/BeanA.java similarity index 78% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause1/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause1/BeanA.java index 50d07c6d39..735b6936fe 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause1/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause1/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause1; +package com.baeldung.ex.beancreationexception.cause1; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause1/BeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause1/BeanB.java new file mode 100644 index 0000000000..666389bb01 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause1/BeanB.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause1; + +public class BeanB { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanA.java similarity index 78% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanA.java index 352dd5f2db..ba139118b7 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause2; +package com.baeldung.ex.beancreationexception.cause2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanB1.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanB1.java similarity index 67% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanB1.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanB1.java index b9ec961d1e..b36dd1152f 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanB1.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanB1.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause2; +package com.baeldung.ex.beancreationexception.cause2; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanB2.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanB2.java similarity index 67% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanB2.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanB2.java index aa7fe8250a..4dc5a9a7f6 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/BeanB2.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/BeanB2.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause2; +package com.baeldung.ex.beancreationexception.cause2; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/IBeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/IBeanB.java new file mode 100644 index 0000000000..f469af842c --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause2/IBeanB.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause2; + +public interface IBeanB { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause3/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause3/BeanA.java similarity index 76% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause3/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause3/BeanA.java index 2f2d1b2684..e169a267b6 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause3/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause3/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause3; +package com.baeldung.ex.beancreationexception.cause3; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause4/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause4/BeanA.java similarity index 68% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause4/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause4/BeanA.java index 7886f30f22..d1e7b157ee 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause4/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause4/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause4; +package com.baeldung.ex.beancreationexception.cause4; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause4/IBeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause4/IBeanA.java new file mode 100644 index 0000000000..495dec9180 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause4/IBeanA.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause4; + +public interface IBeanA { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause5/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause5/BeanA.java similarity index 78% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause5/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause5/BeanA.java index b8f88125b2..85dc2a4c60 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause5/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause5/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause5; +package com.baeldung.ex.beancreationexception.cause5; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause5/IBeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause5/IBeanA.java new file mode 100644 index 0000000000..8429f7d5d7 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause5/IBeanA.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause5; + +public interface IBeanA { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/BeanA.java similarity index 68% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/BeanA.java index 164b006340..82dcb6faf2 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause6; +package com.baeldung.ex.beancreationexception.cause6; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/BeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/BeanB.java similarity index 66% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/BeanB.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/BeanB.java index 4a7bdab280..f37cc6f50d 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/BeanB.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/BeanB.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause6; +package com.baeldung.ex.beancreationexception.cause6; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/IBeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/IBeanB.java new file mode 100644 index 0000000000..6515c7b467 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause6/IBeanB.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause6; + +public interface IBeanB { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/BeanA.java similarity index 84% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/BeanA.java index 2a0230fa3f..e301a1f13c 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause8; +package com.baeldung.ex.beancreationexception.cause8; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/BeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/BeanB.java similarity index 84% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/BeanB.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/BeanB.java index 2e8a3eed07..3c3bd9f106 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/BeanB.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/BeanB.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause8; +package com.baeldung.ex.beancreationexception.cause8; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/IBeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/IBeanA.java new file mode 100644 index 0000000000..42b4c7390c --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/IBeanA.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause8; + +public interface IBeanA { + // +} diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/IBeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/IBeanB.java new file mode 100644 index 0000000000..6ecbddf617 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause8/IBeanB.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause8; + +public interface IBeanB { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/BeanA.java similarity index 51% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/BeanA.java index 28c39e2777..814c4f84ff 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception.cause9; +package com.baeldung.ex.beancreationexception.cause9; public abstract class BeanA implements IBeanA { // diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/BeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/BeanB.java new file mode 100644 index 0000000000..327bbfd10e --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/BeanB.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause9; + +public class BeanB { + // +} \ No newline at end of file diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/IBeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/IBeanA.java new file mode 100644 index 0000000000..a8abfd5ae0 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/cause9/IBeanA.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.beancreationexception.cause9; + +public interface IBeanA { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause1ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause1ContextWithJavaConfig.java similarity index 69% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause1ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause1ContextWithJavaConfig.java index cb74b96b67..fcc501f7e3 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause1ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause1ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause1") +@ComponentScan("com.baeldung.ex.beancreationexception.cause1") public class Cause1ContextWithJavaConfig { public Cause1ContextWithJavaConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause2ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause2ContextWithJavaConfig.java similarity index 69% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause2ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause2ContextWithJavaConfig.java index 6b20439059..cd8b36f2db 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause2ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause2ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause2") +@ComponentScan("com.baeldung.ex.beancreationexception.cause2") public class Cause2ContextWithJavaConfig { public Cause2ContextWithJavaConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause3ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause3ContextWithJavaConfig.java similarity index 69% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause3ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause3ContextWithJavaConfig.java index 437d2c4c20..205a9b6553 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause3ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause3ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause3") +@ComponentScan("com.baeldung.ex.beancreationexception.cause3") public class Cause3ContextWithJavaConfig { public Cause3ContextWithJavaConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause4ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause4ContextWithJavaConfig.java similarity index 76% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause4ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause4ContextWithJavaConfig.java index b661ba4650..f2fb2b9a6d 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause4ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause4ContextWithJavaConfig.java @@ -1,11 +1,11 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause4") +@ComponentScan("com.baeldung.ex.beancreationexception.cause4") @ImportResource("classpath:beancreationexception_cause4.xml") public class Cause4ContextWithJavaConfig { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause5ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause5ContextWithJavaConfig.java similarity index 69% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause5ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause5ContextWithJavaConfig.java index 821041cb0c..3d45bd6896 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause5ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause5ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause5") +@ComponentScan("com.baeldung.ex.beancreationexception.cause5") public class Cause5ContextWithJavaConfig { public Cause5ContextWithJavaConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause6ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause6ContextWithJavaConfig.java similarity index 76% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause6ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause6ContextWithJavaConfig.java index c76e34deec..ab4c590804 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause6ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause6ContextWithJavaConfig.java @@ -1,11 +1,11 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause6") +@ComponentScan("com.baeldung.ex.beancreationexception.cause6") @ImportResource("classpath:beancreationexception_cause6.xml") public class Cause6ContextWithJavaConfig { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause7ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause7ContextWithJavaConfig.java similarity index 76% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause7ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause7ContextWithJavaConfig.java index 6b56519c1a..63f9826d25 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause7ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause7ContextWithJavaConfig.java @@ -1,11 +1,11 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause7") +@ComponentScan("com.baeldung.ex.beancreationexception.cause7") @ImportResource("classpath:beancreationexception_cause7.xml") public class Cause7ContextWithJavaConfig { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause8ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause8ContextWithJavaConfig.java similarity index 69% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause8ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause8ContextWithJavaConfig.java index 084cf8d3af..c6a591df2b 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause8ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause8ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause8") +@ComponentScan("com.baeldung.ex.beancreationexception.cause8") public class Cause8ContextWithJavaConfig { public Cause8ContextWithJavaConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause9ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause9ContextWithJavaConfig.java similarity index 80% rename from spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause9ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause9ContextWithJavaConfig.java index d64ec9ab3d..b9e3f4befd 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/spring/Cause9ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beancreationexception/spring/Cause9ContextWithJavaConfig.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception.spring; +package com.baeldung.ex.beancreationexception.spring; -import org.baeldung.ex.beancreationexception.cause9.BeanB; +import com.baeldung.ex.beancreationexception.cause9.BeanB; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @Configuration -@ComponentScan("org.baeldung.ex.beancreationexception.cause9") +@ComponentScan("com.baeldung.ex.beancreationexception.cause9") @ImportResource("classpath:beancreationexception_cause9.xml") public class Cause9ContextWithJavaConfig { @Autowired diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java similarity index 77% rename from spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java index a0aefda1cd..7de8a98f3b 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/cause2/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beandefinitionstoreexception.cause2; +package com.baeldung.ex.beandefinitionstoreexception.cause2; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java similarity index 74% rename from spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java index 3b6b4f2b8d..6684686b9a 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause1ContextWithJavaConfig.java @@ -1,11 +1,11 @@ -package org.baeldung.ex.beandefinitionstoreexception.spring; +package com.baeldung.ex.beandefinitionstoreexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @Configuration -@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause1") +@ComponentScan("com.baeldung.ex.beandefinitionstoreexception.cause1") @ImportResource("beans.xml") public class Cause1ContextWithJavaConfig { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java similarity index 84% rename from spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java index d31890e0f3..35f69d3321 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause2ContextWithJavaConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beandefinitionstoreexception.spring; +package com.baeldung.ex.beandefinitionstoreexception.spring; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; @@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @Configuration -@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause2") +@ComponentScan("com.baeldung.ex.beandefinitionstoreexception.cause2") public class Cause2ContextWithJavaConfig { @Value("${some.property}") diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java similarity index 68% rename from spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java index 11a00b1770..15a113ba79 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/beandefinitionstoreexception/spring/Cause3ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.beandefinitionstoreexception.spring; +package com.baeldung.ex.beandefinitionstoreexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.beandefinitionstoreexception.cause3") +@ComponentScan("com.baeldung.ex.beandefinitionstoreexception.cause3") public class Cause3ContextWithJavaConfig { public Cause3ContextWithJavaConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause1DataContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause1DataContextWithJavaConfig.java similarity index 78% rename from spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause1DataContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause1DataContextWithJavaConfig.java index c4d98176c5..4034b45b24 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause1DataContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause1DataContextWithJavaConfig.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.dataintegrityviolationexception.spring; +package com.baeldung.ex.dataintegrityviolationexception.spring; -import org.baeldung.spring.config.PersistenceConfig; +import com.baeldung.spring.config.PersistenceConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -8,7 +8,7 @@ import org.springframework.context.annotation.Import; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; @Configuration -@ComponentScan("org.baeldung.ex.dataIntegrityviolationexception.cause1") +@ComponentScan("com.baeldung.ex.dataIntegrityviolationexception.cause1") @Import(PersistenceConfig.class) public class Cause1DataContextWithJavaConfig { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause2DataContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause2DataContextWithJavaConfig.java similarity index 67% rename from spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause2DataContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause2DataContextWithJavaConfig.java index 4dcae6282c..c4c0c4570d 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause2DataContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause2DataContextWithJavaConfig.java @@ -1,12 +1,12 @@ -package org.baeldung.ex.dataintegrityviolationexception.spring; +package com.baeldung.ex.dataintegrityviolationexception.spring; -import org.baeldung.spring.config.PersistenceConfig; +import com.baeldung.spring.config.PersistenceConfig; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration -@ComponentScan("org.baeldung.ex.dataIntegrityviolationexception.cause2") +@ComponentScan("com.baeldung.ex.dataIntegrityviolationexception.cause2") @Import(PersistenceConfig.class) public class Cause2DataContextWithJavaConfig { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause3DataContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause3DataContextWithJavaConfig.java similarity index 67% rename from spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause3DataContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause3DataContextWithJavaConfig.java index bb9b905854..b4426c9224 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/dataintegrityviolationexception/spring/Cause3DataContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/dataintegrityviolationexception/spring/Cause3DataContextWithJavaConfig.java @@ -1,12 +1,12 @@ -package org.baeldung.ex.dataintegrityviolationexception.spring; +package com.baeldung.ex.dataintegrityviolationexception.spring; -import org.baeldung.spring.config.PersistenceConfig; +import com.baeldung.spring.config.PersistenceConfig; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration -@ComponentScan("org.baeldung.ex.dataIntegrityviolationexception.cause3") +@ComponentScan("com.baeldung.ex.dataIntegrityviolationexception.cause3") @Import(PersistenceConfig.class) public class Cause3DataContextWithJavaConfig { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause1/persistence/model/Foo.java b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause1/persistence/model/Foo.java similarity index 87% rename from spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause1/persistence/model/Foo.java rename to spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause1/persistence/model/Foo.java index 001c14d6d6..0eda0e7236 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause1/persistence/model/Foo.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause1/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.mappingexception.cause1.persistence.model; +package com.baeldung.ex.mappingexception.cause1.persistence.model; import java.io.Serializable; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause3/persistence/model/Foo.java b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause2/persistence/model/Foo.java similarity index 88% rename from spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause3/persistence/model/Foo.java rename to spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause2/persistence/model/Foo.java index 243196786c..602a8340df 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause3/persistence/model/Foo.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause2/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.mappingexception.cause3.persistence.model; +package com.baeldung.ex.mappingexception.cause2.persistence.model; import java.io.Serializable; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause2/persistence/model/Foo.java b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause3/persistence/model/Foo.java similarity index 88% rename from spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause2/persistence/model/Foo.java rename to spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause3/persistence/model/Foo.java index fa1200f710..58e80d3b51 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause2/persistence/model/Foo.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause3/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.mappingexception.cause2.persistence.model; +package com.baeldung.ex.mappingexception.cause3.persistence.model; import java.io.Serializable; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause4/persistence/model/Foo.java b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause4/persistence/model/Foo.java similarity index 88% rename from spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause4/persistence/model/Foo.java rename to spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause4/persistence/model/Foo.java index 11e71edf01..82674514fc 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/cause4/persistence/model/Foo.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/cause4/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.mappingexception.cause4.persistence.model; +package com.baeldung.ex.mappingexception.cause4.persistence.model; import java.io.Serializable; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause1PersistenceConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause1PersistenceConfig.java similarity index 94% rename from spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause1PersistenceConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause1PersistenceConfig.java index 11dff24e48..d2929e3d91 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause1PersistenceConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause1PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.mappingexception.spring; +package com.baeldung.ex.mappingexception.spring; import java.util.Properties; @@ -21,7 +21,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-mysql.properties" }) -@ComponentScan({ "org.baeldung.ex.mappingexception.cause1.persistence" }) +@ComponentScan({ "com.baeldung.ex.mappingexception.cause1.persistence" }) public class Cause1PersistenceConfig { @Autowired @@ -35,7 +35,7 @@ public class Cause1PersistenceConfig { public LocalSessionFactoryBean sessionFactory() { final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "org.baeldung.ex.mappingexception.cause1.persistence.model" }); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.ex.mappingexception.cause1.persistence.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause2PersistenceConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause2PersistenceConfig.java similarity index 94% rename from spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause2PersistenceConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause2PersistenceConfig.java index d1d6408934..399238073c 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause2PersistenceConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause2PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.mappingexception.spring; +package com.baeldung.ex.mappingexception.spring; import java.util.Properties; @@ -21,7 +21,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-mysql.properties" }) -@ComponentScan({ "org.baeldung.ex.mappingexception.cause2.persistence" }) +@ComponentScan({ "com.baeldung.ex.mappingexception.cause2.persistence" }) public class Cause2PersistenceConfig { @Autowired @@ -37,7 +37,7 @@ public class Cause2PersistenceConfig { sessionFactory.setDataSource(restDataSource()); sessionFactory.setHibernateProperties(hibernateProperties()); - // sessionFactory.setPackagesToScan(new String[] { "org.baeldung.ex.mappingexception.cause2.persistence.model" }); + // sessionFactory.setPackagesToScan(new String[] { "com.baeldung.ex.mappingexception.cause2.persistence.model" }); // sessionFactory.setAnnotatedClasses(new Class[] { Foo.class }); return sessionFactory; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause3PersistenceConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause3PersistenceConfig.java similarity index 92% rename from spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause3PersistenceConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause3PersistenceConfig.java index d4245e8e45..f5191d52f2 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/mappingexception/spring/Cause3PersistenceConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/mappingexception/spring/Cause3PersistenceConfig.java @@ -1,11 +1,11 @@ -package org.baeldung.ex.mappingexception.spring; +package com.baeldung.ex.mappingexception.spring; import java.util.Properties; import javax.sql.DataSource; import org.apache.tomcat.dbcp.dbcp.BasicDataSource; -import org.baeldung.ex.mappingexception.cause3.persistence.model.Foo; +import com.baeldung.ex.mappingexception.cause3.persistence.model.Foo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -22,7 +22,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-mysql.properties" }) -@ComponentScan({ "org.baeldung.ex.mappingexception.cause2.persistence" }) +@ComponentScan({ "com.baeldung.ex.mappingexception.cause2.persistence" }) public class Cause3PersistenceConfig { @Autowired @@ -38,7 +38,7 @@ public class Cause3PersistenceConfig { sessionFactory.setDataSource(restDataSource()); sessionFactory.setHibernateProperties(hibernateProperties()); - // sessionFactory.setPackagesToScan(new String[] { "org.baeldung.ex.mappingexception.cause2.persistence.model" }); + // sessionFactory.setPackagesToScan(new String[] { "com.baeldung.ex.mappingexception.cause2.persistence.model" }); sessionFactory.setAnnotatedClasses(new Class[] { Foo.class }); return sessionFactory; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause1NonTransientConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause1NonTransientConfig.java similarity index 94% rename from spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause1NonTransientConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause1NonTransientConfig.java index 3337e4796d..118cb5da90 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause1NonTransientConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause1NonTransientConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.nontransientexception.cause; +package com.baeldung.ex.nontransientexception.cause; import java.util.Properties; @@ -21,7 +21,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-derby.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence" }) public class Cause1NonTransientConfig { @Autowired @@ -35,7 +35,7 @@ public class Cause1NonTransientConfig { public LocalSessionFactoryBean sessionFactory() { final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause4NonTransientConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause4NonTransientConfig.java similarity index 94% rename from spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause4NonTransientConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause4NonTransientConfig.java index 3543526f37..e79266e9ee 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause4NonTransientConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause4NonTransientConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.nontransientexception.cause; +package com.baeldung.ex.nontransientexception.cause; import java.util.Properties; @@ -21,7 +21,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-derby.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence" }) public class Cause4NonTransientConfig { @Autowired @@ -35,7 +35,7 @@ public class Cause4NonTransientConfig { public LocalSessionFactoryBean sessionFactory() { final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause5NonTransientConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause5NonTransientConfig.java similarity index 94% rename from spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause5NonTransientConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause5NonTransientConfig.java index 6d5d998c5b..784b36afbf 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nontransientexception/cause/Cause5NonTransientConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nontransientexception/cause/Cause5NonTransientConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.nontransientexception.cause; +package com.baeldung.ex.nontransientexception.cause; import java.util.Properties; @@ -21,7 +21,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-mysql-incorrect.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence" }) public class Cause5NonTransientConfig { @Autowired @@ -35,7 +35,7 @@ public class Cause5NonTransientConfig { public LocalSessionFactoryBean sessionFactory() { final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanA.java similarity index 75% rename from spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanA.java index c664309426..3832d6e61a 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.cause1; +package com.baeldung.ex.nosuchbeandefinitionexception.cause1; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanB.java new file mode 100644 index 0000000000..49915c37d7 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanB.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.nosuchbeandefinitionexception.cause1; + +public class BeanB { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanA.java similarity index 75% rename from spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanA.java index 2b454bfabb..19409820ea 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.cause2; +package com.baeldung.ex.nosuchbeandefinitionexception.cause2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB1.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB1.java similarity index 63% rename from spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB1.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB1.java index 877f400668..6b5fbb7c3e 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB1.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB1.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.cause2; +package com.baeldung.ex.nosuchbeandefinitionexception.cause2; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB2.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB2.java similarity index 63% rename from spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB2.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB2.java index 6bf4160966..0f0bcb8f7d 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB2.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/BeanB2.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.cause2; +package com.baeldung.ex.nosuchbeandefinitionexception.cause2; import org.springframework.stereotype.Component; diff --git a/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/IBeanB.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/IBeanB.java new file mode 100644 index 0000000000..b8acb7faa6 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause2/IBeanB.java @@ -0,0 +1,5 @@ +package com.baeldung.ex.nosuchbeandefinitionexception.cause2; + +public interface IBeanB { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause3/BeanA.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause3/BeanA.java similarity index 87% rename from spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause3/BeanA.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause3/BeanA.java index 091d3f1aa8..c094362629 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause3/BeanA.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/cause3/BeanA.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.cause3; +package com.baeldung.ex.nosuchbeandefinitionexception.cause3; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause1ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause1ContextWithJavaConfig.java similarity index 68% rename from spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause1ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause1ContextWithJavaConfig.java index 5ba971baa9..026ccc532b 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause1ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause1ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.spring; +package com.baeldung.ex.nosuchbeandefinitionexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.nosuchbeandefinitionexception.cause1") +@ComponentScan("com.baeldung.ex.nosuchbeandefinitionexception.cause1") public class Cause1ContextWithJavaConfig { public Cause1ContextWithJavaConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause2ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause2ContextWithJavaConfig.java similarity index 68% rename from spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause2ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause2ContextWithJavaConfig.java index 9f4816ef7c..30da7f2119 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause2ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause2ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.spring; +package com.baeldung.ex.nosuchbeandefinitionexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.nosuchbeandefinitionexception.cause2") +@ComponentScan("com.baeldung.ex.nosuchbeandefinitionexception.cause2") public class Cause2ContextWithJavaConfig { public Cause2ContextWithJavaConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause3ContextWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause3ContextWithJavaConfig.java similarity index 68% rename from spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause3ContextWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause3ContextWithJavaConfig.java index a8d0fbe37b..e36c2e4eab 100644 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/spring/Cause3ContextWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/ex/nosuchbeandefinitionexception/spring/Cause3ContextWithJavaConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.spring; +package com.baeldung.ex.nosuchbeandefinitionexception.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.ex.nosuchbeandefinitionexception.cause3") +@ComponentScan("com.baeldung.ex.nosuchbeandefinitionexception.cause3") public class Cause3ContextWithJavaConfig { public Cause3ContextWithJavaConfig() { diff --git a/spring-core-2/src/main/java/org/baeldung/persistence/Setup.java b/spring-exceptions/src/main/java/com/baeldung/persistence/Setup.java similarity index 94% rename from spring-core-2/src/main/java/org/baeldung/persistence/Setup.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/Setup.java index 5cba4e70fb..251ea4654c 100644 --- a/spring-core-2/src/main/java/org/baeldung/persistence/Setup.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/Setup.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence; +package com.baeldung.persistence; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/common/AbstractHibernateDao.java b/spring-exceptions/src/main/java/com/baeldung/persistence/common/AbstractHibernateDao.java similarity index 97% rename from spring-exceptions/src/main/java/org/baeldung/persistence/common/AbstractHibernateDao.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/common/AbstractHibernateDao.java index cadb2ac061..90e4249c68 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/common/AbstractHibernateDao.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/common/AbstractHibernateDao.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.common; +package com.baeldung.persistence.common; import java.io.Serializable; import java.util.List; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/common/AbstractService.java b/spring-exceptions/src/main/java/com/baeldung/persistence/common/AbstractService.java similarity index 90% rename from spring-exceptions/src/main/java/org/baeldung/persistence/common/AbstractService.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/common/AbstractService.java index d2e162ad7b..5e1cdcba17 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/common/AbstractService.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/common/AbstractService.java @@ -1,9 +1,8 @@ -package org.baeldung.persistence.common; +package com.baeldung.persistence.common; import java.io.Serializable; import java.util.List; -import org.baeldung.persistence.common.IOperations; import org.springframework.transaction.annotation.Transactional; @Transactional diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/common/IOperations.java b/spring-exceptions/src/main/java/com/baeldung/persistence/common/IOperations.java similarity index 88% rename from spring-exceptions/src/main/java/org/baeldung/persistence/common/IOperations.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/common/IOperations.java index dee27950c7..feac025a6d 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/common/IOperations.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/common/IOperations.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.common; +package com.baeldung.persistence.common; import java.io.Serializable; import java.util.List; diff --git a/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IChildDao.java b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IChildDao.java new file mode 100644 index 0000000000..b662be5da3 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IChildDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.model.Child; + +public interface IChildDao extends IOperations { + // +} diff --git a/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IFooDao.java new file mode 100644 index 0000000000..131cd04768 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IFooDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.model.Foo; + +public interface IFooDao extends IOperations { + // +} diff --git a/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IParentDao.java b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IParentDao.java new file mode 100644 index 0000000000..63b39c05c2 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/IParentDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.model.Parent; + +public interface IParentDao extends IOperations { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/ChildDao.java b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java similarity index 67% rename from spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/ChildDao.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java index e068573c5c..428189f522 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/ChildDao.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java @@ -1,8 +1,8 @@ -package org.baeldung.persistence.dao.impl; +package com.baeldung.persistence.dao.impl; -import org.baeldung.persistence.common.AbstractHibernateDao; -import org.baeldung.persistence.dao.IChildDao; -import org.baeldung.persistence.model.Child; +import com.baeldung.persistence.common.AbstractHibernateDao; +import com.baeldung.persistence.model.Child; +import com.baeldung.persistence.dao.IChildDao; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/FooDao.java b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java similarity index 66% rename from spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/FooDao.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java index baf29c9ecd..2754a0e96d 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/FooDao.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java @@ -1,8 +1,8 @@ -package org.baeldung.persistence.dao.impl; +package com.baeldung.persistence.dao.impl; -import org.baeldung.persistence.common.AbstractHibernateDao; -import org.baeldung.persistence.dao.IFooDao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.common.AbstractHibernateDao; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.model.Foo; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/ParentDao.java b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java similarity index 67% rename from spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/ParentDao.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java index 5634137b63..c1551b9f2e 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/impl/ParentDao.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java @@ -1,8 +1,8 @@ -package org.baeldung.persistence.dao.impl; +package com.baeldung.persistence.dao.impl; -import org.baeldung.persistence.common.AbstractHibernateDao; -import org.baeldung.persistence.dao.IParentDao; -import org.baeldung.persistence.model.Parent; +import com.baeldung.persistence.common.AbstractHibernateDao; +import com.baeldung.persistence.model.Parent; +import com.baeldung.persistence.dao.IParentDao; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/model/Child.java b/spring-exceptions/src/main/java/com/baeldung/persistence/model/Child.java similarity index 95% rename from spring-exceptions/src/main/java/org/baeldung/persistence/model/Child.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/model/Child.java index 4eec4cf1d3..19cfb2e237 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/model/Child.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/model/Child.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/model/Foo.java b/spring-exceptions/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 97% rename from spring-exceptions/src/main/java/org/baeldung/persistence/model/Foo.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/model/Foo.java index 8e1dee33e8..9af3d07bed 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/model/Parent.java b/spring-exceptions/src/main/java/com/baeldung/persistence/model/Parent.java similarity index 96% rename from spring-exceptions/src/main/java/org/baeldung/persistence/model/Parent.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/model/Parent.java index 19e405615d..fa6948990b 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/model/Parent.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/model/Parent.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; diff --git a/spring-exceptions/src/main/java/com/baeldung/persistence/service/IChildService.java b/spring-exceptions/src/main/java/com/baeldung/persistence/service/IChildService.java new file mode 100644 index 0000000000..e7af073a4d --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/service/IChildService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.model.Child; + +public interface IChildService extends IOperations { + // +} diff --git a/spring-exceptions/src/main/java/com/baeldung/persistence/service/IFooService.java b/spring-exceptions/src/main/java/com/baeldung/persistence/service/IFooService.java new file mode 100644 index 0000000000..f154391bb5 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/service/IFooService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.model.Foo; + +public interface IFooService extends IOperations { + // +} diff --git a/spring-exceptions/src/main/java/com/baeldung/persistence/service/IParentService.java b/spring-exceptions/src/main/java/com/baeldung/persistence/service/IParentService.java new file mode 100644 index 0000000000..1c7ee45219 --- /dev/null +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/service/IParentService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.model.Parent; + +public interface IParentService extends IOperations { + // +} diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/ChildService.java b/spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/ChildService.java similarity index 56% rename from spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/ChildService.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/ChildService.java index 89597313ea..ed913188f1 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/ChildService.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/ChildService.java @@ -1,10 +1,10 @@ -package org.baeldung.persistence.service.impl; +package com.baeldung.persistence.service.impl; -import org.baeldung.persistence.common.AbstractService; -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.dao.IChildDao; -import org.baeldung.persistence.model.Child; -import org.baeldung.persistence.service.IChildService; +import com.baeldung.persistence.common.AbstractService; +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.service.IChildService; +import com.baeldung.persistence.dao.IChildDao; +import com.baeldung.persistence.model.Child; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/FooService.java b/spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/FooService.java similarity index 56% rename from spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/FooService.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/FooService.java index f0a4d7a649..d3d7fe81c8 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/FooService.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/FooService.java @@ -1,10 +1,10 @@ -package org.baeldung.persistence.service.impl; +package com.baeldung.persistence.service.impl; -import org.baeldung.persistence.common.AbstractService; -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.dao.IFooDao; -import org.baeldung.persistence.model.Foo; -import org.baeldung.persistence.service.IFooService; +import com.baeldung.persistence.common.AbstractService; +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.model.Foo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/ParentService.java b/spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/ParentService.java similarity index 57% rename from spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/ParentService.java rename to spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/ParentService.java index 97c44f4a2f..b7fa75a716 100644 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/service/impl/ParentService.java +++ b/spring-exceptions/src/main/java/com/baeldung/persistence/service/impl/ParentService.java @@ -1,10 +1,10 @@ -package org.baeldung.persistence.service.impl; +package com.baeldung.persistence.service.impl; -import org.baeldung.persistence.common.AbstractService; -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.dao.IParentDao; -import org.baeldung.persistence.model.Parent; -import org.baeldung.persistence.service.IParentService; +import com.baeldung.persistence.common.AbstractService; +import com.baeldung.persistence.common.IOperations; +import com.baeldung.persistence.model.Parent; +import com.baeldung.persistence.service.IParentService; +import com.baeldung.persistence.dao.IParentDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/spring-exceptions/src/main/java/org/baeldung/properties/core/ComponentInXmlUsingProperties.java b/spring-exceptions/src/main/java/com/baeldung/properties/core/ComponentInXmlUsingProperties.java similarity index 95% rename from spring-exceptions/src/main/java/org/baeldung/properties/core/ComponentInXmlUsingProperties.java rename to spring-exceptions/src/main/java/com/baeldung/properties/core/ComponentInXmlUsingProperties.java index f695326cd6..35f54b90e5 100644 --- a/spring-exceptions/src/main/java/org/baeldung/properties/core/ComponentInXmlUsingProperties.java +++ b/spring-exceptions/src/main/java/com/baeldung/properties/core/ComponentInXmlUsingProperties.java @@ -1,4 +1,4 @@ -package org.baeldung.properties.core; +package com.baeldung.properties.core; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/main/java/org/baeldung/properties/core/ComponentUsingProperties.java b/spring-exceptions/src/main/java/com/baeldung/properties/core/ComponentUsingProperties.java similarity index 95% rename from spring-exceptions/src/main/java/org/baeldung/properties/core/ComponentUsingProperties.java rename to spring-exceptions/src/main/java/com/baeldung/properties/core/ComponentUsingProperties.java index 7e082702fe..ff6e11d453 100644 --- a/spring-exceptions/src/main/java/org/baeldung/properties/core/ComponentUsingProperties.java +++ b/spring-exceptions/src/main/java/com/baeldung/properties/core/ComponentUsingProperties.java @@ -1,4 +1,4 @@ -package org.baeldung.properties.core; +package com.baeldung.properties.core; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfig.java b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithJavaConfig.java similarity index 88% rename from spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfig.java rename to spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithJavaConfig.java index 9b5d7ed047..80c17ef059 100644 --- a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithJavaConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.properties.spring; +package com.baeldung.properties.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -7,7 +7,7 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @Configuration -@ComponentScan("org.baeldung.properties.core") +@ComponentScan("com.baeldung.properties.core") @PropertySource("classpath:foo.properties") public class PropertiesWithJavaConfig { diff --git a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfigOther.java b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithJavaConfigOther.java similarity index 88% rename from spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfigOther.java rename to spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithJavaConfigOther.java index 594ba0a09d..54d7814045 100644 --- a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfigOther.java +++ b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithJavaConfigOther.java @@ -1,4 +1,4 @@ -package org.baeldung.properties.spring; +package com.baeldung.properties.spring; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; diff --git a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfig.java b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfig.java similarity index 82% rename from spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfig.java rename to spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfig.java index 9ad7febcb0..2a774f449f 100644 --- a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.properties.spring; +package com.baeldung.properties.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -6,7 +6,7 @@ import org.springframework.context.annotation.ImportResource; @Configuration @ImportResource("classpath:configForProperties.xml") -@ComponentScan("org.baeldung.core") +@ComponentScan("com.baeldung.core") public class PropertiesWithXmlConfig { public PropertiesWithXmlConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfigOne.java b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfigOne.java similarity index 82% rename from spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfigOne.java rename to spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfigOne.java index 9061cc10d4..205741d22b 100644 --- a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfigOne.java +++ b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfigOne.java @@ -1,4 +1,4 @@ -package org.baeldung.properties.spring; +package com.baeldung.properties.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -6,7 +6,7 @@ import org.springframework.context.annotation.ImportResource; @Configuration @ImportResource("classpath:configForPropertiesOne.xml") -@ComponentScan("org.baeldung.core") +@ComponentScan("com.baeldung.core") public class PropertiesWithXmlConfigOne { public PropertiesWithXmlConfigOne() { diff --git a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfigTwo.java b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfigTwo.java similarity index 88% rename from spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfigTwo.java rename to spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfigTwo.java index e4365cbc8b..98f64eb94d 100644 --- a/spring-exceptions/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfigTwo.java +++ b/spring-exceptions/src/main/java/com/baeldung/properties/spring/PropertiesWithXmlConfigTwo.java @@ -1,4 +1,4 @@ -package org.baeldung.properties.spring; +package com.baeldung.properties.spring; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; diff --git a/spring-exceptions/src/main/java/org/baeldung/spring/config/CoreConfig.java b/spring-exceptions/src/main/java/com/baeldung/spring/config/CoreConfig.java similarity index 82% rename from spring-exceptions/src/main/java/org/baeldung/spring/config/CoreConfig.java rename to spring-exceptions/src/main/java/com/baeldung/spring/config/CoreConfig.java index ff1742351b..8c51378ca9 100644 --- a/spring-exceptions/src/main/java/org/baeldung/spring/config/CoreConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/spring/config/CoreConfig.java @@ -1,11 +1,11 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration -@ComponentScan("org.baeldung.core") +@ComponentScan("com.baeldung.core") public class CoreConfig extends WebMvcConfigurerAdapter { public CoreConfig() { diff --git a/spring-exceptions/src/main/java/org/baeldung/spring/config/MainWebAppInitializer.java b/spring-exceptions/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java similarity index 95% rename from spring-exceptions/src/main/java/org/baeldung/spring/config/MainWebAppInitializer.java rename to spring-exceptions/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java index 5ef83b8afd..3aaa1c8aee 100644 --- a/spring-exceptions/src/main/java/org/baeldung/spring/config/MainWebAppInitializer.java +++ b/spring-exceptions/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import java.util.Set; @@ -23,7 +23,7 @@ public class MainWebAppInitializer implements WebApplicationInitializer { // Create the 'root' Spring application context final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); - root.scan("org.baeldung.spring.config"); + root.scan("com.baeldung.spring.config"); // root.getEnvironment().setDefaultProfiles("embedded"); // Manages the lifecycle of the root application context diff --git a/spring-exceptions/src/main/java/org/baeldung/spring/config/MvcConfig.java b/spring-exceptions/src/main/java/com/baeldung/spring/config/MvcConfig.java similarity index 96% rename from spring-exceptions/src/main/java/org/baeldung/spring/config/MvcConfig.java rename to spring-exceptions/src/main/java/com/baeldung/spring/config/MvcConfig.java index f87e400fce..717e3c9356 100644 --- a/spring-exceptions/src/main/java/org/baeldung/spring/config/MvcConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/spring/config/MvcConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-exceptions/src/main/java/org/baeldung/spring/config/PersistenceConfig.java b/spring-exceptions/src/main/java/com/baeldung/spring/config/PersistenceConfig.java similarity index 95% rename from spring-exceptions/src/main/java/org/baeldung/spring/config/PersistenceConfig.java rename to spring-exceptions/src/main/java/com/baeldung/spring/config/PersistenceConfig.java index 4fb3fdacd5..0a31b158d9 100644 --- a/spring-exceptions/src/main/java/org/baeldung/spring/config/PersistenceConfig.java +++ b/spring-exceptions/src/main/java/com/baeldung/spring/config/PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.config; +package com.baeldung.spring.config; import java.util.Properties; @@ -21,7 +21,7 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-mysql.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence" }) public class PersistenceConfig { @Autowired @@ -35,7 +35,7 @@ public class PersistenceConfig { public LocalSessionFactoryBean sessionFactory() { final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause1/BeanB.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause1/BeanB.java deleted file mode 100644 index 8b4b17a0c6..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause1/BeanB.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause1; - -public class BeanB { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/IBeanB.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/IBeanB.java deleted file mode 100644 index 60e8a0a429..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause2/IBeanB.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause2; - -public interface IBeanB { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause4/IBeanA.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause4/IBeanA.java deleted file mode 100644 index 2f25c1c365..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause4/IBeanA.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause4; - -public interface IBeanA { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause5/IBeanA.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause5/IBeanA.java deleted file mode 100644 index 5c575e400c..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause5/IBeanA.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause5; - -public interface IBeanA { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/IBeanB.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/IBeanB.java deleted file mode 100644 index 36b436ce98..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause6/IBeanB.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause6; - -public interface IBeanB { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/IBeanA.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/IBeanA.java deleted file mode 100644 index 3d6c4eef28..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/IBeanA.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause8; - -public interface IBeanA { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/IBeanB.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/IBeanB.java deleted file mode 100644 index 5f6f438968..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause8/IBeanB.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause8; - -public interface IBeanB { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/BeanB.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/BeanB.java deleted file mode 100644 index 5e076023f0..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/BeanB.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause9; - -public class BeanB { - // -} \ No newline at end of file diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/IBeanA.java b/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/IBeanA.java deleted file mode 100644 index 82114b18da..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/beancreationexception/cause9/IBeanA.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.beancreationexception.cause9; - -public interface IBeanA { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanB.java b/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanB.java deleted file mode 100644 index 8a198422e8..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause1/BeanB.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.cause1; - -public class BeanB { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/IBeanB.java b/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/IBeanB.java deleted file mode 100644 index 3e70126c1a..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/ex/nosuchbeandefinitionexception/cause2/IBeanB.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.ex.nosuchbeandefinitionexception.cause2; - -public interface IBeanB { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IChildDao.java b/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IChildDao.java deleted file mode 100644 index 25290554f3..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IChildDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.baeldung.persistence.dao; - -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.model.Child; - -public interface IChildDao extends IOperations { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IFooDao.java b/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IFooDao.java deleted file mode 100644 index b41cd9edde..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IFooDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.baeldung.persistence.dao; - -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.model.Foo; - -public interface IFooDao extends IOperations { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IParentDao.java b/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IParentDao.java deleted file mode 100644 index a047d97ef1..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/dao/IParentDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.baeldung.persistence.dao; - -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.model.Parent; - -public interface IParentDao extends IOperations { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/service/IChildService.java b/spring-exceptions/src/main/java/org/baeldung/persistence/service/IChildService.java deleted file mode 100644 index e2c2055ca2..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/service/IChildService.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.baeldung.persistence.service; - -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.model.Child; - -public interface IChildService extends IOperations { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/service/IFooService.java b/spring-exceptions/src/main/java/org/baeldung/persistence/service/IFooService.java deleted file mode 100644 index 64b826db02..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/service/IFooService.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.baeldung.persistence.service; - -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.model.Foo; - -public interface IFooService extends IOperations { - // -} diff --git a/spring-exceptions/src/main/java/org/baeldung/persistence/service/IParentService.java b/spring-exceptions/src/main/java/org/baeldung/persistence/service/IParentService.java deleted file mode 100644 index a05f07658f..0000000000 --- a/spring-exceptions/src/main/java/org/baeldung/persistence/service/IParentService.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.baeldung.persistence.service; - -import org.baeldung.persistence.common.IOperations; -import org.baeldung.persistence.model.Parent; - -public interface IParentService extends IOperations { - // -} diff --git a/spring-exceptions/src/main/resources/beancreationexception_cause4.xml b/spring-exceptions/src/main/resources/beancreationexception_cause4.xml index ad7edc3763..47f55db2d7 100644 --- a/spring-exceptions/src/main/resources/beancreationexception_cause4.xml +++ b/spring-exceptions/src/main/resources/beancreationexception_cause4.xml @@ -6,6 +6,6 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd"> - + \ No newline at end of file diff --git a/spring-exceptions/src/main/resources/beancreationexception_cause6.xml b/spring-exceptions/src/main/resources/beancreationexception_cause6.xml index fe60786151..fdfed069f0 100644 --- a/spring-exceptions/src/main/resources/beancreationexception_cause6.xml +++ b/spring-exceptions/src/main/resources/beancreationexception_cause6.xml @@ -6,7 +6,7 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd"> - + diff --git a/spring-exceptions/src/main/resources/beancreationexception_cause7.xml b/spring-exceptions/src/main/resources/beancreationexception_cause7.xml index d8ef7dd18c..29b7bab317 100644 --- a/spring-exceptions/src/main/resources/beancreationexception_cause7.xml +++ b/spring-exceptions/src/main/resources/beancreationexception_cause7.xml @@ -6,6 +6,6 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd"> - + \ No newline at end of file diff --git a/spring-exceptions/src/main/resources/beancreationexception_cause9.xml b/spring-exceptions/src/main/resources/beancreationexception_cause9.xml index 5d658f819f..b059ec67c3 100644 --- a/spring-exceptions/src/main/resources/beancreationexception_cause9.xml +++ b/spring-exceptions/src/main/resources/beancreationexception_cause9.xml @@ -6,6 +6,6 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd"> - + \ No newline at end of file diff --git a/spring-exceptions/src/main/resources/configForProperties.xml b/spring-exceptions/src/main/resources/configForProperties.xml index 0f766665eb..e61d883c70 100644 --- a/spring-exceptions/src/main/resources/configForProperties.xml +++ b/spring-exceptions/src/main/resources/configForProperties.xml @@ -9,7 +9,7 @@ - + diff --git a/spring-exceptions/src/main/resources/configForPropertiesOne.xml b/spring-exceptions/src/main/resources/configForPropertiesOne.xml index 068c86a840..53072d89bb 100644 --- a/spring-exceptions/src/main/resources/configForPropertiesOne.xml +++ b/spring-exceptions/src/main/resources/configForPropertiesOne.xml @@ -9,7 +9,7 @@ - + diff --git a/spring-exceptions/src/main/webapp/WEB-INF/web_old.xml b/spring-exceptions/src/main/webapp/WEB-INF/web_old.xml index 016369ad27..c8b38fae30 100644 --- a/spring-exceptions/src/main/webapp/WEB-INF/web_old.xml +++ b/spring-exceptions/src/main/webapp/WEB-INF/web_old.xml @@ -16,7 +16,7 @@ contextConfigLocation - org.baeldung.spring.web.config + com.baeldung.spring.web.config diff --git a/spring-exceptions/src/test/java/org/baeldung/SpringContextLiveTest.java b/spring-exceptions/src/test/java/com/baeldung/SpringContextLiveTest.java similarity index 87% rename from spring-exceptions/src/test/java/org/baeldung/SpringContextLiveTest.java rename to spring-exceptions/src/test/java/com/baeldung/SpringContextLiveTest.java index ece7e0e730..a9ba0cf5c1 100644 --- a/spring-exceptions/src/test/java/org/baeldung/SpringContextLiveTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/SpringContextLiveTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.config.PersistenceConfig; +import com.baeldung.spring.config.PersistenceConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java similarity index 93% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java index 9597c09568..81fb4770ac 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java @@ -1,4 +1,4 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; import org.junit.runner.RunWith; import org.junit.runners.Suite; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java index 350347bb19..441e17cf98 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause1ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause1ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java index c2b9561848..6b760d4fbe 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause2ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause2ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java index 7b9b49bf58..83935c2e2e 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause3ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause3ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java index 3a6e30476c..0e4d83e929 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause4ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause4ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java index e69a323f8d..828c200a3d 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause5ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause5ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java index 30fbd47635..9bae716684 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause6ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause6ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java index d832bddf72..35606d4339 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause7ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause7ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java index a9f32b6d1a..51809af8bf 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause8ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause8ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java index 6af5fb3712..9a6cee8192 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beancreationexception; +package com.baeldung.ex.beancreationexception; -import org.baeldung.ex.beancreationexception.spring.Cause9ContextWithJavaConfig; +import com.baeldung.ex.beancreationexception.spring.Cause9ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java similarity index 83% rename from spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java index 1580546fa7..f5c3cc1ed8 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beandefinitionstoreexception; +package com.baeldung.ex.beandefinitionstoreexception; -import org.baeldung.ex.beandefinitionstoreexception.spring.Cause1ContextWithJavaConfig; +import com.baeldung.ex.beandefinitionstoreexception.spring.Cause1ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java similarity index 83% rename from spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java index ce0db694dc..cddbb173ec 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beandefinitionstoreexception; +package com.baeldung.ex.beandefinitionstoreexception; -import org.baeldung.ex.beandefinitionstoreexception.spring.Cause2ContextWithJavaConfig; +import com.baeldung.ex.beandefinitionstoreexception.spring.Cause2ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java similarity index 83% rename from spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java index c090ac7b5f..a5c458be9f 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.beandefinitionstoreexception; +package com.baeldung.ex.beandefinitionstoreexception; -import org.baeldung.ex.beandefinitionstoreexception.spring.Cause3ContextWithJavaConfig; +import com.baeldung.ex.beandefinitionstoreexception.spring.Cause3ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java similarity index 82% rename from spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java index 056e052359..e41f916000 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.dataintegrityviolationexception; +package com.baeldung.ex.dataintegrityviolationexception; -import org.baeldung.ex.dataintegrityviolationexception.spring.Cause1DataContextWithJavaConfig; -import org.baeldung.persistence.model.Child; -import org.baeldung.persistence.model.Parent; -import org.baeldung.persistence.service.IChildService; -import org.baeldung.persistence.service.IParentService; +import com.baeldung.ex.dataintegrityviolationexception.spring.Cause1DataContextWithJavaConfig; +import com.baeldung.persistence.model.Child; +import com.baeldung.persistence.model.Parent; +import com.baeldung.persistence.service.IChildService; +import com.baeldung.persistence.service.IParentService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java similarity index 80% rename from spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java index e36a027105..b41cead90d 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java @@ -1,8 +1,8 @@ -package org.baeldung.ex.dataintegrityviolationexception; +package com.baeldung.ex.dataintegrityviolationexception; -import org.baeldung.ex.dataintegrityviolationexception.spring.Cause2DataContextWithJavaConfig; -import org.baeldung.persistence.model.Foo; -import org.baeldung.persistence.service.IFooService; +import com.baeldung.ex.dataintegrityviolationexception.spring.Cause2DataContextWithJavaConfig; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java similarity index 82% rename from spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java index 4194e1c9fe..c41321c144 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.dataintegrityviolationexception; +package com.baeldung.ex.dataintegrityviolationexception; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import org.baeldung.ex.dataintegrityviolationexception.spring.Cause3DataContextWithJavaConfig; -import org.baeldung.persistence.model.Foo; -import org.baeldung.persistence.service.IFooService; +import com.baeldung.ex.dataintegrityviolationexception.spring.Cause3DataContextWithJavaConfig; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java similarity index 85% rename from spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java index 7ba9618a77..b00b9d7257 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java @@ -1,7 +1,7 @@ -package org.baeldung.ex.mappingexception; +package com.baeldung.ex.mappingexception; -import org.baeldung.ex.mappingexception.cause1.persistence.model.Foo; -import org.baeldung.ex.mappingexception.spring.Cause1PersistenceConfig; +import com.baeldung.ex.mappingexception.cause1.persistence.model.Foo; +import com.baeldung.ex.mappingexception.spring.Cause1PersistenceConfig; import org.hibernate.MappingException; import org.hibernate.SessionFactory; import org.junit.Test; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java similarity index 84% rename from spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java index 66923fc6a9..1ff4170276 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java @@ -1,7 +1,7 @@ -package org.baeldung.ex.mappingexception; +package com.baeldung.ex.mappingexception; -import org.baeldung.ex.mappingexception.cause2.persistence.model.Foo; -import org.baeldung.ex.mappingexception.spring.Cause2PersistenceConfig; +import com.baeldung.ex.mappingexception.cause2.persistence.model.Foo; +import com.baeldung.ex.mappingexception.spring.Cause2PersistenceConfig; import org.hibernate.SessionFactory; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java similarity index 85% rename from spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java index e6888d1685..54a4c9cde3 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java @@ -1,7 +1,7 @@ -package org.baeldung.ex.mappingexception; +package com.baeldung.ex.mappingexception; -import org.baeldung.ex.mappingexception.cause3.persistence.model.Foo; -import org.baeldung.ex.mappingexception.spring.Cause3PersistenceConfig; +import com.baeldung.ex.mappingexception.cause3.persistence.model.Foo; +import com.baeldung.ex.mappingexception.spring.Cause3PersistenceConfig; import org.hibernate.MappingException; import org.hibernate.SessionFactory; import org.junit.Test; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java similarity index 93% rename from spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java index ea90b3d6cc..7f6b765073 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.mappingexception; +package com.baeldung.ex.mappingexception; import java.io.IOException; import java.io.InputStream; import java.util.Properties; -import org.baeldung.ex.mappingexception.cause4.persistence.model.Foo; +import com.baeldung.ex.mappingexception.cause4.persistence.model.Foo; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java similarity index 74% rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java index b7ed103394..2aebf6ff42 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java @@ -1,15 +1,11 @@ -package org.baeldung.ex.nontransientdataaccessexception; +package com.baeldung.ex.nontransientdataaccessexception; import javax.sql.DataSource; -import org.baeldung.ex.nontransientexception.cause.Cause1NonTransientConfig; -import org.baeldung.ex.nontransientexception.cause.Cause5NonTransientConfig; -import org.baeldung.persistence.model.Foo; -import org.baeldung.persistence.service.IFooService; +import com.baeldung.ex.nontransientexception.cause.Cause5NonTransientConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataIntegrityViolationException; import org.springframework.jdbc.CannotGetJdbcConnectionException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java similarity index 87% rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java index b98a210125..2450554055 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java @@ -1,10 +1,10 @@ -package org.baeldung.ex.nontransientdataaccessexception; +package com.baeldung.ex.nontransientdataaccessexception; import javax.sql.DataSource; -import org.baeldung.ex.nontransientexception.cause.Cause1NonTransientConfig; -import org.baeldung.persistence.model.Foo; -import org.baeldung.persistence.service.IFooService; +import com.baeldung.ex.nontransientexception.cause.Cause1NonTransientConfig; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java similarity index 92% rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java index 122278580f..8f0d6d60cc 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java @@ -1,9 +1,9 @@ -package org.baeldung.ex.nontransientdataaccessexception; +package com.baeldung.ex.nontransientdataaccessexception; import javax.sql.DataSource; -import org.baeldung.ex.nontransientexception.cause.Cause1NonTransientConfig; -import org.baeldung.persistence.model.Foo; +import com.baeldung.ex.nontransientexception.cause.Cause1NonTransientConfig; +import com.baeldung.persistence.model.Foo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java similarity index 89% rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java index 4da5f94098..508fb77e61 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java @@ -1,8 +1,8 @@ -package org.baeldung.ex.nontransientdataaccessexception; +package com.baeldung.ex.nontransientdataaccessexception; import javax.sql.DataSource; -import org.baeldung.ex.nontransientexception.cause.Cause4NonTransientConfig; +import com.baeldung.ex.nontransientexception.cause.Cause4NonTransientConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java similarity index 90% rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java index fc420acfe9..3e64f69884 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java @@ -1,7 +1,7 @@ -package org.baeldung.ex.nontransientdataaccessexception; +package com.baeldung.ex.nontransientdataaccessexception; -import org.baeldung.ex.nontransientexception.cause.Cause1NonTransientConfig; -import org.baeldung.persistence.service.IFooService; +import com.baeldung.ex.nontransientexception.cause.Cause1NonTransientConfig; +import com.baeldung.persistence.service.IFooService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java similarity index 57% rename from spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java index 45ffdf9096..52cd2f31ea 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java @@ -1,14 +1,8 @@ -package org.baeldung.ex.nosuchbeandefinitionexception; +package com.baeldung.ex.nosuchbeandefinitionexception; -import org.baeldung.ex.nosuchbeandefinitionexception.spring.Cause1ContextWithJavaConfig; -import org.baeldung.persistence.model.Child; -import org.baeldung.persistence.model.Parent; -import org.baeldung.persistence.service.IChildService; -import org.baeldung.persistence.service.IParentService; +import com.baeldung.ex.nosuchbeandefinitionexception.spring.Cause1ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataIntegrityViolationException; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java similarity index 83% rename from spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java index 09ed2b4435..b165482ea1 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.nosuchbeandefinitionexception; +package com.baeldung.ex.nosuchbeandefinitionexception; -import org.baeldung.ex.nosuchbeandefinitionexception.spring.Cause2ContextWithJavaConfig; +import com.baeldung.ex.nosuchbeandefinitionexception.spring.Cause2ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java b/spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java similarity index 83% rename from spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java index 7dc016a568..ec0f8c8b1e 100644 --- a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.ex.nosuchbeandefinitionexception; +package com.baeldung.ex.nosuchbeandefinitionexception; -import org.baeldung.ex.nosuchbeandefinitionexception.spring.Cause3ContextWithJavaConfig; +import com.baeldung.ex.nosuchbeandefinitionexception.spring.Cause3ContextWithJavaConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaManualTest.java b/spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithJavaManualTest.java similarity index 86% rename from spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithJavaManualTest.java index 91db8210b3..e3f360e6a5 100644 --- a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithJavaManualTest.java @@ -1,7 +1,7 @@ -package org.baeldung.properties.core; +package com.baeldung.properties.core; -import org.baeldung.properties.spring.PropertiesWithJavaConfig; -import org.baeldung.properties.spring.PropertiesWithJavaConfigOther; +import com.baeldung.properties.spring.PropertiesWithJavaConfig; +import com.baeldung.properties.spring.PropertiesWithJavaConfigOther; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java b/spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java similarity index 86% rename from spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java index 201e554381..b63cd74646 100644 --- a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java @@ -1,7 +1,7 @@ -package org.baeldung.properties.core; +package com.baeldung.properties.core; -import org.baeldung.properties.spring.PropertiesWithXmlConfigOne; -import org.baeldung.properties.spring.PropertiesWithXmlConfigTwo; +import com.baeldung.properties.spring.PropertiesWithXmlConfigOne; +import com.baeldung.properties.spring.PropertiesWithXmlConfigTwo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlManualTest.java b/spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithXmlManualTest.java similarity index 90% rename from spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlManualTest.java rename to spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithXmlManualTest.java index a54dd8a3fb..b848dab75f 100644 --- a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlManualTest.java +++ b/spring-exceptions/src/test/java/com/baeldung/properties/core/PropertiesWithXmlManualTest.java @@ -1,6 +1,6 @@ -package org.baeldung.properties.core; +package com.baeldung.properties.core; -import org.baeldung.properties.spring.PropertiesWithXmlConfig; +import com.baeldung.properties.spring.PropertiesWithXmlConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-integration/pom.xml b/spring-integration/pom.xml index ebdde5a1ee..a985f55d89 100644 --- a/spring-integration/pom.xml +++ b/spring-integration/pom.xml @@ -85,7 +85,7 @@ com.h2database h2 - 1.4.197 + ${h2.version} @@ -124,6 +124,7 @@ 1.1.1 2.10 1.5.0 + 1.4.197 diff --git a/spring-jms/pom.xml b/spring-jms/pom.xml index a0d2625477..9cd9126fac 100644 --- a/spring-jms/pom.xml +++ b/spring-jms/pom.xml @@ -38,7 +38,7 @@ org.springframework.boot spring-boot-starter-test - 1.5.10.RELEASE + ${spring-boot-test.version} test @@ -64,6 +64,7 @@ 4.3.4.RELEASE 5.14.1 + 1.5.10.RELEASE diff --git a/spring-mvc-basics-2/.gitignore b/spring-mvc-basics-2/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-mvc-basics-2/.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/spring-mvc-basics-2/README.md b/spring-mvc-basics-2/README.md index 4a5ea24283..9d1402a210 100644 --- a/spring-mvc-basics-2/README.md +++ b/spring-mvc-basics-2/README.md @@ -1,14 +1,15 @@ -## Spring MVC Basics +## Spring MVC Basics 2 -This module contains articles about the basics of Spring MVC. Articles about more specific areas of Spring MVC have -their own module. +This module contains articles about Spring MVC -### The Course -The "REST With Spring" Classes: http://bit.ly/restwithspring - -### Relevant Articles: -- [Quick Guide to Spring Controllers](http://www.baeldung.com/spring-controllers) -- [The Spring @Controller and @RestController Annotations](http://www.baeldung.com/spring-controller-vs-restcontroller) -- [Model, ModelMap, and ModelView in Spring MVC](http://www.baeldung.com/spring-mvc-model-model-map-model-view) -- [Spring Web Contexts](http://www.baeldung.com/spring-web-contexts) -- [[<-- Prev]](/spring-mvc-basics) \ No newline at end of file +## Relevant articles: +- [HandlerAdapters in Spring MVC](https://www.baeldung.com/spring-mvc-handler-adapters) +- [Template Engines for Spring](https://www.baeldung.com/spring-template-engines) +- [Spring 5 and Servlet 4 – The PushBuilder](https://www.baeldung.com/spring-5-push) +- [Servlet Redirect vs Forward](https://www.baeldung.com/servlet-redirect-forward) +- [Apache Tiles Integration with Spring MVC](https://www.baeldung.com/spring-mvc-apache-tiles) +- [Guide to Spring Email](https://www.baeldung.com/spring-email) +- [Request Method Not Supported (405) in Spring](https://www.baeldung.com/spring-request-method-not-supported-405) +- [Spring @RequestParam Annotation](https://www.baeldung.com/spring-request-param) +- More articles: [[more -->]](/spring-mvc-basics-3) +- More articles: [[<-- prev]](/spring-mvc-basics) diff --git a/spring-mvc-basics-2/pom.xml b/spring-mvc-basics-2/pom.xml index 8e36eb38d8..4c3041a209 100644 --- a/spring-mvc-basics-2/pom.xml +++ b/spring-mvc-basics-2/pom.xml @@ -1,37 +1,185 @@ - + 4.0.0 spring-mvc-basics-2 + 0.0.1-SNAPSHOT spring-mvc-basics-2 war com.baeldung - parent-boot-2 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-spring-5 - com.fasterxml.jackson.core - jackson-databind + org.springframework + spring-oxm + ${spring.version} - org.springframework - spring-web + com.sun.mail + javax.mail + ${javax.mail.version} javax.servlet javax.servlet-api - provided + ${javax.servlet-api.version} + + + javax.servlet.jsp + javax.servlet.jsp-api + ${javax.servlet.jsp-api.version} + + + javax.servlet + jstl + ${jstl.version} + + + org.hibernate + hibernate-validator + ${hibernate-validator.version} + + + commons-fileupload + commons-fileupload + ${commons-fileupload.version} org.springframework spring-webmvc + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + + + org.thymeleaf + thymeleaf + ${org.thymeleaf-version} + + + org.thymeleaf + thymeleaf-spring4 + ${org.thymeleaf-version} + + + + + org.freemarker + freemarker + ${freemarker.version} + + + org.springframework + spring-context-support + ${spring.version} + + + + + org.codehaus.groovy + groovy-templates + ${groovy.version} + + + + + de.neuland-bfi + spring-jade4j + ${jade.version} + + + + org.apache.tiles + tiles-jsp + ${apache-tiles.version} + + + + + org.springframework + spring-test + ${spring.version} + test + + + com.rometools + rome + ${rome.version} + + + com.thoughtworks.xstream + xstream + ${xstream.version} + + + com.github.scribejava + scribejava-apis + ${scribejava.version} + + + org.json + json + ${json.version} + + + org.apache.maven.surefire + surefire-logger-api + ${maven-surefire-plugin.version} + + test + true - \ No newline at end of file + + spring-mvc-basics-2 + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + src/main/webapp + springMvcSimple + false + ${deploy-path} + + + + + + + + 1.8 + 1.8 + 2.21.0 + 2.3.2-b02 + 4.0.0 + 6.0.10.Final + enter-location-of-server + 1.3.2 + 3.0.7.RELEASE + 2.4.12 + 2.3.27-incubating + 1.2.5 + 1.9.0 + 1.4.9 + 5.1.0 + 20180130 + 3.0.8 + 1.6.1 + + + diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/ApplicationConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/ApplicationConfiguration.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/ApplicationConfiguration.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/ApplicationConfiguration.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/FreemarkerConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/FreemarkerConfiguration.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/FreemarkerConfiguration.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/FreemarkerConfiguration.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/GroovyConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/GroovyConfiguration.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/GroovyConfiguration.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/GroovyConfiguration.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/JadeTemplateConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/JadeTemplateConfiguration.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/JadeTemplateConfiguration.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/JadeTemplateConfiguration.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/PushConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/PushConfiguration.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/PushConfiguration.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/PushConfiguration.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/ThymeleafConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/ThymeleafConfiguration.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/ThymeleafConfiguration.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/ThymeleafConfiguration.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/TilesApplicationConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/TilesApplicationConfiguration.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/TilesApplicationConfiguration.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/TilesApplicationConfiguration.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/WebInitializer.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/WebInitializer.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/configuration/WebInitializer.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/WebInitializer.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java similarity index 97% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java index 89f5b2501b..30bda5c582 100644 --- a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java @@ -1,15 +1,15 @@ -package com.baeldung.spring.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class AnnotationMethodHandlerAdapterExample { - @RequestMapping("/annotedName") - public ModelAndView getEmployeeName() { - ModelAndView model = new ModelAndView("Greeting"); - model.addObject("message", "Dinesh"); - return model; - } +package com.baeldung.spring.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +public class AnnotationMethodHandlerAdapterExample { + @RequestMapping("/annotedName") + public ModelAndView getEmployeeName() { + ModelAndView model = new ModelAndView("Greeting"); + model.addObject("message", "Dinesh"); + return model; + } } \ No newline at end of file diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/CustomerController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/CustomerController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/CustomerController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/CustomerController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/EmployeeController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/EmployeeController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/EmployeeController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/EmployeeController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/FileUploadController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/FileUploadController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/FileUploadController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/FileUploadController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/MailController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/MailController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/MailController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/MailController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java similarity index 97% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java index 754bea79f1..628f853208 100644 --- a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java @@ -1,15 +1,15 @@ -package com.baeldung.spring.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; - -@Controller -public class RequestMappingHandlerAdapterExample { - @RequestMapping("/requestName") - public ModelAndView getEmployeeName() { - ModelAndView model = new ModelAndView("Greeting"); - model.addObject("message", "Madhwal"); - return model; - } +package com.baeldung.spring.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +public class RequestMappingHandlerAdapterExample { + @RequestMapping("/requestName") + public ModelAndView getEmployeeName() { + ModelAndView model = new ModelAndView("Greeting"); + model.addObject("message", "Madhwal"); + return model; + } } \ No newline at end of file diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/RequestMethodController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/RequestMethodController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/RequestMethodController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java similarity index 97% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java index 17c4ab689e..d3800d4e1c 100644 --- a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java @@ -1,16 +1,16 @@ -package com.baeldung.spring.controller; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.AbstractController; - -public class SimpleControllerHandlerAdapterExample extends AbstractController { - @Override - protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { - ModelAndView model = new ModelAndView("Greeting"); - model.addObject("message", "Dinesh Madhwal"); - return model; - } +package com.baeldung.spring.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.AbstractController; + +public class SimpleControllerHandlerAdapterExample extends AbstractController { + @Override + protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { + ModelAndView model = new ModelAndView("Greeting"); + model.addObject("message", "Dinesh Madhwal"); + return model; + } } \ No newline at end of file diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/UserController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/UserController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/UserController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/UserController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/Article.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/Article.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/Article.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/Article.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/ArticleFeedView.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/ArticleFeedView.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/ArticleFeedView.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/ArticleFeedView.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/ArticleRssController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/ArticleRssController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/ArticleRssController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/ArticleRssController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/ArticleRssFeedViewResolver.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/ArticleRssFeedViewResolver.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/ArticleRssFeedViewResolver.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/ArticleRssFeedViewResolver.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/JsonChannelHttpMessageConverter.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/JsonChannelHttpMessageConverter.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/rss/JsonChannelHttpMessageConverter.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/rss/JsonChannelHttpMessageConverter.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/scribe/GithubController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/scribe/GithubController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/scribe/GithubController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/scribe/GithubController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/scribe/TwitterController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/scribe/TwitterController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/scribe/TwitterController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/scribe/TwitterController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/tiles/TilesController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/tiles/TilesController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/controller/tiles/TilesController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/controller/tiles/TilesController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/domain/Customer.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/domain/Customer.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/domain/Customer.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/domain/Customer.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/domain/Employee.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/domain/Employee.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/domain/Employee.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/domain/Employee.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/domain/MailObject.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/domain/MailObject.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/domain/MailObject.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/domain/MailObject.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/domain/User.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/domain/User.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/domain/User.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/domain/User.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/exception/InvalidRequestException.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/interceptor/FileUploadExceptionAdvice.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/interceptor/FileUploadExceptionAdvice.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/interceptor/FileUploadExceptionAdvice.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/interceptor/FileUploadExceptionAdvice.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/mail/EmailService.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailService.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/mail/EmailService.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailService.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/push/controller/PushController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/push/controller/PushController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/push/controller/PushController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/push/controller/PushController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/requestparam/RequestParamController.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/requestparam/RequestParamController.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/requestparam/RequestParamController.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/requestparam/RequestParamController.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/service/EmployeeService.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeService.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/service/EmployeeService.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/service/EmployeeServiceImpl.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/servlets/ForwardedServlet.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/servlets/ForwardedServlet.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/servlets/ForwardedServlet.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/servlets/ForwardedServlet.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/servlets/HelloServlet.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/servlets/HelloServlet.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/servlets/HelloServlet.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/servlets/HelloServlet.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/servlets/RedirectedServlet.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/servlets/RedirectedServlet.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/servlets/RedirectedServlet.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/servlets/RedirectedServlet.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/servlets/WelcomeServlet.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/servlets/WelcomeServlet.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/servlets/WelcomeServlet.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/servlets/WelcomeServlet.java diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/validator/CustomerValidator.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/validator/CustomerValidator.java similarity index 100% rename from spring-mvc-simple/src/main/java/com/baeldung/spring/validator/CustomerValidator.java rename to spring-mvc-basics-2/src/main/java/com/baeldung/spring/validator/CustomerValidator.java diff --git a/spring-mvc-basics-2/src/main/resources/application.properties b/spring-mvc-basics-2/src/main/resources/application.properties index 709574239b..9a804c07d8 100644 --- a/spring-mvc-basics-2/src/main/resources/application.properties +++ b/spring-mvc-basics-2/src/main/resources/application.properties @@ -1 +1,22 @@ -spring.main.allow-bean-definition-overriding=true \ No newline at end of file +#this property file will have to be loaded explicitly as this is not a Spring Boot project + +# Gmail SMTP +spring.mail.host=smtp.gmail.com +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 + +# Amazon SES SMTP +#spring.mail.host=email-smtp.us-west-2.amazonaws.com +#spring.mail.username=username +#spring.mail.password=password +#spring.mail.properties.mail.transport.protocol=smtp +#spring.mail.properties.mail.smtp.port=25 +#spring.mail.properties.mail.smtp.auth=true +#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 diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/Greeting.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/Greeting.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/Greeting.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/Greeting.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/Greeting.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/Greeting.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/Greeting.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/Greeting.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/customerHome.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/customerHome.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/customerHome.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/customerHome.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/customerView.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/customerView.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/customerView.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/customerView.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/demo.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/demo.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/demo.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/demo.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/emails.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/emails.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/emails.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/emails.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/employeeHome.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/employeeHome.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/employeeHome.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/employeeHome.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/employeeView.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/employeeView.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/employeeView.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/employeeView.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/error.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/error.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/error.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/error.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/file.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/file.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/file.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/file.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/mail/send.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/send.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/mail/send.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/send.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/pages/apachetiles.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/pages/apachetiles.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/pages/apachetiles.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/pages/apachetiles.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/pages/home.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/pages/home.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/pages/home.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/pages/home.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/pages/springmvc.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/pages/springmvc.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/pages/springmvc.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/pages/springmvc.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/registration-freemarker.ftl b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration-freemarker.ftl similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/registration-freemarker.ftl rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration-freemarker.ftl diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/registration-groovy.tpl b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration-groovy.tpl similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/registration-groovy.tpl rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration-groovy.tpl diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/registration-jade.jade b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration-jade.jade similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/registration-jade.jade rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration-jade.jade diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/registration-thymeleaf.html b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration-thymeleaf.html similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/registration-thymeleaf.html rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration-thymeleaf.html diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/registration.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/registration.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/registration.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/layouts/defaultLayout.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/layouts/defaultLayout.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/layouts/defaultLayout.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/layouts/defaultLayout.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/templates/defaultFooter.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/templates/defaultFooter.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/templates/defaultFooter.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/templates/defaultFooter.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/templates/defaultHeader.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/templates/defaultHeader.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/templates/defaultHeader.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/templates/defaultHeader.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/templates/defaultMenu.jsp b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/templates/defaultMenu.jsp similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/templates/defaultMenu.jsp rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/templates/defaultMenu.jsp diff --git a/spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/tiles.xml b/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/tiles.xml similarity index 100% rename from spring-mvc-simple/src/main/webapp/WEB-INF/views/tiles/tiles.xml rename to spring-mvc-basics-2/src/main/webapp/WEB-INF/views/tiles/tiles.xml diff --git a/spring-mvc-simple/src/main/webapp/resources/logo.png b/spring-mvc-basics-2/src/main/webapp/resources/logo.png similarity index 100% rename from spring-mvc-simple/src/main/webapp/resources/logo.png rename to spring-mvc-basics-2/src/main/webapp/resources/logo.png diff --git a/spring-mvc-simple/src/main/webapp/static/css/app.css b/spring-mvc-basics-2/src/main/webapp/static/css/app.css similarity index 100% rename from spring-mvc-simple/src/main/webapp/static/css/app.css rename to spring-mvc-basics-2/src/main/webapp/static/css/app.css diff --git a/spring-mvc-simple/src/test/java/com/baeldung/SpringContextTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-mvc-simple/src/test/java/com/baeldung/SpringContextTest.java rename to spring-mvc-basics-2/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-mvc-simple/src/test/java/com/baeldung/controller/push/PushControllerIntegrationTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/push/PushControllerIntegrationTest.java similarity index 100% rename from spring-mvc-simple/src/test/java/com/baeldung/controller/push/PushControllerIntegrationTest.java rename to spring-mvc-basics-2/src/test/java/com/baeldung/controller/push/PushControllerIntegrationTest.java diff --git a/spring-mvc-simple/src/test/java/com/baeldung/controller/rss/ArticleRssIntegrationTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/controller/rss/ArticleRssIntegrationTest.java similarity index 100% rename from spring-mvc-simple/src/test/java/com/baeldung/controller/rss/ArticleRssIntegrationTest.java rename to spring-mvc-basics-2/src/test/java/com/baeldung/controller/rss/ArticleRssIntegrationTest.java diff --git a/spring-mvc-simple/src/test/java/com/baeldung/spring/servlets/HelloServletIntegrationTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/spring/servlets/HelloServletIntegrationTest.java similarity index 100% rename from spring-mvc-simple/src/test/java/com/baeldung/spring/servlets/HelloServletIntegrationTest.java rename to spring-mvc-basics-2/src/test/java/com/baeldung/spring/servlets/HelloServletIntegrationTest.java diff --git a/spring-mvc-simple/src/test/java/com/baeldung/spring/servlets/WelcomeServletIntegrationTest.java b/spring-mvc-basics-2/src/test/java/com/baeldung/spring/servlets/WelcomeServletIntegrationTest.java similarity index 100% rename from spring-mvc-simple/src/test/java/com/baeldung/spring/servlets/WelcomeServletIntegrationTest.java rename to spring-mvc-basics-2/src/test/java/com/baeldung/spring/servlets/WelcomeServletIntegrationTest.java diff --git a/spring-mvc-simple-2/README.md b/spring-mvc-basics-3/README.md similarity index 87% rename from spring-mvc-simple-2/README.md rename to spring-mvc-basics-3/README.md index 3d240531ae..b21f7b686a 100644 --- a/spring-mvc-simple-2/README.md +++ b/spring-mvc-basics-3/README.md @@ -1,4 +1,4 @@ -## Spring MVC Simple 2 +## Spring MVC Basics 3 This module contains articles about Spring MVC @@ -11,4 +11,5 @@ This module contains articles about Spring MVC - [Using Enums as Request Parameters in Spring](https://www.baeldung.com/spring-enum-request-param) - [Excluding URLs for a Filter in a Spring Web Application](https://www.baeldung.com/spring-exclude-filter) - [Guide to Flash Attributes in a Spring Web Application](https://www.baeldung.com/spring-web-flash-attributes) -- More articles: [[<-- prev]](/spring-mvc-simple) +- More articles: [[more -->]](/spring-mvc-basics-4) +- More articles: [[<-- prev]](/spring-mvc-basics-2) diff --git a/spring-mvc-simple-2/pom.xml b/spring-mvc-basics-3/pom.xml similarity index 98% rename from spring-mvc-simple-2/pom.xml rename to spring-mvc-basics-3/pom.xml index 307e8bc94b..48b1e51dd3 100644 --- a/spring-mvc-simple-2/pom.xml +++ b/spring-mvc-basics-3/pom.xml @@ -2,8 +2,8 @@ 4.0.0 - spring-mvc-simple-2 - spring-mvc-simple-2 + spring-mvc-basics-3 + spring-mvc-basics-3 war Demo project for Spring Boot diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/Application.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/Application.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/Application.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/Application.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/config/WebConfig.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/config/WebConfig.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/config/WebConfig.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/config/WebConfig.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/controller/GenericEntityController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/controller/GenericEntityController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/controller/GenericEntityController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/controller/GenericEntityController.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/GenericBigDecimalConverter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/GenericBigDecimalConverter.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/StringToAbstractEntityConverterFactory.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToAbstractEntityConverterFactory.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/StringToAbstractEntityConverterFactory.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToAbstractEntityConverterFactory.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToEmployeeConverter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToEmployeeConverter.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/StringToEnumConverter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToEnumConverter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/StringToEnumConverter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToEnumConverter.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/StringToLocalDateTimeConverter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToLocalDateTimeConverter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/StringToLocalDateTimeConverter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/StringToLocalDateTimeConverter.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/controller/AbstractEntityController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/controller/AbstractEntityController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/controller/AbstractEntityController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/controller/AbstractEntityController.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/controller/StringToEmployeeConverterController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/controller/StringToEmployeeConverterController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/converter/controller/StringToEmployeeConverterController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/converter/controller/StringToEmployeeConverterController.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/AbstractEntity.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/AbstractEntity.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/AbstractEntity.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/AbstractEntity.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/Bar.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/Bar.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/Bar.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/Bar.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/Employee.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/Employee.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/Employee.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/Employee.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/Foo.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/Foo.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/Foo.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/Foo.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/GenericEntity.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/GenericEntity.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/GenericEntity.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/GenericEntity.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/Modes.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/Modes.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/domain/Modes.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/domain/Modes.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/repository/GenericEntityRepository.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/repository/GenericEntityRepository.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/web/resolver/HeaderVersionArgumentResolver.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/web/resolver/HeaderVersionArgumentResolver.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/web/resolver/HeaderVersionArgumentResolver.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/web/resolver/HeaderVersionArgumentResolver.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/boot/web/resolver/Version.java b/spring-mvc-basics-3/src/main/java/com/baeldung/boot/web/resolver/Version.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/boot/web/resolver/Version.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/boot/web/resolver/Version.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequest.java b/spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/CachedBodyHttpServletRequest.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequest.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/CachedBodyHttpServletRequest.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/CachedBodyServletInputStream.java b/spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/CachedBodyServletInputStream.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/CachedBodyServletInputStream.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/CachedBodyServletInputStream.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/ContentCachingFilter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/ContentCachingFilter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/ContentCachingFilter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/ContentCachingFilter.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/HttpRequestDemoConfig.java b/spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/HttpRequestDemoConfig.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/HttpRequestDemoConfig.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/HttpRequestDemoConfig.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/Person.java b/spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/Person.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/Person.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/Person.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/PersonController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/PersonController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/PersonController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/PersonController.java diff --git a/spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/PrintRequestContentFilter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/PrintRequestContentFilter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/org/baeldung/cachedrequest/PrintRequestContentFilter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/cachedrequest/PrintRequestContentFilter.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/Application.java b/spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/Application.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/Application.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/Application.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/controller/FAQController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/controller/FAQController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/controller/FAQController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/controller/FAQController.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/controller/Ping.java b/spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/controller/Ping.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/controller/Ping.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/controller/Ping.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/filter/FilterRegistrationConfig.java b/spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/filter/FilterRegistrationConfig.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/filter/FilterRegistrationConfig.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/filter/FilterRegistrationConfig.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/filter/HeaderValidatorFilter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/filter/HeaderValidatorFilter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/filter/HeaderValidatorFilter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/filter/HeaderValidatorFilter.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/filter/LogFilter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/filter/LogFilter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/filter/LogFilter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/filter/LogFilter.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/service/FAQService.java b/spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/service/FAQService.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/service/FAQService.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/service/FAQService.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/service/FAQServiceImpl.java b/spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/service/FAQServiceImpl.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/exclude_urls_filter/service/FAQServiceImpl.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/exclude_urls_filter/service/FAQServiceImpl.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/flash_attributes/Application.java b/spring-mvc-basics-3/src/main/java/com/baeldung/flash_attributes/Application.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/flash_attributes/Application.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/flash_attributes/Application.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/flash_attributes/controllers/PoemSubmission.java b/spring-mvc-basics-3/src/main/java/com/baeldung/flash_attributes/controllers/PoemSubmission.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/flash_attributes/controllers/PoemSubmission.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/flash_attributes/controllers/PoemSubmission.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/flash_attributes/model/Poem.java b/spring-mvc-basics-3/src/main/java/com/baeldung/flash_attributes/model/Poem.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/flash_attributes/model/Poem.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/flash_attributes/model/Poem.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/Application.java b/spring-mvc-basics-3/src/main/java/com/baeldung/form_submission/Application.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/Application.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/form_submission/Application.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/controllers/FeedbackForm.java b/spring-mvc-basics-3/src/main/java/com/baeldung/form_submission/controllers/FeedbackForm.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/controllers/FeedbackForm.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/form_submission/controllers/FeedbackForm.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/model/Feedback.java b/spring-mvc-basics-3/src/main/java/com/baeldung/form_submission/model/Feedback.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/form_submission/model/Feedback.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/form_submission/model/Feedback.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/interpolation/MyMessageInterpolator.java b/spring-mvc-basics-3/src/main/java/com/baeldung/interpolation/MyMessageInterpolator.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/interpolation/MyMessageInterpolator.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/interpolation/MyMessageInterpolator.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/interpolation/NotNullRequest.java b/spring-mvc-basics-3/src/main/java/com/baeldung/interpolation/NotNullRequest.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/interpolation/NotNullRequest.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/interpolation/NotNullRequest.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/interpolation/ValidationController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/interpolation/ValidationController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/interpolation/ValidationController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/interpolation/ValidationController.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/interpolation/ValidationExamples.java b/spring-mvc-basics-3/src/main/java/com/baeldung/interpolation/ValidationExamples.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/interpolation/ValidationExamples.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/interpolation/ValidationExamples.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/Application.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/Application.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/Application.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/Application.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/config/MvcConfig.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/config/MvcConfig.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/config/MvcConfig.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/config/MvcConfig.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/config/converter/StringToEnumConverter.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/config/converter/StringToEnumConverter.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/config/converter/StringToEnumConverter.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/config/converter/StringToEnumConverter.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/enums/EnumController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/enums/EnumController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/enums/EnumController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/enums/EnumController.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/exceptions/GlobalControllerExceptionHandler.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/exceptions/GlobalControllerExceptionHandler.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/exceptions/GlobalControllerExceptionHandler.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/exceptions/GlobalControllerExceptionHandler.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/headers/controller/ReadHeaderRestController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/headers/controller/ReadHeaderRestController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/headers/controller/ReadHeaderRestController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/headers/controller/ReadHeaderRestController.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/model/Modes.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/model/Modes.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/model/Modes.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/model/Modes.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/slash/Application.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/slash/Application.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/slash/Application.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/slash/Application.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/spring/slash/SlashParsingController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/spring/slash/SlashParsingController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/spring/slash/SlashParsingController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/spring/slash/SlashParsingController.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/SpringListValidationApplication.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/SpringListValidationApplication.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/SpringListValidationApplication.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/SpringListValidationApplication.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraint.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraint.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraint.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraint.java diff --git a/spring-mvc-simple-2/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 similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/controller/MovieController.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/controller/MovieController.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/controller/MovieController.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/controller/MovieController.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/exception/ConstraintViolationExceptionHandler.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/exception/ConstraintViolationExceptionHandler.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/exception/ConstraintViolationExceptionHandler.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/exception/ConstraintViolationExceptionHandler.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/model/Movie.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/model/Movie.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/model/Movie.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/model/Movie.java diff --git a/spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/service/MovieService.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/service/MovieService.java similarity index 100% rename from spring-mvc-simple-2/src/main/java/com/baeldung/validation/listvalidation/service/MovieService.java rename to spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/service/MovieService.java diff --git a/spring-mvc-simple-2/src/main/resources/application.properties b/spring-mvc-basics-3/src/main/resources/application.properties similarity index 100% rename from spring-mvc-simple-2/src/main/resources/application.properties rename to spring-mvc-basics-3/src/main/resources/application.properties diff --git a/spring-mvc-simple-2/src/main/resources/templates/feedback.html b/spring-mvc-basics-3/src/main/resources/templates/feedback.html similarity index 100% rename from spring-mvc-simple-2/src/main/resources/templates/feedback.html rename to spring-mvc-basics-3/src/main/resources/templates/feedback.html diff --git a/spring-mvc-simple-2/src/main/resources/templates/submit.html b/spring-mvc-basics-3/src/main/resources/templates/submit.html similarity index 100% rename from spring-mvc-simple-2/src/main/resources/templates/submit.html rename to spring-mvc-basics-3/src/main/resources/templates/submit.html diff --git a/spring-mvc-simple-2/src/main/resources/templates/success.html b/spring-mvc-basics-3/src/main/resources/templates/success.html similarity index 100% rename from spring-mvc-simple-2/src/main/resources/templates/success.html rename to spring-mvc-basics-3/src/main/resources/templates/success.html diff --git a/spring-mvc-simple-2/src/test/java/com/baeldung/AppContextIntegrationTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/AppContextIntegrationTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/com/baeldung/AppContextIntegrationTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/AppContextIntegrationTest.java diff --git a/spring-mvc-simple-2/src/test/java/com/baeldung/SpringBootApplicationIntegrationTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/SpringBootApplicationIntegrationTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/com/baeldung/SpringBootApplicationIntegrationTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/SpringBootApplicationIntegrationTest.java diff --git a/spring-mvc-simple-2/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java diff --git a/spring-mvc-simple-2/src/test/java/com/baeldung/SpringBootMailIntegrationTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/SpringBootMailIntegrationTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/com/baeldung/SpringBootMailIntegrationTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/SpringBootMailIntegrationTest.java diff --git a/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequestUnitTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/CachedBodyHttpServletRequestUnitTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/CachedBodyHttpServletRequestUnitTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/CachedBodyHttpServletRequestUnitTest.java diff --git a/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/CachedBodyServletInputStreamUnitTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/CachedBodyServletInputStreamUnitTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/CachedBodyServletInputStreamUnitTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/CachedBodyServletInputStreamUnitTest.java diff --git a/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/ContentCachingFilterUnitTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/ContentCachingFilterUnitTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/ContentCachingFilterUnitTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/ContentCachingFilterUnitTest.java diff --git a/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PersonControllerIntegrationTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/PersonControllerIntegrationTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PersonControllerIntegrationTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/PersonControllerIntegrationTest.java diff --git a/spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PrintRequestContentFilterUnitTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/PrintRequestContentFilterUnitTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/org/baeldung/cachedrequest/PrintRequestContentFilterUnitTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/cachedrequest/PrintRequestContentFilterUnitTest.java diff --git a/spring-mvc-simple-2/src/test/java/com/baeldung/headers/controller/ReadHeaderRestControllerIntegrationTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/headers/controller/ReadHeaderRestControllerIntegrationTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/com/baeldung/headers/controller/ReadHeaderRestControllerIntegrationTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/headers/controller/ReadHeaderRestControllerIntegrationTest.java diff --git a/spring-mvc-simple-2/src/test/java/com/baeldung/spring/slash/SlashParsingControllerIntTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/spring/slash/SlashParsingControllerIntTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/com/baeldung/spring/slash/SlashParsingControllerIntTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/spring/slash/SlashParsingControllerIntTest.java diff --git a/spring-mvc-simple-2/src/test/java/com/baeldung/validation/listvalidation/MovieControllerIntegrationTest.java b/spring-mvc-basics-3/src/test/java/com/baeldung/validation/listvalidation/MovieControllerIntegrationTest.java similarity index 100% rename from spring-mvc-simple-2/src/test/java/com/baeldung/validation/listvalidation/MovieControllerIntegrationTest.java rename to spring-mvc-basics-3/src/test/java/com/baeldung/validation/listvalidation/MovieControllerIntegrationTest.java diff --git a/jackson-simple/.gitignore b/spring-mvc-basics-4/.gitignore similarity index 100% rename from jackson-simple/.gitignore rename to spring-mvc-basics-4/.gitignore diff --git a/spring-mvc-basics-4/README.md b/spring-mvc-basics-4/README.md new file mode 100644 index 0000000000..19cb9059ed --- /dev/null +++ b/spring-mvc-basics-4/README.md @@ -0,0 +1,11 @@ +## Spring MVC Basics with Java Configuration Example Project + +### The Course +The "REST With Spring" Classes: http://bit.ly/restwithspring + +### Relevant Articles: +- [Quick Guide to Spring Controllers](https://www.baeldung.com/spring-controllers) +- [Model, ModelMap, and ModelView in Spring MVC](https://www.baeldung.com/spring-mvc-model-model-map-model-view) +- [Spring Web Contexts](https://www.baeldung.com/spring-web-contexts) +- [Spring Optional Path variables](https://www.baeldung.com/spring-optional-path-variables) +- More articles: [[<-- prev]](/spring-mvc-basics-3) \ No newline at end of file diff --git a/spring-mvc-basics-4/pom.xml b/spring-mvc-basics-4/pom.xml new file mode 100644 index 0000000000..8382cd03b8 --- /dev/null +++ b/spring-mvc-basics-4/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + spring-mvc-basics-4 + spring-mvc-basics-4 + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + com.fasterxml.jackson.core + jackson-databind + + + org.springframework + spring-web + + + javax.servlet + javax.servlet-api + provided + + + org.springframework + spring-webmvc + + + + \ No newline at end of file diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/Greeting.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/Greeting.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/Greeting.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/Greeting.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/AnnotationsBasedApplicationAndServletInitializer.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/AnnotationsBasedApplicationAndServletInitializer.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/AnnotationsBasedApplicationAndServletInitializer.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/AnnotationsBasedApplicationAndServletInitializer.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/AnnotationsBasedApplicationInitializer.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/AnnotationsBasedApplicationInitializer.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/AnnotationsBasedApplicationInitializer.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/AnnotationsBasedApplicationInitializer.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/ApplicationInitializer.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/ApplicationInitializer.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/ApplicationInitializer.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/ApplicationInitializer.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/NormalWebAppConfig.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/NormalWebAppConfig.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/NormalWebAppConfig.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/NormalWebAppConfig.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/RootApplicationConfig.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/RootApplicationConfig.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/RootApplicationConfig.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/RootApplicationConfig.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/SecureAnnotationsBasedApplicationAndServletInitializer.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/SecureAnnotationsBasedApplicationAndServletInitializer.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/SecureAnnotationsBasedApplicationAndServletInitializer.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/SecureAnnotationsBasedApplicationAndServletInitializer.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/SecureWebAppConfig.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/SecureWebAppConfig.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/config/SecureWebAppConfig.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/config/SecureWebAppConfig.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/normal/HelloWorldController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/normal/HelloWorldController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/normal/HelloWorldController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/normal/HelloWorldController.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/secure/HelloWorldSecureController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/secure/HelloWorldSecureController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/secure/HelloWorldSecureController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/secure/HelloWorldSecureController.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/services/ApplicationContextUtilService.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/services/ApplicationContextUtilService.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/services/ApplicationContextUtilService.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/services/ApplicationContextUtilService.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/contexts/services/GreeterService.java b/spring-mvc-basics-4/src/main/java/com/baeldung/contexts/services/GreeterService.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/contexts/services/GreeterService.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/contexts/services/GreeterService.java diff --git a/spring-mvc-basics-2/src/main/java/org/baeldung/controller/config/StudentControllerConfig.java b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/config/StudentControllerConfig.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/org/baeldung/controller/config/StudentControllerConfig.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/controller/config/StudentControllerConfig.java diff --git a/spring-mvc-basics-2/src/main/java/org/baeldung/controller/config/WebConfig.java b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/config/WebConfig.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/org/baeldung/controller/config/WebConfig.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/controller/config/WebConfig.java diff --git a/spring-mvc-basics-2/src/main/java/org/baeldung/controller/controller/PassParametersController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/controller/PassParametersController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/org/baeldung/controller/controller/PassParametersController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/controller/controller/PassParametersController.java diff --git a/spring-mvc-basics-2/src/main/java/org/baeldung/controller/controller/RestAnnotatedController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/controller/RestAnnotatedController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/org/baeldung/controller/controller/RestAnnotatedController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/controller/controller/RestAnnotatedController.java diff --git a/spring-mvc-basics-2/src/main/java/org/baeldung/controller/controller/RestController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/controller/RestController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/org/baeldung/controller/controller/RestController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/controller/controller/RestController.java diff --git a/spring-mvc-basics-2/src/main/java/org/baeldung/controller/controller/TestController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/controller/TestController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/org/baeldung/controller/controller/TestController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/controller/controller/TestController.java diff --git a/spring-mvc-basics-2/src/main/java/org/baeldung/controller/student/Student.java b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/student/Student.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/org/baeldung/controller/student/Student.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/controller/student/Student.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/Article.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/Article.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/Article.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/Article.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerController.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamController.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithOptionalParamController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithOptionalParamController.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithRequiredAttributeController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithRequiredAttributeController.java diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java similarity index 100% rename from spring-mvc-basics-2/src/main/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java rename to spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java diff --git a/spring-mvc-basics-4/src/main/resources/application.properties b/spring-mvc-basics-4/src/main/resources/application.properties new file mode 100644 index 0000000000..709574239b --- /dev/null +++ b/spring-mvc-basics-4/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.main.allow-bean-definition-overriding=true \ No newline at end of file diff --git a/spring-mvc-simple/src/main/resources/logback.xml b/spring-mvc-basics-4/src/main/resources/logback.xml similarity index 100% rename from spring-mvc-simple/src/main/resources/logback.xml rename to spring-mvc-basics-4/src/main/resources/logback.xml diff --git a/spring-mvc-basics-2/src/main/resources/test-mvc.xml b/spring-mvc-basics-4/src/main/resources/test-mvc.xml similarity index 100% rename from spring-mvc-basics-2/src/main/resources/test-mvc.xml rename to spring-mvc-basics-4/src/main/resources/test-mvc.xml diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/greeting.xml b/spring-mvc-basics-4/src/main/webapp/WEB-INF/greeting.xml similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/greeting.xml rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/greeting.xml diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/index.jsp b/spring-mvc-basics-4/src/main/webapp/WEB-INF/index.jsp similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/index.jsp rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/index.jsp diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/normal-webapp-servlet.xml b/spring-mvc-basics-4/src/main/webapp/WEB-INF/normal-webapp-servlet.xml similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/normal-webapp-servlet.xml rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/normal-webapp-servlet.xml diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/rootApplicationContext.xml b/spring-mvc-basics-4/src/main/webapp/WEB-INF/rootApplicationContext.xml similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/rootApplicationContext.xml rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/rootApplicationContext.xml diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/secure-webapp-servlet.xml b/spring-mvc-basics-4/src/main/webapp/WEB-INF/secure-webapp-servlet.xml similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/secure-webapp-servlet.xml rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/secure-webapp-servlet.xml diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/secure/view/welcome.jsp b/spring-mvc-basics-4/src/main/webapp/WEB-INF/secure/view/welcome.jsp similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/secure/view/welcome.jsp rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/secure/view/welcome.jsp diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/view/sample.jsp b/spring-mvc-basics-4/src/main/webapp/WEB-INF/view/sample.jsp similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/view/sample.jsp rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/view/sample.jsp diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/view/scopesExample.jsp b/spring-mvc-basics-4/src/main/webapp/WEB-INF/view/scopesExample.jsp similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/view/scopesExample.jsp rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/view/scopesExample.jsp diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/view/viewPage.html b/spring-mvc-basics-4/src/main/webapp/WEB-INF/view/viewPage.html similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/view/viewPage.html rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/view/viewPage.html diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/view/welcome.jsp b/spring-mvc-basics-4/src/main/webapp/WEB-INF/view/welcome.jsp similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/view/welcome.jsp rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/view/welcome.jsp diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/web-old.xml b/spring-mvc-basics-4/src/main/webapp/WEB-INF/web-old.xml similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/web-old.xml rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/web-old.xml diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/welcome.jsp b/spring-mvc-basics-4/src/main/webapp/WEB-INF/welcome.jsp similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/welcome.jsp rename to spring-mvc-basics-4/src/main/webapp/WEB-INF/welcome.jsp diff --git a/spring-mvc-basics-2/src/main/webapp/index.jsp b/spring-mvc-basics-4/src/main/webapp/index.jsp similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/index.jsp rename to spring-mvc-basics-4/src/main/webapp/index.jsp diff --git a/spring-mvc-basics-2/src/test/java/org/baeldung/controller/ControllerAnnotationIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/controller/ControllerAnnotationIntegrationTest.java similarity index 100% rename from spring-mvc-basics-2/src/test/java/org/baeldung/controller/ControllerAnnotationIntegrationTest.java rename to spring-mvc-basics-4/src/test/java/com/baeldung/controller/ControllerAnnotationIntegrationTest.java diff --git a/spring-mvc-basics-2/src/test/java/org/baeldung/controller/ControllerIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/controller/ControllerIntegrationTest.java similarity index 100% rename from spring-mvc-basics-2/src/test/java/org/baeldung/controller/ControllerIntegrationTest.java rename to spring-mvc-basics-4/src/test/java/com/baeldung/controller/ControllerIntegrationTest.java diff --git a/spring-mvc-basics-2/src/test/java/org/baeldung/controller/PassParametersControllerIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/controller/PassParametersControllerIntegrationTest.java similarity index 100% rename from spring-mvc-basics-2/src/test/java/org/baeldung/controller/PassParametersControllerIntegrationTest.java rename to spring-mvc-basics-4/src/test/java/com/baeldung/controller/PassParametersControllerIntegrationTest.java diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerIntegrationTest.java similarity index 100% rename from spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java rename to spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerIntegrationTest.java diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java similarity index 100% rename from spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java rename to spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java similarity index 100% rename from spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java rename to spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java similarity index 100% rename from spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java rename to spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java diff --git a/spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java similarity index 100% rename from spring-mvc-basics-2/src/test/java/com/baeldung/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java rename to spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java diff --git a/spring-mvc-basics-2/src/test/resources/test-mvc.xml b/spring-mvc-basics-4/src/test/resources/test-mvc.xml similarity index 100% rename from spring-mvc-basics-2/src/test/resources/test-mvc.xml rename to spring-mvc-basics-4/src/test/resources/test-mvc.xml diff --git a/spring-mvc-basics/README.md b/spring-mvc-basics/README.md index a995c89a07..cd36ffd94a 100644 --- a/spring-mvc-basics/README.md +++ b/spring-mvc-basics/README.md @@ -17,4 +17,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Using Spring @ResponseStatus to Set HTTP Status Code](https://www.baeldung.com/spring-response-status) - [Spring MVC and the @ModelAttribute Annotation](https://www.baeldung.com/spring-mvc-and-the-modelattribute-annotation) - [The HttpMediaTypeNotAcceptableException in Spring MVC](https://www.baeldung.com/spring-httpmediatypenotacceptable) -- [[Next -->]](/spring-mvc-basics-2) \ No newline at end of file +- More articles: [[more -->]](/spring-mvc-basics-2) \ No newline at end of file diff --git a/spring-mvc-basics/pom.xml b/spring-mvc-basics/pom.xml index ab6d200e67..159dda955f 100644 --- a/spring-mvc-basics/pom.xml +++ b/spring-mvc-basics/pom.xml @@ -38,6 +38,7 @@ + spring-mvc-basics org.springframework.boot diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 7088162496..ff1f7830b6 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -7,17 +7,12 @@ This module contains articles about Spring MVC with Java configuration The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: -- [Introduction to Pointcut Expressions in Spring](https://www.baeldung.com/spring-aop-pointcut-tutorial) -- [Introduction to Advice Types in Spring](https://www.baeldung.com/spring-aop-advice-tutorial) - [Integration Testing in Spring](https://www.baeldung.com/integration-testing-in-spring) - [A Quick Guide to Spring MVC Matrix Variables](https://www.baeldung.com/spring-mvc-matrix-variables) -- [Intro to WebSockets with Spring](https://www.baeldung.com/websockets-spring) - [File Upload with Spring MVC](https://www.baeldung.com/spring-file-upload) - [Introduction to HtmlUnit](https://www.baeldung.com/htmlunit) - [Upload and Display Excel Files with Spring MVC](https://www.baeldung.com/spring-mvc-excel-files) - [web.xml vs Initializer with Spring](https://www.baeldung.com/spring-xml-vs-java-config) - [Spring MVC @PathVariable with a dot (.) gets truncated](https://www.baeldung.com/spring-mvc-pathvariable-dot) -- [A Quick Example of Spring Websockets’ @SendToUser Annotation](https://www.baeldung.com/spring-websockets-sendtouser) - [Working with Date Parameters in Spring](https://www.baeldung.com/spring-date-parameters) - [A Java Web Application Without a web.xml](https://www.baeldung.com/java-web-app-without-web-xml) -- [The HttpMediaTypeNotAcceptableException in Spring MVC](https://www.baeldung.com/spring-httpmediatypenotacceptable) diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 7d0afd85ec..079a664a5d 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -26,12 +26,12 @@ javax.servlet javax.servlet-api - 4.0.1 + ${javax.version} javax.servlet.jsp javax.servlet.jsp-api - 2.3.3 + ${javax-servlet-api.version} javax.servlet @@ -48,24 +48,11 @@ jackson-databind ${jackson.version} - - - - org.aspectj - aspectjrt - 1.9.1 - - - org.aspectj - aspectjweaver - 1.9.1 - - net.sourceforge.htmlunit htmlunit - 2.32 + ${htmlunit.version} commons-logging @@ -99,7 +86,7 @@ com.jayway.jsonpath json-path test - 2.4.0 + ${json-path.version} org.springframework.boot @@ -120,18 +107,6 @@ hibernate-validator ${hibernate-validator.version} - - - - - com.google.code.gson - gson - 2.8.5 - - - org.springframework.boot - spring-boot-starter-websocket - org.glassfish javax.el @@ -283,6 +258,10 @@ 3.16-beta1 3.0.1-b09 + 4.0.1 + 2.3.3 + 2.32 + 2.4.0 com.baeldung.SpringMVCApplication diff --git a/spring-mvc-java/src/test/java/com/baeldung/SpringContextTest.java b/spring-mvc-java/src/test/java/com/baeldung/SpringContextTest.java deleted file mode 100644 index 8943ecb548..0000000000 --- a/spring-mvc-java/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.SpringRunner; - -import com.baeldung.config.TestConfig; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {TestConfig.class}) -public class SpringContextTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - - } -} diff --git a/spring-mvc-java/src/test/java/com/baeldung/config/TestConfig.java b/spring-mvc-java/src/test/java/com/baeldung/config/TestConfig.java deleted file mode 100644 index 641513a24a..0000000000 --- a/spring-mvc-java/src/test/java/com/baeldung/config/TestConfig.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.config; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.EnableAspectJAutoProxy; - -@Configuration -@ComponentScan(basePackages = { "com.baeldung.dao", "com.baeldung.aop", "com.baeldung.events" }) -@EnableAspectJAutoProxy -public class TestConfig { -} diff --git a/spring-mvc-simple/README.md b/spring-mvc-simple/README.md deleted file mode 100644 index ae03fedf3c..0000000000 --- a/spring-mvc-simple/README.md +++ /dev/null @@ -1,15 +0,0 @@ -## Spring MVC Simple - -This module contains articles about Spring MVC - -## Relevant articles: - -- [HandlerAdapters in Spring MVC](https://www.baeldung.com/spring-mvc-handler-adapters) -- [Template Engines for Spring](https://www.baeldung.com/spring-template-engines) -- [Spring 5 and Servlet 4 – The PushBuilder](https://www.baeldung.com/spring-5-push) -- [Servlet Redirect vs Forward](https://www.baeldung.com/servlet-redirect-forward) -- [Apache Tiles Integration with Spring MVC](https://www.baeldung.com/spring-mvc-apache-tiles) -- [Guide to Spring Email](https://www.baeldung.com/spring-email) -- [Request Method Not Supported (405) in Spring](https://www.baeldung.com/spring-request-method-not-supported-405) -- [Spring @RequestParam Annotation](https://www.baeldung.com/spring-request-param) -- More articles: [[more -->]](/spring-mvc-simple-2) \ No newline at end of file diff --git a/spring-mvc-simple/pom.xml b/spring-mvc-simple/pom.xml deleted file mode 100644 index 539e81307a..0000000000 --- a/spring-mvc-simple/pom.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - 4.0.0 - spring-mvc-simple - 0.0.1-SNAPSHOT - spring-mvc-simple - war - - - com.baeldung - parent-spring-5 - 0.0.1-SNAPSHOT - ../parent-spring-5 - - - - - org.springframework - spring-oxm - ${spring.version} - - - com.sun.mail - javax.mail - ${javax.mail.version} - - - javax.servlet - javax.servlet-api - ${javax.servlet-api.version} - - - javax.servlet.jsp - javax.servlet.jsp-api - ${javax.servlet.jsp-api.version} - - - javax.servlet - jstl - ${jstl.version} - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - - commons-fileupload - commons-fileupload - ${commons-fileupload.version} - - - org.springframework - spring-webmvc - ${spring.version} - - - org.springframework - spring-tx - ${spring.version} - - - - - org.thymeleaf - thymeleaf - ${org.thymeleaf-version} - - - org.thymeleaf - thymeleaf-spring4 - ${org.thymeleaf-version} - - - - - org.freemarker - freemarker - ${freemarker.version} - - - org.springframework - spring-context-support - ${spring.version} - - - - - org.codehaus.groovy - groovy-templates - ${groovy.version} - - - - - de.neuland-bfi - spring-jade4j - ${jade.version} - - - - org.apache.tiles - tiles-jsp - ${apache-tiles.version} - - - - - org.springframework - spring-test - ${spring.version} - test - - - com.rometools - rome - ${rome.version} - - - com.thoughtworks.xstream - xstream - ${xstream.version} - - - com.github.scribejava - scribejava-apis - ${scribejava.version} - - - org.json - json - ${json.version} - - - org.apache.maven.surefire - surefire-logger-api - ${maven-surefire-plugin.version} - - test - true - - - - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - src/main/webapp - springMvcSimple - false - ${deploy-path} - - - - - spring-mvc-simple - - - - 1.8 - 1.8 - 2.21.0 - 2.3.2-b02 - 4.0.0 - 6.0.10.Final - enter-location-of-server - 1.3.2 - 3.0.7.RELEASE - 2.4.12 - 2.3.27-incubating - 1.2.5 - 1.9.0 - 1.4.9 - 5.1.0 - 20180130 - 3.0.8 - 1.6.1 - - - diff --git a/spring-mvc-simple/src/main/resources/application.properties b/spring-mvc-simple/src/main/resources/application.properties deleted file mode 100644 index 9a804c07d8..0000000000 --- a/spring-mvc-simple/src/main/resources/application.properties +++ /dev/null @@ -1,22 +0,0 @@ -#this property file will have to be loaded explicitly as this is not a Spring Boot project - -# Gmail SMTP -spring.mail.host=smtp.gmail.com -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 - -# Amazon SES SMTP -#spring.mail.host=email-smtp.us-west-2.amazonaws.com -#spring.mail.username=username -#spring.mail.password=password -#spring.mail.properties.mail.transport.protocol=smtp -#spring.mail.properties.mail.smtp.port=25 -#spring.mail.properties.mail.smtp.auth=true -#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 diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/pom.xml b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/pom.xml index 1f6181a365..20680d5880 100644 --- a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/pom.xml +++ b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/pom.xml @@ -31,7 +31,7 @@ com.caucho hessian - 4.0.38 + ${hessian.version} @@ -58,5 +58,8 @@ + + 4.0.38 + \ No newline at end of file diff --git a/spring-rest-hal-browser/pom.xml b/spring-rest-hal-browser/pom.xml index 94ce837b27..adef8bf2b0 100644 --- a/spring-rest-hal-browser/pom.xml +++ b/spring-rest-hal-browser/pom.xml @@ -19,25 +19,25 @@ org.springframework.boot spring-boot-starter-web - 2.0.3.RELEASE + ${spring-boot.version} org.springframework.boot spring-boot-starter-data-jpa - 2.0.3.RELEASE + ${spring-boot.version} org.springframework.data spring-data-rest-hal-browser - 3.0.8.RELEASE + ${spring-data.version} com.h2database h2 - 1.4.197 + ${h2.version} @@ -47,11 +47,19 @@ org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + ${source.version} + ${target.version} + + 2.0.3.RELEASE + 3.0.8.RELEASE + 1.4.197 + 1.8 + 1.8 + + \ No newline at end of file diff --git a/spring-rest-testing/src/main/java/org/baeldung/persistence/IOperations.java b/spring-rest-testing/src/main/java/com/baeldung/persistence/IOperations.java similarity index 89% rename from spring-rest-testing/src/main/java/org/baeldung/persistence/IOperations.java rename to spring-rest-testing/src/main/java/com/baeldung/persistence/IOperations.java index 0b617bf7ab..73100ec64f 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/persistence/IOperations.java +++ b/spring-rest-testing/src/main/java/com/baeldung/persistence/IOperations.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence; +package com.baeldung.persistence; import java.io.Serializable; import java.util.List; diff --git a/spring-rest-testing/src/main/java/org/baeldung/persistence/dao/IFooDao.java b/spring-rest-testing/src/main/java/com/baeldung/persistence/dao/IFooDao.java similarity index 81% rename from spring-rest-testing/src/main/java/org/baeldung/persistence/dao/IFooDao.java rename to spring-rest-testing/src/main/java/com/baeldung/persistence/dao/IFooDao.java index 230abd0d5f..8d47d2eb42 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/persistence/dao/IFooDao.java +++ b/spring-rest-testing/src/main/java/com/baeldung/persistence/dao/IFooDao.java @@ -1,6 +1,6 @@ -package org.baeldung.persistence.dao; +package com.baeldung.persistence.dao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Foo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/spring-rest-testing/src/main/java/org/baeldung/persistence/model/Foo.java b/spring-rest-testing/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 97% rename from spring-rest-testing/src/main/java/org/baeldung/persistence/model/Foo.java rename to spring-rest-testing/src/main/java/com/baeldung/persistence/model/Foo.java index 8e1dee33e8..9af3d07bed 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/spring-rest-testing/src/main/java/com/baeldung/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; diff --git a/spring-rest-testing/src/main/java/org/baeldung/persistence/model/User.java b/spring-rest-testing/src/main/java/com/baeldung/persistence/model/User.java similarity index 97% rename from spring-rest-testing/src/main/java/org/baeldung/persistence/model/User.java rename to spring-rest-testing/src/main/java/com/baeldung/persistence/model/User.java index 670d4a2e74..dbc2b9360f 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/persistence/model/User.java +++ b/spring-rest-testing/src/main/java/com/baeldung/persistence/model/User.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/spring-rest-testing/src/main/java/com/baeldung/persistence/service/IFooService.java b/spring-rest-testing/src/main/java/com/baeldung/persistence/service/IFooService.java new file mode 100644 index 0000000000..15330550a1 --- /dev/null +++ b/spring-rest-testing/src/main/java/com/baeldung/persistence/service/IFooService.java @@ -0,0 +1,10 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.IOperations; + +public interface IFooService extends IOperations { + + Foo retrieveByName(String name); + +} diff --git a/spring-rest-testing/src/main/java/org/baeldung/persistence/service/common/AbstractService.java b/spring-rest-testing/src/main/java/com/baeldung/persistence/service/common/AbstractService.java similarity index 90% rename from spring-rest-testing/src/main/java/org/baeldung/persistence/service/common/AbstractService.java rename to spring-rest-testing/src/main/java/com/baeldung/persistence/service/common/AbstractService.java index ceefbbe0e3..5a5d9d6241 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/persistence/service/common/AbstractService.java +++ b/spring-rest-testing/src/main/java/com/baeldung/persistence/service/common/AbstractService.java @@ -1,9 +1,9 @@ -package org.baeldung.persistence.service.common; +package com.baeldung.persistence.service.common; import java.io.Serializable; import java.util.List; -import org.baeldung.persistence.IOperations; +import com.baeldung.persistence.IOperations; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.transaction.annotation.Transactional; diff --git a/spring-rest-testing/src/main/java/org/baeldung/persistence/service/impl/FooService.java b/spring-rest-testing/src/main/java/com/baeldung/persistence/service/impl/FooService.java similarity index 73% rename from spring-rest-testing/src/main/java/org/baeldung/persistence/service/impl/FooService.java rename to spring-rest-testing/src/main/java/com/baeldung/persistence/service/impl/FooService.java index 32fe1bd7e0..92fb6c28a0 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/persistence/service/impl/FooService.java +++ b/spring-rest-testing/src/main/java/com/baeldung/persistence/service/impl/FooService.java @@ -1,9 +1,9 @@ -package org.baeldung.persistence.service.impl; +package com.baeldung.persistence.service.impl; -import org.baeldung.persistence.dao.IFooDao; -import org.baeldung.persistence.model.Foo; -import org.baeldung.persistence.service.IFooService; -import org.baeldung.persistence.service.common.AbstractService; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.persistence.service.common.AbstractService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Service; diff --git a/spring-rest-testing/src/main/java/org/baeldung/spring/Application.java b/spring-rest-testing/src/main/java/com/baeldung/spring/Application.java similarity index 95% rename from spring-rest-testing/src/main/java/org/baeldung/spring/Application.java rename to spring-rest-testing/src/main/java/com/baeldung/spring/Application.java index ca72a4ef56..c35c4d7e5e 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/spring/Application.java +++ b/spring-rest-testing/src/main/java/com/baeldung/spring/Application.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -19,7 +19,7 @@ import org.springframework.web.context.request.RequestContextListener; */ @EnableScheduling @EnableAutoConfiguration -@ComponentScan("org.baeldung") +@ComponentScan("com.baeldung") @SpringBootApplication public class Application extends SpringBootServletInitializer { diff --git a/spring-rest-testing/src/main/java/org/baeldung/spring/PersistenceConfig.java b/spring-rest-testing/src/main/java/com/baeldung/spring/PersistenceConfig.java similarity index 94% rename from spring-rest-testing/src/main/java/org/baeldung/spring/PersistenceConfig.java rename to spring-rest-testing/src/main/java/com/baeldung/spring/PersistenceConfig.java index f3a87b189e..4a4b9eee3f 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/spring/PersistenceConfig.java +++ b/spring-rest-testing/src/main/java/com/baeldung/spring/PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import java.util.Properties; @@ -24,9 +24,9 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-${envTarget:h2}.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence" }) // @ImportResource("classpath*:springDataPersistenceConfig.xml") -@EnableJpaRepositories(basePackages = "org.baeldung.persistence.dao") +@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao") public class PersistenceConfig { @Autowired @@ -40,7 +40,7 @@ public class PersistenceConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); // vendorAdapter.set diff --git a/spring-rest-testing/src/main/java/org/baeldung/spring/WebConfig.java b/spring-rest-testing/src/main/java/com/baeldung/spring/WebConfig.java similarity index 94% rename from spring-rest-testing/src/main/java/org/baeldung/spring/WebConfig.java rename to spring-rest-testing/src/main/java/com/baeldung/spring/WebConfig.java index a0db08d93d..e35acb0bf0 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/spring/WebConfig.java +++ b/spring-rest-testing/src/main/java/com/baeldung/spring/WebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -10,7 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration -@ComponentScan("org.baeldung.web") +@ComponentScan("com.baeldung.web") @EnableWebMvc public class WebConfig implements WebMvcConfigurer { diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/controller/FooController.java b/spring-rest-testing/src/main/java/com/baeldung/web/controller/FooController.java similarity index 92% rename from spring-rest-testing/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-rest-testing/src/main/java/com/baeldung/web/controller/FooController.java index caaf422410..b5350c33c1 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/controller/FooController.java @@ -1,12 +1,12 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; -import org.baeldung.persistence.model.Foo; -import org.baeldung.persistence.service.IFooService; -import org.baeldung.web.util.RestPreconditions; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.web.util.RestPreconditions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/controller/HomeController.java b/spring-rest-testing/src/main/java/com/baeldung/web/controller/HomeController.java similarity index 87% rename from spring-rest-testing/src/main/java/org/baeldung/web/controller/HomeController.java rename to spring-rest-testing/src/main/java/com/baeldung/web/controller/HomeController.java index 9c4d14cae3..c82911211a 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/controller/HomeController.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/controller/HomeController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/controller/RootController.java b/spring-rest-testing/src/main/java/com/baeldung/web/controller/RootController.java similarity index 90% rename from spring-rest-testing/src/main/java/org/baeldung/web/controller/RootController.java rename to spring-rest-testing/src/main/java/com/baeldung/web/controller/RootController.java index a66f3d1893..005f6f023b 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/controller/RootController.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/controller/RootController.java @@ -1,9 +1,9 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import java.util.Map; -import org.baeldung.web.metric.IActuatorMetricService; -import org.baeldung.web.metric.IMetricService; +import com.baeldung.web.metric.IActuatorMetricService; +import com.baeldung.web.metric.IMetricService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java b/spring-rest-testing/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java similarity index 92% rename from spring-rest-testing/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java rename to spring-rest-testing/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java index 14b61f9832..fd002efc28 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java @@ -1,4 +1,4 @@ -package org.baeldung.web.exception; +package com.baeldung.web.exception; public final class MyResourceNotFoundException extends RuntimeException { diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/metric/ActuatorMetricService.java b/spring-rest-testing/src/main/java/com/baeldung/web/metric/ActuatorMetricService.java similarity index 99% rename from spring-rest-testing/src/main/java/org/baeldung/web/metric/ActuatorMetricService.java rename to spring-rest-testing/src/main/java/com/baeldung/web/metric/ActuatorMetricService.java index 4dcec17b9e..8c26fa04a0 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/metric/ActuatorMetricService.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/metric/ActuatorMetricService.java @@ -1,4 +1,4 @@ -package org.baeldung.web.metric; +package com.baeldung.web.metric; import java.text.SimpleDateFormat; import java.util.ArrayList; diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/metric/CustomActuatorMetricService.java b/spring-rest-testing/src/main/java/com/baeldung/web/metric/CustomActuatorMetricService.java similarity index 98% rename from spring-rest-testing/src/main/java/org/baeldung/web/metric/CustomActuatorMetricService.java rename to spring-rest-testing/src/main/java/com/baeldung/web/metric/CustomActuatorMetricService.java index cf30686e52..ee17825b7c 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/metric/CustomActuatorMetricService.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/metric/CustomActuatorMetricService.java @@ -1,4 +1,4 @@ -package org.baeldung.web.metric; +package com.baeldung.web.metric; import java.text.SimpleDateFormat; import java.util.ArrayList; diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/metric/IActuatorMetricService.java b/spring-rest-testing/src/main/java/com/baeldung/web/metric/IActuatorMetricService.java similarity index 69% rename from spring-rest-testing/src/main/java/org/baeldung/web/metric/IActuatorMetricService.java rename to spring-rest-testing/src/main/java/com/baeldung/web/metric/IActuatorMetricService.java index 191d347070..60bb43ee00 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/metric/IActuatorMetricService.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/metric/IActuatorMetricService.java @@ -1,4 +1,4 @@ -package org.baeldung.web.metric; +package com.baeldung.web.metric; public interface IActuatorMetricService { Object[][] getGraphData(); diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/metric/ICustomActuatorMetricService.java b/spring-rest-testing/src/main/java/com/baeldung/web/metric/ICustomActuatorMetricService.java similarity index 79% rename from spring-rest-testing/src/main/java/org/baeldung/web/metric/ICustomActuatorMetricService.java rename to spring-rest-testing/src/main/java/com/baeldung/web/metric/ICustomActuatorMetricService.java index 19ab7164ac..5126252e27 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/metric/ICustomActuatorMetricService.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/metric/ICustomActuatorMetricService.java @@ -1,4 +1,4 @@ -package org.baeldung.web.metric; +package com.baeldung.web.metric; public interface ICustomActuatorMetricService { diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/metric/IMetricService.java b/spring-rest-testing/src/main/java/com/baeldung/web/metric/IMetricService.java similarity index 86% rename from spring-rest-testing/src/main/java/org/baeldung/web/metric/IMetricService.java rename to spring-rest-testing/src/main/java/com/baeldung/web/metric/IMetricService.java index 902d6ac811..b8dfa60215 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/metric/IMetricService.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/metric/IMetricService.java @@ -1,4 +1,4 @@ -package org.baeldung.web.metric; +package com.baeldung.web.metric; import java.util.Map; diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricFilter.java b/spring-rest-testing/src/main/java/com/baeldung/web/metric/MetricFilter.java similarity index 98% rename from spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricFilter.java rename to spring-rest-testing/src/main/java/com/baeldung/web/metric/MetricFilter.java index 6c2fb0cb39..dee63b226f 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricFilter.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/metric/MetricFilter.java @@ -1,4 +1,4 @@ -package org.baeldung.web.metric; +package com.baeldung.web.metric; import javax.servlet.Filter; import javax.servlet.FilterChain; diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricService.java b/spring-rest-testing/src/main/java/com/baeldung/web/metric/MetricService.java similarity index 99% rename from spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricService.java rename to spring-rest-testing/src/main/java/com/baeldung/web/metric/MetricService.java index 086068ad8f..fd3cccab3e 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/metric/MetricService.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/metric/MetricService.java @@ -1,4 +1,4 @@ -package org.baeldung.web.metric; +package com.baeldung.web.metric; import java.text.SimpleDateFormat; import java.util.Date; diff --git a/spring-rest-testing/src/main/java/org/baeldung/web/util/RestPreconditions.java b/spring-rest-testing/src/main/java/com/baeldung/web/util/RestPreconditions.java similarity index 93% rename from spring-rest-testing/src/main/java/org/baeldung/web/util/RestPreconditions.java rename to spring-rest-testing/src/main/java/com/baeldung/web/util/RestPreconditions.java index 4f2dedcfa0..93a4ef6a33 100644 --- a/spring-rest-testing/src/main/java/org/baeldung/web/util/RestPreconditions.java +++ b/spring-rest-testing/src/main/java/com/baeldung/web/util/RestPreconditions.java @@ -1,9 +1,8 @@ -package org.baeldung.web.util; +package com.baeldung.web.util; +import com.baeldung.web.exception.MyResourceNotFoundException; import org.springframework.http.HttpStatus; -import org.baeldung.web.exception.MyResourceNotFoundException; - /** * Simple static methods to be called at the start of your own methods to verify correct arguments and state. If the Precondition fails, an {@link HttpStatus} code is thrown */ diff --git a/spring-rest-testing/src/main/java/org/baeldung/persistence/service/IFooService.java b/spring-rest-testing/src/main/java/org/baeldung/persistence/service/IFooService.java deleted file mode 100644 index 60d607b9ef..0000000000 --- a/spring-rest-testing/src/main/java/org/baeldung/persistence/service/IFooService.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.baeldung.persistence.service; - -import org.baeldung.persistence.IOperations; -import org.baeldung.persistence.model.Foo; - -public interface IFooService extends IOperations { - - Foo retrieveByName(String name); - -} diff --git a/spring-rest-testing/src/main/resources/springDataPersistenceConfig.xml b/spring-rest-testing/src/main/resources/springDataPersistenceConfig.xml index d6d0ec6e47..5ea2d9c05b 100644 --- a/spring-rest-testing/src/main/resources/springDataPersistenceConfig.xml +++ b/spring-rest-testing/src/main/resources/springDataPersistenceConfig.xml @@ -7,6 +7,6 @@ http://www.springframework.org/schema/data/jpa/spring-jpa.xsd" > - + \ No newline at end of file diff --git a/spring-rest-testing/src/main/webapp/WEB-INF/web.xml b/spring-rest-testing/src/main/webapp/WEB-INF/web.xml index 5f90c3519f..7129b6b4af 100644 --- a/spring-rest-testing/src/main/webapp/WEB-INF/web.xml +++ b/spring-rest-testing/src/main/webapp/WEB-INF/web.xml @@ -16,7 +16,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring @@ -37,7 +37,7 @@ metricFilter - org.baeldung.web.metric.MetricFilter + com.baeldung.web.metric.MetricFilter diff --git a/spring-rest-testing/src/test/java/org/baeldung/Consts.java b/spring-rest-testing/src/test/java/com/baeldung/Consts.java similarity index 73% rename from spring-rest-testing/src/test/java/org/baeldung/Consts.java rename to spring-rest-testing/src/test/java/com/baeldung/Consts.java index e5f0be160f..e33efd589e 100644 --- a/spring-rest-testing/src/test/java/org/baeldung/Consts.java +++ b/spring-rest-testing/src/test/java/com/baeldung/Consts.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; public interface Consts { int APPLICATION_PORT = 8082; diff --git a/spring-rest-testing/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-testing/src/test/java/com/baeldung/SpringContextIntegrationTest.java similarity index 86% rename from spring-rest-testing/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename to spring-rest-testing/src/test/java/com/baeldung/SpringContextIntegrationTest.java index 35939c992f..155e05b106 100644 --- a/spring-rest-testing/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-rest-testing/src/test/java/com/baeldung/SpringContextIntegrationTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.Application; +import com.baeldung.spring.Application; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/spring-rest-testing/src/test/java/org/baeldung/SpringContextTest.java b/spring-rest-testing/src/test/java/com/baeldung/SpringContextTest.java similarity index 85% rename from spring-rest-testing/src/test/java/org/baeldung/SpringContextTest.java rename to spring-rest-testing/src/test/java/com/baeldung/SpringContextTest.java index 8debddc40a..e023254719 100644 --- a/spring-rest-testing/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-rest-testing/src/test/java/com/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.Application; +import com.baeldung.spring.Application; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/spring-rest-testing/src/test/java/org/baeldung/persistence/PersistenceTestSuite.java b/spring-rest-testing/src/test/java/com/baeldung/persistence/PersistenceTestSuite.java similarity index 71% rename from spring-rest-testing/src/test/java/org/baeldung/persistence/PersistenceTestSuite.java rename to spring-rest-testing/src/test/java/com/baeldung/persistence/PersistenceTestSuite.java index fb0fd00bb5..77c74b15e4 100644 --- a/spring-rest-testing/src/test/java/org/baeldung/persistence/PersistenceTestSuite.java +++ b/spring-rest-testing/src/test/java/com/baeldung/persistence/PersistenceTestSuite.java @@ -1,6 +1,6 @@ -package org.baeldung.persistence; +package com.baeldung.persistence; -import org.baeldung.persistence.service.FooServicePersistenceIntegrationTest; +import com.baeldung.persistence.service.FooServicePersistenceIntegrationTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; diff --git a/spring-rest-testing/src/test/java/org/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java b/spring-rest-testing/src/test/java/com/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java similarity index 97% rename from spring-rest-testing/src/test/java/org/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java rename to spring-rest-testing/src/test/java/com/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java index 79889e0f9e..e66e9d49e2 100644 --- a/spring-rest-testing/src/test/java/org/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java +++ b/spring-rest-testing/src/test/java/com/baeldung/persistence/service/AbstractServicePersistenceIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.service; +package com.baeldung.persistence.service; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.hamcrest.Matchers.hasItem; @@ -11,9 +11,9 @@ import static org.junit.Assert.assertThat; import java.io.Serializable; import java.util.List; -import org.baeldung.persistence.IOperations; -import org.baeldung.persistence.model.Foo; -import org.baeldung.util.IDUtil; +import com.baeldung.util.IDUtil; +import com.baeldung.persistence.IOperations; +import com.baeldung.persistence.model.Foo; import org.hamcrest.Matchers; import org.junit.Ignore; import org.junit.Test; diff --git a/spring-rest-testing/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/spring-rest-testing/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java similarity index 93% rename from spring-rest-testing/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java rename to spring-rest-testing/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java index 089d2d13a2..24f46b9c8f 100644 --- a/spring-rest-testing/src/test/java/org/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java +++ b/spring-rest-testing/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java @@ -1,11 +1,11 @@ -package org.baeldung.persistence.service; +package com.baeldung.persistence.service; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.junit.Assert.assertNotNull; -import org.baeldung.persistence.IOperations; -import org.baeldung.persistence.model.Foo; -import org.baeldung.spring.PersistenceConfig; +import com.baeldung.persistence.IOperations; +import com.baeldung.persistence.model.Foo; +import com.baeldung.spring.PersistenceConfig; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-rest-testing/src/test/java/org/baeldung/util/IDUtil.java b/spring-rest-testing/src/test/java/com/baeldung/util/IDUtil.java similarity index 96% rename from spring-rest-testing/src/test/java/org/baeldung/util/IDUtil.java rename to spring-rest-testing/src/test/java/com/baeldung/util/IDUtil.java index 85ab623e5f..45e72e046d 100644 --- a/spring-rest-testing/src/test/java/org/baeldung/util/IDUtil.java +++ b/spring-rest-testing/src/test/java/com/baeldung/util/IDUtil.java @@ -1,4 +1,4 @@ -package org.baeldung.util; +package com.baeldung.util; import java.util.Random; diff --git a/spring-resttemplate/pom.xml b/spring-resttemplate/pom.xml index 0b5d0b20d0..138fde3b45 100644 --- a/spring-resttemplate/pom.xml +++ b/spring-resttemplate/pom.xml @@ -125,7 +125,7 @@ junit junit - 4.12 + ${junit.version} @@ -162,10 +162,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.7.0 + ${maven.version} - 1.8 - 1.8 + ${source.version} + ${target.version} @@ -308,6 +308,10 @@ 3.4.1 3.5.11 + 1.8 + 1.8 + 4.12 + 3.7.0 diff --git a/spring-scheduling/src/main/java/org/baeldung/async/AsyncComponent.java b/spring-scheduling/src/main/java/com/baeldung/async/AsyncComponent.java similarity index 97% rename from spring-scheduling/src/main/java/org/baeldung/async/AsyncComponent.java rename to spring-scheduling/src/main/java/com/baeldung/async/AsyncComponent.java index 8503f75c8f..7d18b8b784 100644 --- a/spring-scheduling/src/main/java/org/baeldung/async/AsyncComponent.java +++ b/spring-scheduling/src/main/java/com/baeldung/async/AsyncComponent.java @@ -1,4 +1,4 @@ -package org.baeldung.async; +package com.baeldung.async; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncResult; diff --git a/spring-scheduling/src/main/java/org/baeldung/async/CustomAsyncExceptionHandler.java b/spring-scheduling/src/main/java/com/baeldung/async/CustomAsyncExceptionHandler.java similarity index 95% rename from spring-scheduling/src/main/java/org/baeldung/async/CustomAsyncExceptionHandler.java rename to spring-scheduling/src/main/java/com/baeldung/async/CustomAsyncExceptionHandler.java index a7a177f8fe..ba95f000a2 100644 --- a/spring-scheduling/src/main/java/org/baeldung/async/CustomAsyncExceptionHandler.java +++ b/spring-scheduling/src/main/java/com/baeldung/async/CustomAsyncExceptionHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.async; +package com.baeldung.async; import java.lang.reflect.Method; diff --git a/spring-scheduling/src/main/java/org/baeldung/async/config/SpringAsyncConfig.java b/spring-scheduling/src/main/java/com/baeldung/async/config/SpringAsyncConfig.java similarity index 89% rename from spring-scheduling/src/main/java/org/baeldung/async/config/SpringAsyncConfig.java rename to spring-scheduling/src/main/java/com/baeldung/async/config/SpringAsyncConfig.java index 0676258207..56fa643017 100644 --- a/spring-scheduling/src/main/java/org/baeldung/async/config/SpringAsyncConfig.java +++ b/spring-scheduling/src/main/java/com/baeldung/async/config/SpringAsyncConfig.java @@ -1,8 +1,8 @@ -package org.baeldung.async.config; +package com.baeldung.async.config; import java.util.concurrent.Executor; -import org.baeldung.async.CustomAsyncExceptionHandler; +import com.baeldung.async.CustomAsyncExceptionHandler; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -14,7 +14,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Configuration @EnableAsync() -@ComponentScan("org.baeldung.async") +@ComponentScan("com.baeldung.async") public class SpringAsyncConfig implements AsyncConfigurer { @Bean(name = "threadPoolTaskExecutor") diff --git a/spring-scheduling/src/main/java/org/baeldung/scheduling/ScheduledAnnotationExample.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/ScheduledAnnotationExample.java similarity index 98% rename from spring-scheduling/src/main/java/org/baeldung/scheduling/ScheduledAnnotationExample.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/ScheduledAnnotationExample.java index 23bbee3bc3..892347d615 100644 --- a/spring-scheduling/src/main/java/org/baeldung/scheduling/ScheduledAnnotationExample.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/ScheduledAnnotationExample.java @@ -1,4 +1,4 @@ -package org.baeldung.scheduling; +package com.baeldung.scheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; diff --git a/spring-scheduling/src/main/java/org/baeldung/scheduling/SchedulingWithXmlConfig.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/SchedulingWithXmlConfig.java similarity index 93% rename from spring-scheduling/src/main/java/org/baeldung/scheduling/SchedulingWithXmlConfig.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/SchedulingWithXmlConfig.java index d7da9ac19c..54856442f4 100644 --- a/spring-scheduling/src/main/java/org/baeldung/scheduling/SchedulingWithXmlConfig.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/SchedulingWithXmlConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.scheduling; +package com.baeldung.scheduling; public class SchedulingWithXmlConfig { diff --git a/spring-scheduling/src/main/java/org/baeldung/scheduling/SpringSchedulingConfig.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/SpringSchedulingConfig.java similarity index 90% rename from spring-scheduling/src/main/java/org/baeldung/scheduling/SpringSchedulingConfig.java rename to spring-scheduling/src/main/java/com/baeldung/scheduling/SpringSchedulingConfig.java index 1d81fa0aa8..5d7f1cf88f 100644 --- a/spring-scheduling/src/main/java/org/baeldung/scheduling/SpringSchedulingConfig.java +++ b/spring-scheduling/src/main/java/com/baeldung/scheduling/SpringSchedulingConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.scheduling; +package com.baeldung.scheduling; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -9,7 +9,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @Configuration @EnableScheduling -@ComponentScan("org.baeldung.scheduling") +@ComponentScan("com.baeldung.scheduling") @PropertySource("classpath:springScheduled.properties") public class SpringSchedulingConfig { diff --git a/spring-scheduling/src/main/java/com/baeldung/scheduling/SpringSchedulingFixedRateConfig.java b/spring-scheduling/src/main/java/com/baeldung/scheduling/SpringSchedulingFixedRateConfig.java deleted file mode 100644 index 6000f75ec2..0000000000 --- a/spring-scheduling/src/main/java/com/baeldung/scheduling/SpringSchedulingFixedRateConfig.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.scheduling; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.EnableScheduling; - -@Configuration -@EnableScheduling -@ComponentScan("com.baeldung.scheduling") -public class SpringSchedulingFixedRateConfig { - -} \ No newline at end of file diff --git a/spring-scheduling/src/main/java/org/baeldung/springretry/AppConfig.java b/spring-scheduling/src/main/java/com/baeldung/springretry/AppConfig.java similarity index 92% rename from spring-scheduling/src/main/java/org/baeldung/springretry/AppConfig.java rename to spring-scheduling/src/main/java/com/baeldung/springretry/AppConfig.java index d9b081578c..e79beb370b 100644 --- a/spring-scheduling/src/main/java/org/baeldung/springretry/AppConfig.java +++ b/spring-scheduling/src/main/java/com/baeldung/springretry/AppConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.springretry; +package com.baeldung.springretry; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -9,7 +9,7 @@ import org.springframework.retry.policy.SimpleRetryPolicy; import org.springframework.retry.support.RetryTemplate; @Configuration -@ComponentScan(basePackages = "org.baeldung.springretry") +@ComponentScan(basePackages = "com.baeldung.springretry") @EnableRetry // Uncomment this two lines if we need XML configuration // @EnableAspectJAutoProxy diff --git a/spring-scheduling/src/main/java/org/baeldung/springretry/DefaultListenerSupport.java b/spring-scheduling/src/main/java/com/baeldung/springretry/DefaultListenerSupport.java similarity index 96% rename from spring-scheduling/src/main/java/org/baeldung/springretry/DefaultListenerSupport.java rename to spring-scheduling/src/main/java/com/baeldung/springretry/DefaultListenerSupport.java index bc251b4c2f..0f9f1b6f0d 100644 --- a/spring-scheduling/src/main/java/org/baeldung/springretry/DefaultListenerSupport.java +++ b/spring-scheduling/src/main/java/com/baeldung/springretry/DefaultListenerSupport.java @@ -1,4 +1,4 @@ -package org.baeldung.springretry; +package com.baeldung.springretry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-scheduling/src/main/java/org/baeldung/springretry/MyService.java b/spring-scheduling/src/main/java/com/baeldung/springretry/MyService.java similarity index 93% rename from spring-scheduling/src/main/java/org/baeldung/springretry/MyService.java rename to spring-scheduling/src/main/java/com/baeldung/springretry/MyService.java index 6306ff3c26..409bf25845 100644 --- a/spring-scheduling/src/main/java/org/baeldung/springretry/MyService.java +++ b/spring-scheduling/src/main/java/com/baeldung/springretry/MyService.java @@ -1,4 +1,4 @@ -package org.baeldung.springretry; +package com.baeldung.springretry; import java.sql.SQLException; diff --git a/spring-scheduling/src/main/java/org/baeldung/springretry/MyServiceImpl.java b/spring-scheduling/src/main/java/com/baeldung/springretry/MyServiceImpl.java similarity index 96% rename from spring-scheduling/src/main/java/org/baeldung/springretry/MyServiceImpl.java rename to spring-scheduling/src/main/java/com/baeldung/springretry/MyServiceImpl.java index 1b698f26c9..3e4b5ed00d 100644 --- a/spring-scheduling/src/main/java/org/baeldung/springretry/MyServiceImpl.java +++ b/spring-scheduling/src/main/java/com/baeldung/springretry/MyServiceImpl.java @@ -1,4 +1,4 @@ -package org.baeldung.springretry; +package com.baeldung.springretry; import java.sql.SQLException; diff --git a/spring-scheduling/src/main/java/org/baeldung/taskscheduler/ThreadPoolTaskSchedulerConfig.java b/spring-scheduling/src/main/java/com/baeldung/taskscheduler/ThreadPoolTaskSchedulerConfig.java similarity index 93% rename from spring-scheduling/src/main/java/org/baeldung/taskscheduler/ThreadPoolTaskSchedulerConfig.java rename to spring-scheduling/src/main/java/com/baeldung/taskscheduler/ThreadPoolTaskSchedulerConfig.java index 342a5fe3e6..c24c701df5 100644 --- a/spring-scheduling/src/main/java/org/baeldung/taskscheduler/ThreadPoolTaskSchedulerConfig.java +++ b/spring-scheduling/src/main/java/com/baeldung/taskscheduler/ThreadPoolTaskSchedulerConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.taskscheduler; +package com.baeldung.taskscheduler; import java.util.concurrent.TimeUnit; @@ -10,7 +10,7 @@ import org.springframework.scheduling.support.CronTrigger; import org.springframework.scheduling.support.PeriodicTrigger; @Configuration -@ComponentScan(basePackages = "org.baeldung.taskscheduler", basePackageClasses = { ThreadPoolTaskSchedulerExamples.class }) +@ComponentScan(basePackages = "com.baeldung.taskscheduler", basePackageClasses = { ThreadPoolTaskSchedulerExamples.class }) public class ThreadPoolTaskSchedulerConfig { @Bean diff --git a/spring-scheduling/src/main/java/org/baeldung/taskscheduler/ThreadPoolTaskSchedulerExamples.java b/spring-scheduling/src/main/java/com/baeldung/taskscheduler/ThreadPoolTaskSchedulerExamples.java similarity index 97% rename from spring-scheduling/src/main/java/org/baeldung/taskscheduler/ThreadPoolTaskSchedulerExamples.java rename to spring-scheduling/src/main/java/com/baeldung/taskscheduler/ThreadPoolTaskSchedulerExamples.java index 5d72ed148a..c0c6f37507 100644 --- a/spring-scheduling/src/main/java/org/baeldung/taskscheduler/ThreadPoolTaskSchedulerExamples.java +++ b/spring-scheduling/src/main/java/com/baeldung/taskscheduler/ThreadPoolTaskSchedulerExamples.java @@ -1,4 +1,4 @@ -package org.baeldung.taskscheduler; +package com.baeldung.taskscheduler; import java.util.Date; diff --git a/spring-scheduling/src/main/resources/retryadvice.xml b/spring-scheduling/src/main/resources/retryadvice.xml index 79a9fc8660..8de7801a58 100644 --- a/spring-scheduling/src/main/resources/retryadvice.xml +++ b/spring-scheduling/src/main/resources/retryadvice.xml @@ -7,7 +7,7 @@ http://www.springframework.org/schema/beans/spring-beans.xsd"> + expression="execution(* com.baeldung.springretry..*MyService.defaultXmlRetryService(..))" /> diff --git a/spring-scheduling/src/main/resources/springAsync-config.xml b/spring-scheduling/src/main/resources/springAsync-config.xml index 40fc40c79f..48bfbb3f41 100644 --- a/spring-scheduling/src/main/resources/springAsync-config.xml +++ b/spring-scheduling/src/main/resources/springAsync-config.xml @@ -10,6 +10,6 @@ - + \ No newline at end of file diff --git a/spring-scheduling/src/main/resources/springScheduled-config.xml b/spring-scheduling/src/main/resources/springScheduled-config.xml index 4078f535da..1e42b118bd 100644 --- a/spring-scheduling/src/main/resources/springScheduled-config.xml +++ b/spring-scheduling/src/main/resources/springScheduled-config.xml @@ -16,7 +16,7 @@ - + [] getRootConfigClasses() { - // TODO Auto-generated method stub return null; } @Override protected Class[] getServletConfigClasses() { - // TODO Auto-generated method stub return null; } @Override protected String[] getServletMappings() { - // TODO Auto-generated method stub return null; } } diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/auditing/ExposeAttemptedPathAuthorizationAuditListener.java similarity index 97% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/auditing/ExposeAttemptedPathAuthorizationAuditListener.java index 615d14584f..d238c157df 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/ExposeAttemptedPathAuthorizationAuditListener.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/auditing/ExposeAttemptedPathAuthorizationAuditListener.java @@ -1,4 +1,4 @@ -package com.baeldung.auditing; +package com.baeldung.app.auditing; import org.springframework.boot.actuate.audit.AuditEvent; import org.springframework.boot.actuate.security.AbstractAuthorizationAuditListener; diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/LoginAttemptsLogger.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/auditing/LoginAttemptsLogger.java similarity index 96% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/LoginAttemptsLogger.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/auditing/LoginAttemptsLogger.java index d06c3e24e1..e775006953 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/auditing/LoginAttemptsLogger.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/auditing/LoginAttemptsLogger.java @@ -1,4 +1,4 @@ -package com.baeldung.auditing; +package com.baeldung.app.auditing; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/DatabaseLoader.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/config/DatabaseLoader.java similarity index 85% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/DatabaseLoader.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/config/DatabaseLoader.java index 7f22c3ec99..9d06d5f7ac 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/DatabaseLoader.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/config/DatabaseLoader.java @@ -1,11 +1,11 @@ -package com.baeldung.config; +package com.baeldung.app.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; -import com.baeldung.entity.Task; -import com.baeldung.repository.TaskRepository; +import com.baeldung.app.entity.Task; +import com.baeldung.app.repository.TaskRepository; @Component public class DatabaseLoader implements CommandLineRunner { diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/WebSecurityConfig.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/config/WebSecurityConfig.java similarity index 98% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/WebSecurityConfig.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/config/WebSecurityConfig.java index be11a0fde5..15af160135 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/config/WebSecurityConfig.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/config/WebSecurityConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.config; +package com.baeldung.app.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/controller/TaskController.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/controller/TaskController.java similarity index 89% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/controller/TaskController.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/controller/TaskController.java index 91156354b1..a084f14eca 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/controller/TaskController.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/controller/TaskController.java @@ -1,4 +1,4 @@ -package com.baeldung.controller; +package com.baeldung.app.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import com.baeldung.entity.Task; -import com.baeldung.service.TaskService; +import com.baeldung.app.entity.Task; +import com.baeldung.app.service.TaskService; @Controller @RequestMapping("api/tasks") diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/entity/Task.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/entity/Task.java similarity index 96% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/entity/Task.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/entity/Task.java index 9103c342cc..d2a8a1383d 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/entity/Task.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/entity/Task.java @@ -1,4 +1,4 @@ -package com.baeldung.entity; +package com.baeldung.app.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filter/CustomFilter.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/filter/CustomFilter.java similarity index 96% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/filter/CustomFilter.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/filter/CustomFilter.java index e748b373b7..7229e4606f 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filter/CustomFilter.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/filter/CustomFilter.java @@ -1,4 +1,4 @@ -package com.baeldung.filter; +package com.baeldung.app.filter; import java.io.IOException; diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/repository/TaskRepository.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/repository/TaskRepository.java similarity index 64% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/repository/TaskRepository.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/repository/TaskRepository.java index afb999719c..ac0f850891 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/repository/TaskRepository.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/repository/TaskRepository.java @@ -1,8 +1,8 @@ -package com.baeldung.repository; +package com.baeldung.app.repository; import org.springframework.data.repository.CrudRepository; -import com.baeldung.entity.Task; +import com.baeldung.app.entity.Task; public interface TaskRepository extends CrudRepository { diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/service/TaskService.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/service/TaskService.java similarity index 85% rename from spring-security-modules/spring-security-core/src/main/java/com/baeldung/service/TaskService.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/service/TaskService.java index 1269eb4fd0..20d53ac77a 100644 --- a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/service/TaskService.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/app/service/TaskService.java @@ -1,12 +1,12 @@ -package com.baeldung.service; +package com.baeldung.app.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PostFilter; import org.springframework.security.access.prepost.PreFilter; import org.springframework.stereotype.Service; -import com.baeldung.entity.Task; -import com.baeldung.repository.TaskRepository; +import com.baeldung.app.entity.Task; +import com.baeldung.app.repository.TaskRepository; @Service public class TaskService { diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/CustomPermissionAllowedMethodSecurityMetadataSource.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/CustomPermissionAllowedMethodSecurityMetadataSource.java new file mode 100644 index 0000000000..4bde3f5aa3 --- /dev/null +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/CustomPermissionAllowedMethodSecurityMetadataSource.java @@ -0,0 +1,49 @@ +package com.baeldung.denyonmissing; + +import static org.springframework.security.access.annotation.Jsr250SecurityConfig.DENY_ALL_ATTRIBUTE; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.security.access.ConfigAttribute; +import org.springframework.security.access.method.AbstractFallbackMethodSecurityMetadataSource; +import org.springframework.security.access.prepost.PostAuthorize; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Controller; + +public class CustomPermissionAllowedMethodSecurityMetadataSource extends AbstractFallbackMethodSecurityMetadataSource { + @Override + protected Collection findAttributes(Class clazz) { + return null; + } + + @Override + protected Collection findAttributes(Method method, Class targetClass) { + Annotation[] annotations = AnnotationUtils.getAnnotations(method); + List attributes = new ArrayList<>(); + + // if the class is annotated as @Controller we should by default deny access to every method + if (AnnotationUtils.findAnnotation(targetClass, Controller.class) != null) { + attributes.add(DENY_ALL_ATTRIBUTE); + } + + if (annotations != null) { + for (Annotation a : annotations) { + // but not if the method has at least a PreAuthorize or PostAuthorize annotation + if (a instanceof PreAuthorize || a instanceof PostAuthorize) { + return null; + } + } + } + return attributes; + } + + @Override + public Collection getAllConfigAttributes() { + return null; + } +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyApplication.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyApplication.java new file mode 100644 index 0000000000..d5d28ae210 --- /dev/null +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyApplication.java @@ -0,0 +1,11 @@ +package com.baeldung.denyonmissing; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DenyApplication { + public static void main(String[] args) { + SpringApplication.run(DenyApplication.class, args); + } +} diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyMethodSecurityConfig.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyMethodSecurityConfig.java new file mode 100644 index 0000000000..695f81eb54 --- /dev/null +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyMethodSecurityConfig.java @@ -0,0 +1,29 @@ +package com.baeldung.denyonmissing; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.access.method.MethodSecurityMetadataSource; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.provisioning.InMemoryUserDetailsManager; + +@Configuration +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true) +public class DenyMethodSecurityConfig extends GlobalMethodSecurityConfiguration { + @Override + protected MethodSecurityMetadataSource customMethodSecurityMetadataSource() { + return new CustomPermissionAllowedMethodSecurityMetadataSource(); + } + + @Bean + public UserDetailsService userDetailsService() { + return new InMemoryUserDetailsManager( + User.withUsername("user").password("{noop}password").roles("USER").build(), + User.withUsername("guest").password("{noop}password").roles().build() + ); + } +} diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyOnMissingController.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyOnMissingController.java new file mode 100644 index 0000000000..ef8881d3b7 --- /dev/null +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/denyonmissing/DenyOnMissingController.java @@ -0,0 +1,19 @@ +package com.baeldung.denyonmissing; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class DenyOnMissingController { + @GetMapping(path = "hello") + @PreAuthorize("hasRole('USER')") + public String hello() { + return "Hello world!"; + } + + @GetMapping(path = "bye") + public String bye() { + return "Bye bye world!"; + } +} diff --git a/spring-security-modules/spring-security-core/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/app/SpringContextTest.java similarity index 93% rename from spring-security-modules/spring-security-core/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/app/SpringContextTest.java index bca6450fb1..b3c31a936a 100644 --- a/spring-security-modules/spring-security-core/src/test/java/com/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/app/SpringContextTest.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.app; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-security-modules/spring-security-core/src/test/java/com/baeldung/test/LiveTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/app/test/LiveTest.java similarity index 96% rename from spring-security-modules/spring-security-core/src/test/java/com/baeldung/test/LiveTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/app/test/LiveTest.java index 6bcb2e8f0f..d099173395 100644 --- a/spring-security-modules/spring-security-core/src/test/java/com/baeldung/test/LiveTest.java +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/app/test/LiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.test; +package com.baeldung.app.test; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; @@ -22,7 +22,7 @@ import org.springframework.web.context.WebApplicationContext; import com.baeldung.app.App; @RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = App.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = App.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class LiveTest { diff --git a/spring-security-modules/spring-security-core/src/test/java/com/baeldung/denyonmissing/DenyOnMissingControllerIntegrationTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/denyonmissing/DenyOnMissingControllerIntegrationTest.java new file mode 100644 index 0000000000..b4e4154982 --- /dev/null +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/denyonmissing/DenyOnMissingControllerIntegrationTest.java @@ -0,0 +1,53 @@ +package com.baeldung.denyonmissing; + +import static org.hamcrest.core.Is.isA; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = DenyApplication.class) +public class DenyOnMissingControllerIntegrationTest { + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Autowired + private WebApplicationContext context; + private MockMvc mockMvc; + + @Before + public void setUp() { + mockMvc = MockMvcBuilders.webAppContextSetup(context) + .build(); + } + + @Test + @WithMockUser(username = "user") + public void givenANormalUser_whenCallingHello_thenAccessDenied() throws Exception { + mockMvc.perform(get("/hello")) + .andExpect(status().isOk()) + .andExpect(content().string("Hello world!")); + } + + @Test + @WithMockUser(username = "user") + public void givenANormalUser_whenCallingBye_thenAccessDenied() throws Exception { + expectedException.expectCause(isA(AccessDeniedException.class)); + + mockMvc.perform(get("/bye")); + } +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-core/src/test/resources/.gitignore b/spring-security-modules/spring-security-core/src/test/resources/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-security-modules/spring-security-core/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/spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml index 659347f610..6c0f24e2c4 100644 --- a/spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml +++ b/spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml @@ -2,9 +2,9 @@ diff --git a/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml index 516829f5eb..eff3e1a1a1 100644 --- a/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml +++ b/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml @@ -2,9 +2,9 @@ diff --git a/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml index 189522889f..8a83bf5e93 100644 --- a/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml +++ b/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml @@ -2,9 +2,9 @@ diff --git a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml index 4ba9642448..fa2fae4148 100644 --- a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml +++ b/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd" > \ No newline at end of file diff --git a/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml b/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml index aa5488b116..4568d319b8 100644 --- a/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml +++ b/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> diff --git a/spring-security-modules/spring-security-oidc/README.md b/spring-security-modules/spring-security-oidc/README.md new file mode 100644 index 0000000000..92ba60cad9 --- /dev/null +++ b/spring-security-modules/spring-security-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](https://www.baeldung.com/spring-security-openid-connect) + +### 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 YAML files of the project + diff --git a/spring-security-modules/spring-security-oidc/pom.xml b/spring-security-modules/spring-security-oidc/pom.xml new file mode 100644 index 0000000000..91e4641450 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + spring-security-oidc + spring-security-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-web + + + org.springframework.boot + spring-boot-starter-oauth2-client + + + + + 2.2.1.RELEASE + + + diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/discovery/SpringOidcDiscoveryApplication.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/discovery/SpringOidcDiscoveryApplication.java new file mode 100644 index 0000000000..895fe676e1 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/discovery/SpringOidcDiscoveryApplication.java @@ -0,0 +1,20 @@ +package com.baeldung.openid.oidc.discovery; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; + +import com.baeldung.openid.oidc.utils.YamlLoaderInitializer; + +@SpringBootApplication +public class SpringOidcDiscoveryApplication { + + public static void main(String[] args) { + SpringApplication application = new SpringApplication(SpringOidcDiscoveryApplication.class); + ApplicationContextInitializer yamlInitializer = new YamlLoaderInitializer("discovery-application.yml"); + application.addInitializers(yamlInitializer); + application.run(args); + } + +} diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/discovery/web/controllers/UserRestController.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/discovery/web/controllers/UserRestController.java new file mode 100644 index 0000000000..984a23fea3 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/discovery/web/controllers/UserRestController.java @@ -0,0 +1,17 @@ +package com.baeldung.openid.oidc.discovery.web.controllers; + +import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.security.oauth2.core.oidc.user.OidcUser; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/user") +public class UserRestController { + + @GetMapping("/oidc-principal") + public OidcUser getOidcUserPrincipal(@AuthenticationPrincipal OidcUser principal) { + return principal; + } +} diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/SpringOidcLoginApplication.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/SpringOidcLoginApplication.java new file mode 100644 index 0000000000..6ec87c4406 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/SpringOidcLoginApplication.java @@ -0,0 +1,20 @@ +package com.baeldung.openid.oidc.login; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; + +import com.baeldung.openid.oidc.utils.YamlLoaderInitializer; + +@SpringBootApplication +public class SpringOidcLoginApplication { + + public static void main(String[] args) { + SpringApplication application = new SpringApplication(SpringOidcLoginApplication.class); + ApplicationContextInitializer yamlInitializer = new YamlLoaderInitializer("login-application.yml"); + application.addInitializers(yamlInitializer); + application.run(args); + } + +} diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/config/OAuth2LoginSecurityConfig.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/config/OAuth2LoginSecurityConfig.java new file mode 100644 index 0000000000..5bb5cef58c --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/config/OAuth2LoginSecurityConfig.java @@ -0,0 +1,28 @@ +package com.baeldung.openid.oidc.login.config; + +import java.util.HashSet; +import java.util.Set; + +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.oauth2.client.oidc.userinfo.OidcUserService; + +@Configuration +public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {// @formatter:off + + @Override + protected void configure(HttpSecurity http) throws Exception { + Set googleScopes = new HashSet<>(); + googleScopes.add("https://www.googleapis.com/auth/userinfo.email"); + googleScopes.add("https://www.googleapis.com/auth/userinfo.profile"); + + OidcUserService googleUserService = new OidcUserService(); + googleUserService.setAccessibleScopes(googleScopes); + + http.authorizeRequests(authorizeRequests -> authorizeRequests.anyRequest() + .authenticated()) + .oauth2Login(oauthLogin -> oauthLogin.userInfoEndpoint() + .oidcUserService(googleUserService)); + }// @formatter:on +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/service/UserService.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/service/UserService.java new file mode 100644 index 0000000000..b6e35bd139 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/service/UserService.java @@ -0,0 +1,23 @@ +package com.baeldung.openid.oidc.login.service; + +import java.util.Collections; +import java.util.Map; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.core.oidc.user.OidcUser; +import org.springframework.stereotype.Service; + +@Service +public class UserService { + + public Map getUserClaims() { + Authentication authentication = SecurityContextHolder.getContext() + .getAuthentication(); + if (authentication.getPrincipal() instanceof OidcUser) { + OidcUser principal = ((OidcUser) authentication.getPrincipal()); + return principal.getClaims(); + } + return Collections.emptyMap(); + } +} diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/web/controllers/UserRestController.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/web/controllers/UserRestController.java new file mode 100644 index 0000000000..a4715c9310 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/login/web/controllers/UserRestController.java @@ -0,0 +1,32 @@ +package com.baeldung.openid.oidc.login.web.controllers; + +import java.util.Map; + +import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.security.oauth2.core.oidc.user.OidcUser; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.openid.oidc.login.service.UserService; + +@RestController +@RequestMapping("/user") +public class UserRestController { + + private UserService service; + + public UserRestController(UserService service) { + this.service = service; + } + + @GetMapping("/oidc-principal") + public OidcUser getOidcUserPrincipal(@AuthenticationPrincipal OidcUser principal) { + return principal; + } + + @GetMapping("/oidc-claims") + public Map getClaimsFromBean() { + return service.getUserClaims(); + } +} diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/SpringOidcSessionManagementApplication.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/SpringOidcSessionManagementApplication.java new file mode 100644 index 0000000000..700fc7fbe7 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/SpringOidcSessionManagementApplication.java @@ -0,0 +1,20 @@ +package com.baeldung.openid.oidc.sessionmanagement; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; + +import com.baeldung.openid.oidc.utils.YamlLoaderInitializer; + +@SpringBootApplication +public class SpringOidcSessionManagementApplication { + + public static void main(String[] args) { + SpringApplication application = new SpringApplication(SpringOidcSessionManagementApplication.class); + ApplicationContextInitializer yamlInitializer = new YamlLoaderInitializer("sessionmanagement-application.yml"); + application.addInitializers(yamlInitializer); + application.run(args); + } + +} diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/config/OAuth2SessionManagementSecurityConfig.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/config/OAuth2SessionManagementSecurityConfig.java new file mode 100644 index 0000000000..5a55c89b05 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/config/OAuth2SessionManagementSecurityConfig.java @@ -0,0 +1,37 @@ +package com.baeldung.openid.oidc.sessionmanagement.config; + +import java.net.URI; + +import org.springframework.beans.factory.annotation.Autowired; +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.oauth2.client.oidc.web.logout.OidcClientInitiatedLogoutSuccessHandler; +import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; + +@Configuration +public class OAuth2SessionManagementSecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + private ClientRegistrationRepository clientRegistrationRepository; + + @Override + protected void configure(HttpSecurity http) throws Exception { // @formatter:off + http.authorizeRequests(authorizeRequests -> authorizeRequests.mvcMatchers("/home") + .permitAll() + .anyRequest() + .authenticated()) + .oauth2Login(oauthLogin -> oauthLogin.permitAll()) + .logout(logout -> logout.logoutSuccessHandler(oidcLogoutSuccessHandler())); + } // @formatter:on + + + private LogoutSuccessHandler oidcLogoutSuccessHandler() { + OidcClientInitiatedLogoutSuccessHandler oidcLogoutSuccessHandler = new OidcClientInitiatedLogoutSuccessHandler(this.clientRegistrationRepository); + + oidcLogoutSuccessHandler.setPostLogoutRedirectUri(URI.create("http://localhost:8081/home")); + + return oidcLogoutSuccessHandler; + } +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/web/controllers/HomeRestController.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/web/controllers/HomeRestController.java new file mode 100644 index 0000000000..88becc2456 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/web/controllers/HomeRestController.java @@ -0,0 +1,14 @@ +package com.baeldung.openid.oidc.sessionmanagement.web.controllers; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HomeRestController { + + @GetMapping("/home") + public String simpleHomepage() { + return "Welcome to this simple homepage!"; + } + +} diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/web/controllers/UserRestController.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/web/controllers/UserRestController.java new file mode 100644 index 0000000000..256d4bc389 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/sessionmanagement/web/controllers/UserRestController.java @@ -0,0 +1,17 @@ +package com.baeldung.openid.oidc.sessionmanagement.web.controllers; + +import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.security.oauth2.core.oidc.user.OidcUser; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/user") +public class UserRestController { + + @GetMapping("/oidc-principal") + public OidcUser getOidcUserPrincipal(@AuthenticationPrincipal OidcUser principal) { + return principal; + } +} diff --git a/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/utils/YamlLoaderInitializer.java b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/utils/YamlLoaderInitializer.java new file mode 100644 index 0000000000..4d51dcb9a8 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/java/com/baeldung/openid/oidc/utils/YamlLoaderInitializer.java @@ -0,0 +1,48 @@ +package com.baeldung.openid.oidc.utils; + +import java.io.IOException; + +import org.springframework.boot.env.YamlPropertySourceLoader; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.PropertySource; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; + +public class YamlLoaderInitializer implements ApplicationContextInitializer { + + private final YamlPropertySourceLoader loader = new YamlPropertySourceLoader(); + private final String file; + + public YamlLoaderInitializer() { + this.file = null; + } + + public YamlLoaderInitializer(String file) { + this.file = file; + } + + @Override + public void initialize(ConfigurableApplicationContext applicationContext) { + String yamlFile = (this.file == null) ? applicationContext.getEnvironment() + .getProperty("custom.configyaml.file") : this.file; + Resource path = new ClassPathResource(yamlFile); + PropertySource propertySource = loadYaml(path); + applicationContext.getEnvironment() + .getPropertySources() + .addLast(propertySource); + } + + private PropertySource loadYaml(Resource path) { + if (!path.exists()) { + throw new IllegalArgumentException("Resource " + path + " does not exist"); + } + try { + return this.loader.load("custom-resource", path) + .get(0); + } catch (IOException ex) { + throw new IllegalStateException("Failed to load yaml configuration from" + path, ex); + } + } + +} diff --git a/spring-security-modules/spring-security-oidc/src/main/resources/application.yml b/spring-security-modules/spring-security-oidc/src/main/resources/application.yml new file mode 100644 index 0000000000..f303fcecd1 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/resources/application.yml @@ -0,0 +1,7 @@ +server: + port: 8081 + +logging: + level: + org.springframework.web.client.RestTemplate: DEBUG + \ No newline at end of file diff --git a/spring-security-modules/spring-security-oidc/src/main/resources/discovery-application.yml b/spring-security-modules/spring-security-oidc/src/main/resources/discovery-application.yml new file mode 100644 index 0000000000..1cbebbcb7b --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/resources/discovery-application.yml @@ -0,0 +1,11 @@ +spring: + security: + oauth2: + client: + registration: + custom-google: + client-id: + client-secret: + provider: + custom-google: + issuer-uri: https://accounts.google.com \ No newline at end of file diff --git a/spring-security-modules/spring-security-oidc/src/main/resources/login-application.yml b/spring-security-modules/spring-security-oidc/src/main/resources/login-application.yml new file mode 100644 index 0000000000..b3220a0550 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/resources/login-application.yml @@ -0,0 +1,8 @@ +spring: + security: + oauth2: + client: + registration: + google: + client-id: + client-secret: \ No newline at end of file diff --git a/spring-security-modules/spring-security-oidc/src/main/resources/sessionmanagement-application.yml b/spring-security-modules/spring-security-oidc/src/main/resources/sessionmanagement-application.yml new file mode 100644 index 0000000000..d7dd5e6ec7 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/main/resources/sessionmanagement-application.yml @@ -0,0 +1,16 @@ +spring: + security: + oauth2: + client: + registration: + okta: + client-id: + client-secret: + provider: + okta: + issuer-uri: https://dev-123.okta.com + # Or, optionally: + #authorization-uri https://dev-123-admin.okta.com/oauth2/v1/authorize + #token-uri: https://dev-123-admin.okta.com/oauth2/v1/token + #user-info-uri: https://dev-123-admin.okta.com/oauth2/v1/userinfo + #jwk-set-uri: https://dev-123-admin.okta.com/oauth2/v1/keys \ No newline at end of file diff --git a/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/discovery/SpringContextTest.java b/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/discovery/SpringContextTest.java new file mode 100644 index 0000000000..25c87cdc6f --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/discovery/SpringContextTest.java @@ -0,0 +1,19 @@ +package com.baeldung.openid.oidc.discovery; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; + +import com.baeldung.openid.oidc.utils.YamlLoaderInitializer; + +//We'll ignore this test, as we don't want to depend on Google's OIDC-configuration endpoint to be available +@Disabled +@SpringBootTest(classes = SpringOidcDiscoveryApplication.class, properties = "custom.configyaml.file=discovery-application.yml") +@ContextConfiguration(initializers = YamlLoaderInitializer.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/login/SpringContextTest.java b/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/login/SpringContextTest.java new file mode 100644 index 0000000000..675dcd8727 --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/login/SpringContextTest.java @@ -0,0 +1,16 @@ +package com.baeldung.openid.oidc.login; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; + +import com.baeldung.openid.oidc.utils.YamlLoaderInitializer; + +@SpringBootTest(classes = SpringOidcLoginApplication.class, properties = "custom.configyaml.file=login-application.yml") +@ContextConfiguration(initializers = YamlLoaderInitializer.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/sessionmanagement/SpringContextTest.java b/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/sessionmanagement/SpringContextTest.java new file mode 100644 index 0000000000..91ed11fbaf --- /dev/null +++ b/spring-security-modules/spring-security-oidc/src/test/java/com/baeldung/openid/oidc/sessionmanagement/SpringContextTest.java @@ -0,0 +1,19 @@ +package com.baeldung.openid.oidc.sessionmanagement; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; + +import com.baeldung.openid.oidc.utils.YamlLoaderInitializer; + +//We'll ignore this test, as we don't want to depend on the Okta instance OIDC-configuration endpoint to be available +@Disabled +@SpringBootTest(classes = SpringOidcSessionManagementApplication.class, properties = "custom.configyaml.file=sessionmanagement-application.yml") +@ContextConfiguration(initializers = YamlLoaderInitializer.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-modules/spring-security-openid/README.md b/spring-security-modules/spring-security-openid/README.md deleted file mode 100644 index 1f856fe191..0000000000 --- a/spring-security-modules/spring-security-openid/README.md +++ /dev/null @@ -1,24 +0,0 @@ -## Spring Security OpenID - -This module contains articles about OpenID with Spring Security - -### Relevant articles - -- [Spring Security and OpenID Connect](https://www.baeldung.com/spring-security-openid-connect) - -### OpenID Connect with Spring Security - -### Run the Project - -``` -mvn spring-boot:run -``` - -### Obtain Google App - Client ID, Secret - -- You 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) -- Make sure to add OAuth2 credentials by selecting Add credentials > OAuth 2.0 client ID -- Make sure you set redirect URI to http://localhost:8081/google-login - -- Once you have your client id and secret, make sure you add them to the `application.properties` of the project - diff --git a/spring-security-modules/spring-security-openid/pom.xml b/spring-security-modules/spring-security-openid/pom.xml deleted file mode 100644 index 970182dc3b..0000000000 --- a/spring-security-modules/spring-security-openid/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - 4.0.0 - spring-security-openid - spring-security-openid - war - Spring OpenID 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-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java deleted file mode 100644 index 8e9c6e974e..0000000000 --- a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.baeldung.config; - -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; - } - -} diff --git a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/HomeController.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/HomeController.java deleted file mode 100644 index f0a5378019..0000000000 --- a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/HomeController.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.baeldung.config; - -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; - } - -} diff --git a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SecurityConfig.java deleted file mode 100644 index d929bfd631..0000000000 --- a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SecurityConfig.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.baeldung.config; - -import org.baeldung.security.OpenIdConnectFilter; -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-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java deleted file mode 100644 index f12169cb27..0000000000 --- a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.baeldung.security; - -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"); - } - - } -} diff --git a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java b/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java deleted file mode 100644 index f0d91fdc27..0000000000 --- a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.baeldung.security; - -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 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; - } - -} diff --git a/spring-security-modules/spring-security-openid/src/main/resources/application.properties b/spring-security-modules/spring-security-openid/src/main/resources/application.properties deleted file mode 100644 index 49022bf280..0000000000 --- a/spring-security-modules/spring-security-openid/src/main/resources/application.properties +++ /dev/null @@ -1,8 +0,0 @@ -server.port=8081 -google.clientId=TODO -google.clientSecret=TODO -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-openid/src/main/resources/logback.xml b/spring-security-modules/spring-security-openid/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/spring-security-modules/spring-security-openid/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/spring-security-modules/spring-security-openid/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-openid/src/test/java/org/baeldung/SpringContextTest.java deleted file mode 100644 index fa346b2b31..0000000000 --- a/spring-security-modules/spring-security-openid/src/test/java/org/baeldung/SpringContextTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung; - -import org.baeldung.config.SpringOpenidApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringOpenidApplication.class) -public class SpringContextTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java index 6e580e7a22..f440bbd10c 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java @@ -14,7 +14,7 @@ import java.io.PrintWriter; public class MyBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint { @Override - public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException, ServletException { + public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException { response.addHeader("WWW-Authenticate", "Basic realm=\"" + getRealmName() + "\""); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); final PrintWriter writer = response.getWriter(); @@ -22,7 +22,7 @@ public class MyBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoi } @Override - public void afterPropertiesSet() throws Exception { + public void afterPropertiesSet() { setRealmName("Baeldung"); super.afterPropertiesSet(); } diff --git a/spring-shell/src/main/java/org/baeldung/shell/Main.java b/spring-shell/src/main/java/com/baeldung/shell/Main.java similarity index 87% rename from spring-shell/src/main/java/org/baeldung/shell/Main.java rename to spring-shell/src/main/java/com/baeldung/shell/Main.java index 3d9f7a5860..97871394f7 100644 --- a/spring-shell/src/main/java/org/baeldung/shell/Main.java +++ b/spring-shell/src/main/java/com/baeldung/shell/Main.java @@ -1,4 +1,4 @@ -package org.baeldung.shell; +package com.baeldung.shell; import java.io.IOException; import org.springframework.shell.Bootstrap; diff --git a/spring-shell/src/main/java/org/baeldung/shell/simple/SimpleBannerProvider.java b/spring-shell/src/main/java/com/baeldung/shell/simple/SimpleBannerProvider.java similarity index 96% rename from spring-shell/src/main/java/org/baeldung/shell/simple/SimpleBannerProvider.java rename to spring-shell/src/main/java/com/baeldung/shell/simple/SimpleBannerProvider.java index df7a48cd32..dbfde76f8e 100644 --- a/spring-shell/src/main/java/org/baeldung/shell/simple/SimpleBannerProvider.java +++ b/spring-shell/src/main/java/com/baeldung/shell/simple/SimpleBannerProvider.java @@ -1,4 +1,4 @@ -package org.baeldung.shell.simple; +package com.baeldung.shell.simple; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; diff --git a/spring-shell/src/main/java/org/baeldung/shell/simple/SimpleCLI.java b/spring-shell/src/main/java/com/baeldung/shell/simple/SimpleCLI.java similarity index 98% rename from spring-shell/src/main/java/org/baeldung/shell/simple/SimpleCLI.java rename to spring-shell/src/main/java/com/baeldung/shell/simple/SimpleCLI.java index f73d9bda00..d8a0aef838 100644 --- a/spring-shell/src/main/java/org/baeldung/shell/simple/SimpleCLI.java +++ b/spring-shell/src/main/java/com/baeldung/shell/simple/SimpleCLI.java @@ -1,4 +1,4 @@ -package org.baeldung.shell.simple; +package com.baeldung.shell.simple; import java.io.BufferedReader; import java.io.FileNotFoundException; diff --git a/spring-shell/src/main/java/org/baeldung/shell/simple/SimpleHistoryFileNameProvider.java b/spring-shell/src/main/java/com/baeldung/shell/simple/SimpleHistoryFileNameProvider.java similarity index 93% rename from spring-shell/src/main/java/org/baeldung/shell/simple/SimpleHistoryFileNameProvider.java rename to spring-shell/src/main/java/com/baeldung/shell/simple/SimpleHistoryFileNameProvider.java index cef53adc69..5936006f11 100644 --- a/spring-shell/src/main/java/org/baeldung/shell/simple/SimpleHistoryFileNameProvider.java +++ b/spring-shell/src/main/java/com/baeldung/shell/simple/SimpleHistoryFileNameProvider.java @@ -1,4 +1,4 @@ -package org.baeldung.shell.simple; +package com.baeldung.shell.simple; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; diff --git a/spring-shell/src/main/java/org/baeldung/shell/simple/SimplePromptProvider.java b/spring-shell/src/main/java/com/baeldung/shell/simple/SimplePromptProvider.java similarity index 93% rename from spring-shell/src/main/java/org/baeldung/shell/simple/SimplePromptProvider.java rename to spring-shell/src/main/java/com/baeldung/shell/simple/SimplePromptProvider.java index 9a84954e05..a795d19eed 100644 --- a/spring-shell/src/main/java/org/baeldung/shell/simple/SimplePromptProvider.java +++ b/spring-shell/src/main/java/com/baeldung/shell/simple/SimplePromptProvider.java @@ -1,4 +1,4 @@ -package org.baeldung.shell.simple; +package com.baeldung.shell.simple; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; diff --git a/spring-shell/src/main/java/org/baeldung/shell/simple/SimpleURLConverter.java b/spring-shell/src/main/java/com/baeldung/shell/simple/SimpleURLConverter.java similarity index 96% rename from spring-shell/src/main/java/org/baeldung/shell/simple/SimpleURLConverter.java rename to spring-shell/src/main/java/com/baeldung/shell/simple/SimpleURLConverter.java index 4824cfbf05..7615f31ace 100644 --- a/spring-shell/src/main/java/org/baeldung/shell/simple/SimpleURLConverter.java +++ b/spring-shell/src/main/java/com/baeldung/shell/simple/SimpleURLConverter.java @@ -1,4 +1,4 @@ -package org.baeldung.shell.simple; +package com.baeldung.shell.simple; import java.net.MalformedURLException; import java.net.URL; diff --git a/spring-shell/src/main/resources/META-INF/spring/spring-shell-plugin.xml b/spring-shell/src/main/resources/META-INF/spring/spring-shell-plugin.xml index 1b97ab3b59..3ff60f3c08 100644 --- a/spring-shell/src/main/resources/META-INF/spring/spring-shell-plugin.xml +++ b/spring-shell/src/main/resources/META-INF/spring/spring-shell-plugin.xml @@ -8,6 +8,6 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd"> - + \ No newline at end of file diff --git a/spring-shell/src/test/java/org/baeldung/shell/simple/SimpleCLIIntegrationTest.java b/spring-shell/src/test/java/com/baeldung/shell/simple/SimpleCLIIntegrationTest.java similarity index 98% rename from spring-shell/src/test/java/org/baeldung/shell/simple/SimpleCLIIntegrationTest.java rename to spring-shell/src/test/java/com/baeldung/shell/simple/SimpleCLIIntegrationTest.java index 3ec756e238..53627700c5 100644 --- a/spring-shell/src/test/java/org/baeldung/shell/simple/SimpleCLIIntegrationTest.java +++ b/spring-shell/src/test/java/com/baeldung/shell/simple/SimpleCLIIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.shell.simple; +package com.baeldung.shell.simple; import org.junit.AfterClass; import org.junit.Assert; diff --git a/spring-vault/src/main/java/org/baeldung/springvault/Credentials.java b/spring-vault/src/main/java/com/baeldung/springvault/Credentials.java similarity index 93% rename from spring-vault/src/main/java/org/baeldung/springvault/Credentials.java rename to spring-vault/src/main/java/com/baeldung/springvault/Credentials.java index f90ab66a4e..548ebd4ff6 100644 --- a/spring-vault/src/main/java/org/baeldung/springvault/Credentials.java +++ b/spring-vault/src/main/java/com/baeldung/springvault/Credentials.java @@ -1,4 +1,4 @@ -package org.baeldung.springvault; +package com.baeldung.springvault; public class Credentials { diff --git a/spring-vault/src/main/java/org/baeldung/springvault/CredentialsService.java b/spring-vault/src/main/java/com/baeldung/springvault/CredentialsService.java similarity index 76% rename from spring-vault/src/main/java/org/baeldung/springvault/CredentialsService.java rename to spring-vault/src/main/java/com/baeldung/springvault/CredentialsService.java index 87c24bd947..6a4b7cb784 100644 --- a/spring-vault/src/main/java/org/baeldung/springvault/CredentialsService.java +++ b/spring-vault/src/main/java/com/baeldung/springvault/CredentialsService.java @@ -1,16 +1,10 @@ -package org.baeldung.springvault; +package com.baeldung.springvault; -import java.net.URI; import java.net.URISyntaxException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.vault.authentication.TokenAuthentication; -import org.springframework.vault.client.VaultEndpoint; import org.springframework.vault.core.VaultTemplate; -import org.springframework.vault.core.env.VaultPropertySource; -import org.springframework.vault.support.VaultResponse; import org.springframework.vault.support.VaultResponseSupport; /** diff --git a/spring-vault/src/main/java/org/baeldung/springvault/SpringVaultApplication.java b/spring-vault/src/main/java/com/baeldung/springvault/SpringVaultApplication.java similarity index 91% rename from spring-vault/src/main/java/org/baeldung/springvault/SpringVaultApplication.java rename to spring-vault/src/main/java/com/baeldung/springvault/SpringVaultApplication.java index 916a809be5..979b2fb42e 100644 --- a/spring-vault/src/main/java/org/baeldung/springvault/SpringVaultApplication.java +++ b/spring-vault/src/main/java/com/baeldung/springvault/SpringVaultApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.springvault; +package com.baeldung.springvault; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-vault/src/main/java/org/baeldung/springvault/VaultConfig.java b/spring-vault/src/main/java/com/baeldung/springvault/VaultConfig.java similarity index 95% rename from spring-vault/src/main/java/org/baeldung/springvault/VaultConfig.java rename to spring-vault/src/main/java/com/baeldung/springvault/VaultConfig.java index 106a1a3d42..f13c605bd8 100644 --- a/spring-vault/src/main/java/org/baeldung/springvault/VaultConfig.java +++ b/spring-vault/src/main/java/com/baeldung/springvault/VaultConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.springvault; +package com.baeldung.springvault; import org.springframework.context.annotation.Configuration; import org.springframework.vault.authentication.ClientAuthentication; diff --git a/spring-vault/src/main/java/org/baeldung/springvault/VaultEnvironmentConfig.java b/spring-vault/src/main/java/com/baeldung/springvault/VaultEnvironmentConfig.java similarity index 95% rename from spring-vault/src/main/java/org/baeldung/springvault/VaultEnvironmentConfig.java rename to spring-vault/src/main/java/com/baeldung/springvault/VaultEnvironmentConfig.java index 6c796bc718..4f5777e94c 100644 --- a/spring-vault/src/main/java/org/baeldung/springvault/VaultEnvironmentConfig.java +++ b/spring-vault/src/main/java/com/baeldung/springvault/VaultEnvironmentConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.springvault; +package com.baeldung.springvault; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; diff --git a/spring-vault/src/test/java/org/baeldung/SpringContextLiveTest.java b/spring-vault/src/test/java/com/baeldung/springvault/SpringContextLiveTest.java similarity index 86% rename from spring-vault/src/test/java/org/baeldung/SpringContextLiveTest.java rename to spring-vault/src/test/java/com/baeldung/springvault/SpringContextLiveTest.java index 60dc119f13..8139522745 100644 --- a/spring-vault/src/test/java/org/baeldung/SpringContextLiveTest.java +++ b/spring-vault/src/test/java/com/baeldung/springvault/SpringContextLiveTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung.springvault; -import org.baeldung.springvault.SpringVaultApplication; +import com.baeldung.springvault.SpringVaultApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/spring-vault/src/test/java/org/baeldung/springvault/VaultInitializer.java b/spring-vault/src/test/java/com/baeldung/springvault/VaultInitializer.java similarity index 99% rename from spring-vault/src/test/java/org/baeldung/springvault/VaultInitializer.java rename to spring-vault/src/test/java/com/baeldung/springvault/VaultInitializer.java index c7db5eb199..a823a4cd27 100644 --- a/spring-vault/src/test/java/org/baeldung/springvault/VaultInitializer.java +++ b/spring-vault/src/test/java/com/baeldung/springvault/VaultInitializer.java @@ -1,4 +1,4 @@ -package org.baeldung.springvault; +package com.baeldung.springvault; import java.io.BufferedReader; import java.io.Closeable; diff --git a/spring-vault/src/test/java/org/baeldung/springvault/VaultIntegrationTest.java b/spring-vault/src/test/java/com/baeldung/springvault/VaultIntegrationTest.java similarity index 98% rename from spring-vault/src/test/java/org/baeldung/springvault/VaultIntegrationTest.java rename to spring-vault/src/test/java/com/baeldung/springvault/VaultIntegrationTest.java index 9f4b5d82a4..dd8797aacc 100644 --- a/spring-vault/src/test/java/org/baeldung/springvault/VaultIntegrationTest.java +++ b/spring-vault/src/test/java/com/baeldung/springvault/VaultIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.springvault; +package com.baeldung.springvault; import org.junit.FixMethodOrder; import org.junit.Ignore; diff --git a/spring-vault/src/test/java/org/baeldung/springvault/VaultTestConfiguration.java b/spring-vault/src/test/java/com/baeldung/springvault/VaultTestConfiguration.java similarity index 96% rename from spring-vault/src/test/java/org/baeldung/springvault/VaultTestConfiguration.java rename to spring-vault/src/test/java/com/baeldung/springvault/VaultTestConfiguration.java index 09a1445788..42f0bfbce9 100644 --- a/spring-vault/src/test/java/org/baeldung/springvault/VaultTestConfiguration.java +++ b/spring-vault/src/test/java/com/baeldung/springvault/VaultTestConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.springvault; +package com.baeldung.springvault; import java.net.URI; import java.net.URISyntaxException; diff --git a/spring-vertx/src/main/java/com/baeldung/vertxspring/config/PortConfiguration.java b/spring-vertx/src/main/java/com/baeldung/vertxspring/config/PortConfiguration.java new file mode 100644 index 0000000000..23ca74ae80 --- /dev/null +++ b/spring-vertx/src/main/java/com/baeldung/vertxspring/config/PortConfiguration.java @@ -0,0 +1,31 @@ +package com.baeldung.vertxspring.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +import java.io.IOException; +import java.net.ServerSocket; + +@Configuration +public class PortConfiguration { + + private static final int DEFAULT_PORT = 8069; + + @Profile("default") + @Bean + public Integer defaultPort() { + return DEFAULT_PORT; + } + + @Profile("test") + @Bean + public Integer randomPort() { + try (ServerSocket socket = new ServerSocket(0)) { + return socket.getLocalPort(); + + } catch (IOException e) { + return DEFAULT_PORT; + } + } +} diff --git a/spring-vertx/src/main/java/com/baeldung/vertxspring/verticles/ServerVerticle.java b/spring-vertx/src/main/java/com/baeldung/vertxspring/verticles/ServerVerticle.java index 3c23cb15bc..a84845f030 100644 --- a/spring-vertx/src/main/java/com/baeldung/vertxspring/verticles/ServerVerticle.java +++ b/spring-vertx/src/main/java/com/baeldung/vertxspring/verticles/ServerVerticle.java @@ -1,5 +1,6 @@ package com.baeldung.vertxspring.verticles; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import io.vertx.core.AbstractVerticle; @@ -9,6 +10,9 @@ import io.vertx.ext.web.RoutingContext; @Component public class ServerVerticle extends AbstractVerticle { + @Autowired + private Integer defaultPort; + private void getAllArticlesHandler(RoutingContext routingContext) { vertx.eventBus() .send(ArticleRecipientVerticle.GET_ALL_ARTICLES, "", result -> { @@ -36,7 +40,7 @@ public class ServerVerticle extends AbstractVerticle { vertx.createHttpServer() .requestHandler(router::accept) - .listen(config().getInteger("http.port", 8080)); + .listen(config().getInteger("http.port", defaultPort)); } } diff --git a/spring-vertx/src/test/java/com/baeldung/vertxspring/VertxSpringApplicationIntegrationTest.java b/spring-vertx/src/test/java/com/baeldung/vertxspring/VertxSpringApplicationIntegrationTest.java index bfb902e5d4..1eda45eb3b 100644 --- a/spring-vertx/src/test/java/com/baeldung/vertxspring/VertxSpringApplicationIntegrationTest.java +++ b/spring-vertx/src/test/java/com/baeldung/vertxspring/VertxSpringApplicationIntegrationTest.java @@ -1,27 +1,33 @@ package com.baeldung.vertxspring; -import static org.junit.Assert.assertEquals; - 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.boot.test.web.client.TestRestTemplate; import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.assertEquals; + @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest +@ActiveProfiles("test") public class VertxSpringApplicationIntegrationTest { + @Autowired + private Integer port; + private TestRestTemplate restTemplate = new TestRestTemplate(); @Test public void givenUrl_whenReceivedArticles_thenSuccess() throws InterruptedException { - ResponseEntity responseEntity = restTemplate.getForEntity("http://localhost:8080/api/baeldung/articles", String.class); + ResponseEntity responseEntity = restTemplate + .getForEntity("http://localhost:" + port + "/api/baeldung/articles", String.class); assertEquals(200, responseEntity.getStatusCodeValue()); } - } diff --git a/spring-webflux-amqp/pom.xml b/spring-webflux-amqp/pom.xml index f9b14eea06..7a7f6ef600 100755 --- a/spring-webflux-amqp/pom.xml +++ b/spring-webflux-amqp/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.baeldung.spring + com.baeldung.spring spring-webflux-amqp 1.0.0-SNAPSHOT spring-webflux-amqp diff --git a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/AmqpReactiveController.java b/spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/AmqpReactiveController.java similarity index 94% rename from spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/AmqpReactiveController.java rename to spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/AmqpReactiveController.java index 52f6d924fa..b71c32bd05 100644 --- a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/AmqpReactiveController.java +++ b/spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/AmqpReactiveController.java @@ -1,11 +1,9 @@ -package org.baeldung.spring.amqp; +package com.baeldung.spring.amqp; import java.time.Duration; -import java.util.Date; import javax.annotation.PostConstruct; -import org.baeldung.spring.amqp.DestinationsConfig.DestinationInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.core.AmqpAdmin; @@ -29,7 +27,6 @@ import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; @RestController public class AmqpReactiveController { @@ -105,7 +102,7 @@ public class AmqpReactiveController { public Mono> sendMessageToQueue(@PathVariable String name, @RequestBody String payload) { // Lookup exchange details - final DestinationInfo d = destinationsConfig.getQueues() + final DestinationsConfig.DestinationInfo d = destinationsConfig.getQueues() .get(name); if (d == null) { @@ -135,7 +132,7 @@ public class AmqpReactiveController { @GetMapping(value = "/queue/{name}", produces = MediaType.TEXT_EVENT_STREAM_VALUE) public Flux receiveMessagesFromQueue(@PathVariable String name) { - DestinationInfo d = destinationsConfig.getQueues() + DestinationsConfig.DestinationInfo d = destinationsConfig.getQueues() .get(name); if (d == null) { @@ -201,7 +198,7 @@ public class AmqpReactiveController { public Mono> sendMessageToTopic(@PathVariable String name, @RequestBody String payload) { // Lookup exchange details - final DestinationInfo d = destinationsConfig.getTopics() + final DestinationsConfig.DestinationInfo d = destinationsConfig.getTopics() .get(name); if (d == null) { // Destination not found. @@ -223,7 +220,7 @@ public class AmqpReactiveController { @GetMapping(value = "/topic/{name}", produces = MediaType.TEXT_EVENT_STREAM_VALUE) public Flux receiveMessagesFromTopic(@PathVariable String name) { - DestinationInfo d = destinationsConfig.getTopics() + DestinationsConfig.DestinationInfo d = destinationsConfig.getTopics() .get(name); if (d == null) { @@ -281,7 +278,7 @@ public class AmqpReactiveController { } - private Queue createTopicQueue(DestinationInfo destination) { + private Queue createTopicQueue(DestinationsConfig.DestinationInfo destination) { Exchange ex = ExchangeBuilder.topicExchange(destination.getExchange()) .durable(true) diff --git a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/DestinationsConfig.java b/spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/DestinationsConfig.java old mode 100755 new mode 100644 similarity index 93% rename from spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/DestinationsConfig.java rename to spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/DestinationsConfig.java index 410b87c764..0f9a0d890f --- a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/DestinationsConfig.java +++ b/spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/DestinationsConfig.java @@ -1,59 +1,59 @@ -package org.baeldung.spring.amqp; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -@ConfigurationProperties("destinations") -public class DestinationsConfig { - - - private Map queues = new HashMap<>(); - - private Map topics = new HashMap<>(); - - - - public Map getQueues() { - return queues; - } - - public void setQueues(Map queues) { - this.queues = queues; - } - - public Map getTopics() { - return topics; - } - - public void setTopics(Map topics) { - this.topics = topics; - } - - // DestinationInfo stores the Exchange name and routing key used - // by our producers when posting messages - static class DestinationInfo { - - private String exchange; - private String routingKey; - - - public String getExchange() { - return exchange; - } - public void setExchange(String exchange) { - this.exchange = exchange; - } - public String getRoutingKey() { - return routingKey; - } - public void setRoutingKey(String routingKey) { - this.routingKey = routingKey; - } - - - - } - -} +package com.baeldung.spring.amqp; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties("destinations") +public class DestinationsConfig { + + + private Map queues = new HashMap<>(); + + private Map topics = new HashMap<>(); + + + + public Map getQueues() { + return queues; + } + + public void setQueues(Map queues) { + this.queues = queues; + } + + public Map getTopics() { + return topics; + } + + public void setTopics(Map topics) { + this.topics = topics; + } + + // DestinationInfo stores the Exchange name and routing key used + // by our producers when posting messages + static class DestinationInfo { + + private String exchange; + private String routingKey; + + + public String getExchange() { + return exchange; + } + public void setExchange(String exchange) { + this.exchange = exchange; + } + public String getRoutingKey() { + return routingKey; + } + public void setRoutingKey(String routingKey) { + this.routingKey = routingKey; + } + + + + } + +} diff --git a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/MessageListenerContainerFactory.java b/spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/MessageListenerContainerFactory.java similarity index 96% rename from spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/MessageListenerContainerFactory.java rename to spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/MessageListenerContainerFactory.java index 29b8d28a80..d868e6afa8 100644 --- a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/MessageListenerContainerFactory.java +++ b/spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/MessageListenerContainerFactory.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.amqp; +package com.baeldung.spring.amqp; import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.rabbit.connection.ConnectionFactory; diff --git a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java b/spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java old mode 100755 new mode 100644 similarity index 97% rename from spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java rename to spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java index 8a31299333..d6a7a84d30 --- a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java +++ b/spring-webflux-amqp/src/main/java/com/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.amqp; +package com.baeldung.spring.amqp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-webflux-amqp/src/test/java/org/baeldung/SpringContextLiveTest.java b/spring-webflux-amqp/src/test/java/com/baeldung/SpringContextLiveTest.java similarity index 87% rename from spring-webflux-amqp/src/test/java/org/baeldung/SpringContextLiveTest.java rename to spring-webflux-amqp/src/test/java/com/baeldung/SpringContextLiveTest.java index 4d9f658cdc..c443042d3d 100644 --- a/spring-webflux-amqp/src/test/java/org/baeldung/SpringContextLiveTest.java +++ b/spring-webflux-amqp/src/test/java/com/baeldung/SpringContextLiveTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.amqp.SpringWebfluxAmqpApplication; +import com.baeldung.spring.amqp.SpringWebfluxAmqpApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/spring-webflux-amqp/src/test/java/org/baeldung/spring/amqp/SpringWebfluxAmqpLiveTest.java b/spring-webflux-amqp/src/test/java/com/baeldung/spring/amqp/SpringWebfluxAmqpLiveTest.java old mode 100755 new mode 100644 similarity index 93% rename from spring-webflux-amqp/src/test/java/org/baeldung/spring/amqp/SpringWebfluxAmqpLiveTest.java rename to spring-webflux-amqp/src/test/java/com/baeldung/spring/amqp/SpringWebfluxAmqpLiveTest.java index bda490c189..81782ce575 --- a/spring-webflux-amqp/src/test/java/org/baeldung/spring/amqp/SpringWebfluxAmqpLiveTest.java +++ b/spring-webflux-amqp/src/test/java/com/baeldung/spring/amqp/SpringWebfluxAmqpLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.amqp; +package com.baeldung.spring.amqp; import org.junit.Test; import org.springframework.test.web.reactive.server.WebTestClient; diff --git a/spring-websockets/README.md b/spring-websockets/README.md new file mode 100644 index 0000000000..26e1c6db7c --- /dev/null +++ b/spring-websockets/README.md @@ -0,0 +1,7 @@ +## Spring WebSockets + +This module contains articles about Spring WebSockets. + +### Relevant articles +- [Intro to WebSockets with Spring](https://www.baeldung.com/websockets-spring) +- [A Quick Example of Spring Websockets’ @SendToUser Annotation](https://www.baeldung.com/spring-websockets-sendtouser) diff --git a/spring-websockets/pom.xml b/spring-websockets/pom.xml new file mode 100644 index 0000000000..ddfd512476 --- /dev/null +++ b/spring-websockets/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + spring-websockets + spring-websockets + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-websocket + + + com.google.code.gson + gson + + + + + spring-websockets + + + src/main/resources + true + + + + + diff --git a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java b/spring-websockets/src/main/java/com/baeldung/SpringBootApp.java similarity index 61% rename from spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java rename to spring-websockets/src/main/java/com/baeldung/SpringBootApp.java index 1acdba0623..ea2a461dfc 100644 --- a/spring-security-modules/spring-security-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java +++ b/spring-websockets/src/main/java/com/baeldung/SpringBootApp.java @@ -1,14 +1,12 @@ -package org.baeldung.config; +package com.baeldung; 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 class SpringBootApp extends SpringBootServletInitializer { public static void main(String[] args) { - SpringApplication.run(SpringOpenidApplication.class, args); + SpringApplication.run(SpringBootApp.class, args); } - -} +} \ No newline at end of file diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketSendToUserConfig.java b/spring-websockets/src/main/java/com/baeldung/sendtouser/WebSocketSendToUserConfig.java similarity index 98% rename from spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketSendToUserConfig.java rename to spring-websockets/src/main/java/com/baeldung/sendtouser/WebSocketSendToUserConfig.java index dbd52e20ba..76837d27f5 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketSendToUserConfig.java +++ b/spring-websockets/src/main/java/com/baeldung/sendtouser/WebSocketSendToUserConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.web.config; +package com.baeldung.sendtouser; import org.springframework.context.annotation.Configuration; import org.springframework.http.server.ServerHttpRequest; diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/WebsocketSendToUserController.java b/spring-websockets/src/main/java/com/baeldung/sendtouser/WebsocketSendToUserController.java similarity index 96% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/WebsocketSendToUserController.java rename to spring-websockets/src/main/java/com/baeldung/sendtouser/WebsocketSendToUserController.java index 4b55bcc00f..12475ad055 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/controller/WebsocketSendToUserController.java +++ b/spring-websockets/src/main/java/com/baeldung/sendtouser/WebsocketSendToUserController.java @@ -1,15 +1,14 @@ -package com.baeldung.web.controller; - -import java.security.Principal; -import java.util.Map; +package com.baeldung.sendtouser; +import com.google.gson.Gson; import org.springframework.messaging.handler.annotation.MessageExceptionHandler; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.Payload; import org.springframework.messaging.simp.annotation.SendToUser; import org.springframework.stereotype.Controller; -import com.google.gson.Gson; +import java.security.Principal; +import java.util.Map; @Controller public class WebsocketSendToUserController { diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/ChatController.java b/spring-websockets/src/main/java/com/baeldung/websockets/ChatController.java similarity index 83% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/ChatController.java rename to spring-websockets/src/main/java/com/baeldung/websockets/ChatController.java index f4bed1950b..4ac78c2730 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/controller/ChatController.java +++ b/spring-websockets/src/main/java/com/baeldung/websockets/ChatController.java @@ -1,7 +1,5 @@ -package com.baeldung.web.controller; +package com.baeldung.websockets; -import com.baeldung.model.Message; -import com.baeldung.model.OutputMessage; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.stereotype.Controller; diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/Message.java b/spring-websockets/src/main/java/com/baeldung/websockets/Message.java similarity index 85% rename from spring-mvc-java/src/main/java/com/baeldung/model/Message.java rename to spring-websockets/src/main/java/com/baeldung/websockets/Message.java index 76d53e132a..dd147a7bf5 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/model/Message.java +++ b/spring-websockets/src/main/java/com/baeldung/websockets/Message.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.websockets; public class Message { diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/OutputMessage.java b/spring-websockets/src/main/java/com/baeldung/websockets/OutputMessage.java similarity index 93% rename from spring-mvc-java/src/main/java/com/baeldung/model/OutputMessage.java rename to spring-websockets/src/main/java/com/baeldung/websockets/OutputMessage.java index 9aad564b1e..33d1f42743 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/model/OutputMessage.java +++ b/spring-websockets/src/main/java/com/baeldung/websockets/OutputMessage.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.websockets; public class OutputMessage { diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketConfig.java b/spring-websockets/src/main/java/com/baeldung/websockets/WebSocketConfig.java similarity index 95% rename from spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketConfig.java rename to spring-websockets/src/main/java/com/baeldung/websockets/WebSocketConfig.java index 0793658e90..7b53dbc3f3 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketConfig.java +++ b/spring-websockets/src/main/java/com/baeldung/websockets/WebSocketConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.web.config; +package com.baeldung.websockets; import org.springframework.context.annotation.Configuration; import org.springframework.messaging.simp.config.MessageBrokerRegistry; diff --git a/spring-mvc-java/src/main/webapp/resources/chat.html b/spring-websockets/src/main/webapp/resources/chat.html similarity index 96% rename from spring-mvc-java/src/main/webapp/resources/chat.html rename to spring-websockets/src/main/webapp/resources/chat.html index 92a54534fd..17c8494dd8 100644 --- a/spring-mvc-java/src/main/webapp/resources/chat.html +++ b/spring-websockets/src/main/webapp/resources/chat.html @@ -1,88 +1,88 @@ - - - Chat WebSocket - - - - - - - - - - -
- - -
- -
-
-
- - -
-
-
- - -

-
-
- - + + + Chat WebSocket + + + + + + + + + + +
+ + +
+ +
+
+
+ + +
+
+
+ + +

+
+
+ + \ No newline at end of file diff --git a/spring-mvc-java/src/main/webapp/resources/js/sockjs-0.3.4.js b/spring-websockets/src/main/webapp/resources/js/sockjs-0.3.4.js similarity index 100% rename from spring-mvc-java/src/main/webapp/resources/js/sockjs-0.3.4.js rename to spring-websockets/src/main/webapp/resources/js/sockjs-0.3.4.js diff --git a/spring-mvc-java/src/main/webapp/resources/js/stomp.js b/spring-websockets/src/main/webapp/resources/js/stomp.js similarity index 100% rename from spring-mvc-java/src/main/webapp/resources/js/stomp.js rename to spring-websockets/src/main/webapp/resources/js/stomp.js diff --git a/spring-mvc-java/src/main/webapp/resources/js/webSocketSendToUserApp.js b/spring-websockets/src/main/webapp/resources/js/webSocketSendToUserApp.js similarity index 100% rename from spring-mvc-java/src/main/webapp/resources/js/webSocketSendToUserApp.js rename to spring-websockets/src/main/webapp/resources/js/webSocketSendToUserApp.js diff --git a/tensorflow-java/src/main/java/org/baeldung/tensorflow/TensorflowGraph.java b/tensorflow-java/src/main/java/com/baeldung/tensorflow/TensorflowGraph.java similarity index 98% rename from tensorflow-java/src/main/java/org/baeldung/tensorflow/TensorflowGraph.java rename to tensorflow-java/src/main/java/com/baeldung/tensorflow/TensorflowGraph.java index a44ef4c4ee..5d9a85a491 100644 --- a/tensorflow-java/src/main/java/org/baeldung/tensorflow/TensorflowGraph.java +++ b/tensorflow-java/src/main/java/com/baeldung/tensorflow/TensorflowGraph.java @@ -1,4 +1,4 @@ -package org.baeldung.tensorflow; +package com.baeldung.tensorflow; import org.tensorflow.DataType; import org.tensorflow.Graph; diff --git a/tensorflow-java/src/main/java/org/baeldung/tensorflow/TensorflowSavedModel.java b/tensorflow-java/src/main/java/com/baeldung/tensorflow/TensorflowSavedModel.java similarity index 93% rename from tensorflow-java/src/main/java/org/baeldung/tensorflow/TensorflowSavedModel.java rename to tensorflow-java/src/main/java/com/baeldung/tensorflow/TensorflowSavedModel.java index 4259a787e8..96a063dff2 100644 --- a/tensorflow-java/src/main/java/org/baeldung/tensorflow/TensorflowSavedModel.java +++ b/tensorflow-java/src/main/java/com/baeldung/tensorflow/TensorflowSavedModel.java @@ -1,4 +1,4 @@ -package org.baeldung.tensorflow; +package com.baeldung.tensorflow; import org.tensorflow.SavedModelBundle; import org.tensorflow.Tensor; diff --git a/tensorflow-java/src/test/java/org/baeldung/tensorflow/TensorflowGraphUnitTest.java b/tensorflow-java/src/test/java/com/baeldung/tensorflow/TensorflowGraphUnitTest.java similarity index 92% rename from tensorflow-java/src/test/java/org/baeldung/tensorflow/TensorflowGraphUnitTest.java rename to tensorflow-java/src/test/java/com/baeldung/tensorflow/TensorflowGraphUnitTest.java index 51df6a4322..c2799a4bb1 100644 --- a/tensorflow-java/src/test/java/org/baeldung/tensorflow/TensorflowGraphUnitTest.java +++ b/tensorflow-java/src/test/java/com/baeldung/tensorflow/TensorflowGraphUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.tensorflow; +package com.baeldung.tensorflow; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Department.java b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Department.java similarity index 90% rename from testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Department.java rename to testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Department.java index ee4dc82771..87bff514a0 100644 --- a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Department.java +++ b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Department.java @@ -1,4 +1,4 @@ -package org.baeldung.easy.random.model; +package com.baeldung.easy.random.model; import java.util.StringJoiner; diff --git a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Employee.java b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Employee.java similarity index 97% rename from testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Employee.java rename to testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Employee.java index ef63642ca2..af44822215 100644 --- a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Employee.java +++ b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Employee.java @@ -1,4 +1,4 @@ -package org.baeldung.easy.random.model; +package com.baeldung.easy.random.model; import java.util.*; diff --git a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Grade.java b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Grade.java similarity index 90% rename from testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Grade.java rename to testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Grade.java index cb979be3b8..1d18a3f183 100644 --- a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Grade.java +++ b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Grade.java @@ -1,4 +1,4 @@ -package org.baeldung.easy.random.model; +package com.baeldung.easy.random.model; import java.util.StringJoiner; diff --git a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Person.java b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Person.java similarity index 93% rename from testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Person.java rename to testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Person.java index c941499993..3269af7b0f 100644 --- a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/Person.java +++ b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/Person.java @@ -1,4 +1,4 @@ -package org.baeldung.easy.random.model; +package com.baeldung.easy.random.model; import java.util.StringJoiner; diff --git a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/YearQuarter.java b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/YearQuarter.java similarity index 96% rename from testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/YearQuarter.java rename to testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/YearQuarter.java index c2868f09b8..576fe67dd0 100644 --- a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/model/YearQuarter.java +++ b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/model/YearQuarter.java @@ -1,4 +1,4 @@ -package org.baeldung.easy.random.model; +package com.baeldung.easy.random.model; import java.time.LocalDate; import java.util.Objects; diff --git a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/randomizer/YearQuarterRandomizer.java b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/randomizer/YearQuarterRandomizer.java similarity index 79% rename from testing-modules/easy-random/src/main/java/org/baeldung/easy/random/randomizer/YearQuarterRandomizer.java rename to testing-modules/easy-random/src/main/java/com/baeldung/easy/random/randomizer/YearQuarterRandomizer.java index 05232ffcbc..28db724684 100644 --- a/testing-modules/easy-random/src/main/java/org/baeldung/easy/random/randomizer/YearQuarterRandomizer.java +++ b/testing-modules/easy-random/src/main/java/com/baeldung/easy/random/randomizer/YearQuarterRandomizer.java @@ -1,6 +1,6 @@ -package org.baeldung.easy.random.randomizer; +package com.baeldung.easy.random.randomizer; -import org.baeldung.easy.random.model.YearQuarter; +import com.baeldung.easy.random.model.YearQuarter; import org.jeasy.random.api.Randomizer; import java.time.LocalDate; diff --git a/testing-modules/easy-random/src/test/java/org/baeldung/easy/random/EasyRandomUnitTest.java b/testing-modules/easy-random/src/test/java/com/baeldung/easy/random/EasyRandomUnitTest.java similarity index 89% rename from testing-modules/easy-random/src/test/java/org/baeldung/easy/random/EasyRandomUnitTest.java rename to testing-modules/easy-random/src/test/java/com/baeldung/easy/random/EasyRandomUnitTest.java index 9f7a23db66..4e0df74923 100644 --- a/testing-modules/easy-random/src/test/java/org/baeldung/easy/random/EasyRandomUnitTest.java +++ b/testing-modules/easy-random/src/test/java/com/baeldung/easy/random/EasyRandomUnitTest.java @@ -1,9 +1,9 @@ -package org.baeldung.easy.random; +package com.baeldung.easy.random; -import org.baeldung.easy.random.model.Employee; -import org.baeldung.easy.random.model.Person; -import org.baeldung.easy.random.model.YearQuarter; -import org.baeldung.easy.random.randomizer.YearQuarterRandomizer; +import com.baeldung.easy.random.model.Employee; +import com.baeldung.easy.random.model.Person; +import com.baeldung.easy.random.model.YearQuarter; +import com.baeldung.easy.random.randomizer.YearQuarterRandomizer; import org.jeasy.random.EasyRandom; import org.jeasy.random.EasyRandomParameters; import org.jeasy.random.FieldPredicates; diff --git a/testing-modules/gatling/README.md b/testing-modules/gatling/README.md index 941ab75f06..7352479d1b 100644 --- a/testing-modules/gatling/README.md +++ b/testing-modules/gatling/README.md @@ -1,5 +1,6 @@ ### Relevant Articles: - [Intro to Gatling](http://www.baeldung.com/introduction-to-gatling) +- [Run Gatling Tests From Jenkins](https://www.baeldung.com/jenkins-run-gatling-tests) ### Running a simualtion - To run a simulation use "simulation" profile, command - `mvn install -Psimulation -Dgib.enabled=false` diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java index 8f2eb2b5c5..7378eafaa7 100644 --- a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java @@ -5,7 +5,7 @@ import org.junit.platform.suite.api.SelectPackages; import org.junit.runner.RunWith; @RunWith(JUnitPlatform.class) -@SelectPackages({ "org.baeldung.java.suite.childpackage1", "org.baeldung.java.suite.childpackage2" }) +@SelectPackages({ "com.baeldung.java.suite.childpackage1", "com.baeldung.java.suite.childpackage2" }) public class SelectPackagesSuiteUnitTest { } diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md index 1d1bd6af7c..d7069949e4 100644 --- a/testing-modules/mockito-2/README.md +++ b/testing-modules/mockito-2/README.md @@ -5,3 +5,4 @@ - [Mockito Strict Stubbing and The UnnecessaryStubbingException](https://www.baeldung.com/mockito-unnecessary-stubbing-exception) - [Quick Guide to BDDMockito](https://www.baeldung.com/bdd-mockito) - [Mockito – Using Spies](https://www.baeldung.com/mockito-spy) +- [Mockito and Fluent APIs](https://www.baeldung.com/mockito-fluent-apis) diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/AdvancedCollaborator.java b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/AdvancedCollaborator.java similarity index 93% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/AdvancedCollaborator.java rename to testing-modules/mocks/src/main/java/com/baeldung/jmockit/AdvancedCollaborator.java index 4d25f466a6..ef7484cfdd 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/AdvancedCollaborator.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/AdvancedCollaborator.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; public class AdvancedCollaborator { int i; diff --git a/testing-modules/mocks/src/main/java/com/baeldung/mocks/jmockit/AppManager.java b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/AppManager.java similarity index 94% rename from testing-modules/mocks/src/main/java/com/baeldung/mocks/jmockit/AppManager.java rename to testing-modules/mocks/src/main/java/com/baeldung/jmockit/AppManager.java index 615650ea6d..6306a94d29 100644 --- a/testing-modules/mocks/src/main/java/com/baeldung/mocks/jmockit/AppManager.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/AppManager.java @@ -1,4 +1,4 @@ -package com.baeldung.mocks.jmockit; +package com.baeldung.jmockit; import java.util.Random; diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Collaborator.java b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/Collaborator.java similarity index 80% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Collaborator.java rename to testing-modules/mocks/src/main/java/com/baeldung/jmockit/Collaborator.java index 60da12fa7c..8c4f6b15b6 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Collaborator.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/Collaborator.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; public class Collaborator { diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/ExpectationsCollaborator.java b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/ExpectationsCollaborator.java similarity index 94% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/ExpectationsCollaborator.java rename to testing-modules/mocks/src/main/java/com/baeldung/jmockit/ExpectationsCollaborator.java index 8209464936..799e7721e0 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/ExpectationsCollaborator.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/ExpectationsCollaborator.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; import java.util.List; diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Model.java b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/Model.java similarity index 69% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Model.java rename to testing-modules/mocks/src/main/java/com/baeldung/jmockit/Model.java index 79ae24c2f5..ac81e5059a 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Model.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/Model.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; public class Model { public String getInfo() { diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Performer.java b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/Performer.java similarity index 84% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Performer.java rename to testing-modules/mocks/src/main/java/com/baeldung/jmockit/Performer.java index 4f8e8adb24..82fd03fef1 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/jmockit/Performer.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/jmockit/Performer.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; public class Performer { private Collaborator collaborator; diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginController.java b/testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginController.java similarity index 94% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginController.java rename to testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginController.java index 914b0034d2..e7e972a3ce 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginController.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginController.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.testCase; +package com.baeldung.testCase; public class LoginController { diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginDao.java b/testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginDao.java similarity index 79% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginDao.java rename to testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginDao.java index 2cbff6c9d4..f2efe38019 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginDao.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginDao.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.testCase; +package com.baeldung.testCase; public class LoginDao { diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginService.java b/testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginService.java similarity index 94% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginService.java rename to testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginService.java index d6a31a8047..3e34024971 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/LoginService.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/testCase/LoginService.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.testCase; +package com.baeldung.testCase; public class LoginService { diff --git a/testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/UserForm.java b/testing-modules/mocks/src/main/java/com/baeldung/testCase/UserForm.java similarity index 84% rename from testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/UserForm.java rename to testing-modules/mocks/src/main/java/com/baeldung/testCase/UserForm.java index 14136d0f31..bfb1411ce5 100644 --- a/testing-modules/mocks/src/main/java/org/baeldung/mocks/testCase/UserForm.java +++ b/testing-modules/mocks/src/main/java/com/baeldung/testCase/UserForm.java @@ -1,4 +1,4 @@ -package org.baeldung.mocks.testCase; +package com.baeldung.testCase; public class UserForm { diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/easymock/LoginControllerIntegrationTest.java b/testing-modules/mocks/src/test/java/com/baeldung/easymock/LoginControllerIntegrationTest.java similarity index 94% rename from testing-modules/mocks/src/test/java/org/baeldung/mocks/easymock/LoginControllerIntegrationTest.java rename to testing-modules/mocks/src/test/java/com/baeldung/easymock/LoginControllerIntegrationTest.java index 4cf2a23ee8..5636382efd 100644 --- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/easymock/LoginControllerIntegrationTest.java +++ b/testing-modules/mocks/src/test/java/com/baeldung/easymock/LoginControllerIntegrationTest.java @@ -1,9 +1,9 @@ -package org.baeldung.mocks.easymock; +package com.baeldung.easymock; -import org.baeldung.mocks.testCase.LoginController; -import org.baeldung.mocks.testCase.LoginDao; -import org.baeldung.mocks.testCase.LoginService; -import org.baeldung.mocks.testCase.UserForm; +import com.baeldung.testCase.LoginController; +import com.baeldung.testCase.LoginDao; +import com.baeldung.testCase.LoginService; +import com.baeldung.testCase.UserForm; import org.easymock.*; import org.junit.Assert; import org.junit.Test; diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/AdvancedCollaboratorIntegrationTest.java b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/AdvancedCollaboratorIntegrationTest.java similarity index 96% rename from testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/AdvancedCollaboratorIntegrationTest.java rename to testing-modules/mocks/src/test/java/com/baeldung/jmockit/AdvancedCollaboratorIntegrationTest.java index 3a30342eb9..e55a69895f 100644 --- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/AdvancedCollaboratorIntegrationTest.java +++ b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/AdvancedCollaboratorIntegrationTest.java @@ -1,10 +1,11 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.List; +import com.baeldung.jmockit.AdvancedCollaborator; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/testing-modules/mocks/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/AppManagerUnitTest.java similarity index 91% rename from testing-modules/mocks/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java rename to testing-modules/mocks/src/test/java/com/baeldung/jmockit/AppManagerUnitTest.java index ecdc6e441e..bc88f62024 100644 --- a/testing-modules/mocks/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java +++ b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/AppManagerUnitTest.java @@ -1,10 +1,9 @@ -package com.baeldung.mocks.jmockit; +package com.baeldung.jmockit; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import mockit.Deencapsulation; import mockit.Mock; import mockit.MockUp; diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ExpectationsIntegrationTest.java b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/ExpectationsIntegrationTest.java similarity index 97% rename from testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ExpectationsIntegrationTest.java rename to testing-modules/mocks/src/test/java/com/baeldung/jmockit/ExpectationsIntegrationTest.java index 8b85af6243..8b0c3ab4ec 100644 --- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ExpectationsIntegrationTest.java +++ b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/ExpectationsIntegrationTest.java @@ -1,5 +1,7 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; +import com.baeldung.jmockit.ExpectationsCollaborator; +import com.baeldung.jmockit.Model; import mockit.Delegate; import mockit.Expectations; import mockit.Mocked; diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/LoginControllerIntegrationTest.java b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/LoginControllerIntegrationTest.java similarity index 95% rename from testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/LoginControllerIntegrationTest.java rename to testing-modules/mocks/src/test/java/com/baeldung/jmockit/LoginControllerIntegrationTest.java index ecad7df5b5..4dbe94991f 100644 --- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/LoginControllerIntegrationTest.java +++ b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/LoginControllerIntegrationTest.java @@ -1,11 +1,11 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; import mockit.*; import mockit.integration.junit4.JMockit; -import org.baeldung.mocks.testCase.LoginController; -import org.baeldung.mocks.testCase.LoginDao; -import org.baeldung.mocks.testCase.LoginService; -import org.baeldung.mocks.testCase.UserForm; +import com.baeldung.testCase.LoginController; +import com.baeldung.testCase.LoginDao; +import com.baeldung.testCase.LoginService; +import com.baeldung.testCase.UserForm; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.junit.Assert; diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/PerformerIntegrationTest.java b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/PerformerIntegrationTest.java similarity index 80% rename from testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/PerformerIntegrationTest.java rename to testing-modules/mocks/src/test/java/com/baeldung/jmockit/PerformerIntegrationTest.java index 7c79a5979e..fb94ae908b 100644 --- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/PerformerIntegrationTest.java +++ b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/PerformerIntegrationTest.java @@ -1,5 +1,8 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; +import com.baeldung.jmockit.Collaborator; +import com.baeldung.jmockit.Model; +import com.baeldung.jmockit.Performer; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ReusingIntegrationTest.java b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/ReusingIntegrationTest.java similarity index 89% rename from testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ReusingIntegrationTest.java rename to testing-modules/mocks/src/test/java/com/baeldung/jmockit/ReusingIntegrationTest.java index 73bc712143..30b17ee2e4 100644 --- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ReusingIntegrationTest.java +++ b/testing-modules/mocks/src/test/java/com/baeldung/jmockit/ReusingIntegrationTest.java @@ -1,5 +1,8 @@ -package org.baeldung.mocks.jmockit; +package com.baeldung.jmockit; +import com.baeldung.jmockit.Collaborator; +import com.baeldung.jmockit.Model; +import com.baeldung.jmockit.Performer; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/mockito/LoginControllerIntegrationTest.java b/testing-modules/mocks/src/test/java/com/baeldung/mockito/LoginControllerIntegrationTest.java similarity index 94% rename from testing-modules/mocks/src/test/java/org/baeldung/mocks/mockito/LoginControllerIntegrationTest.java rename to testing-modules/mocks/src/test/java/com/baeldung/mockito/LoginControllerIntegrationTest.java index 9d47b2f5d4..98df2cf850 100644 --- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/mockito/LoginControllerIntegrationTest.java +++ b/testing-modules/mocks/src/test/java/com/baeldung/mockito/LoginControllerIntegrationTest.java @@ -1,9 +1,9 @@ -package org.baeldung.mocks.mockito; +package com.baeldung.mockito; -import org.baeldung.mocks.testCase.LoginController; -import org.baeldung.mocks.testCase.LoginDao; -import org.baeldung.mocks.testCase.LoginService; -import org.baeldung.mocks.testCase.UserForm; +import com.baeldung.testCase.LoginController; +import com.baeldung.testCase.LoginDao; +import com.baeldung.testCase.LoginService; +import com.baeldung.testCase.UserForm; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/testing-modules/rest-testing/src/test/java/org/baeldung/rest/GitHubUser.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/GitHubUser.java similarity index 88% rename from testing-modules/rest-testing/src/test/java/org/baeldung/rest/GitHubUser.java rename to testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/GitHubUser.java index 73c9677377..6992789f0e 100644 --- a/testing-modules/rest-testing/src/test/java/org/baeldung/rest/GitHubUser.java +++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/GitHubUser.java @@ -1,4 +1,4 @@ -package org.baeldung.rest; +package com.baeldung.rest.jbehave; public class GitHubUser { diff --git a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/GithubUserResponsePayloadSteps.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/GithubUserResponsePayloadSteps.java index d9401a5d00..51beb609c2 100644 --- a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/GithubUserResponsePayloadSteps.java +++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/GithubUserResponsePayloadSteps.java @@ -1,11 +1,6 @@ package com.baeldung.rest.jbehave; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.impl.client.HttpClientBuilder; -import org.baeldung.rest.GitHubUser; -import org.baeldung.rest.RetrieveUtil; import org.hamcrest.Matchers; import org.jbehave.core.annotations.Given; import org.jbehave.core.annotations.Then; diff --git a/testing-modules/rest-testing/src/test/java/org/baeldung/rest/RetrieveUtil.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/RetrieveUtil.java similarity index 95% rename from testing-modules/rest-testing/src/test/java/org/baeldung/rest/RetrieveUtil.java rename to testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/RetrieveUtil.java index 75ec3c842c..03f96bed73 100644 --- a/testing-modules/rest-testing/src/test/java/org/baeldung/rest/RetrieveUtil.java +++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/jbehave/RetrieveUtil.java @@ -1,4 +1,4 @@ -package org.baeldung.rest; +package com.baeldung.rest.jbehave; import java.io.IOException; diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumCookiesJUnitLiveTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumCookiesJUnitLiveTest.java new file mode 100644 index 0000000000..0cbbf52454 --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumCookiesJUnitLiveTest.java @@ -0,0 +1,110 @@ +package test.java.com.baeldung.selenium.junit; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.Capabilities; +import org.openqa.selenium.Cookie; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.remote.DesiredCapabilities; + +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; + +public class SeleniumCookiesJUnitLiveTest { + + private WebDriver driver; + private String navUrl; + + @Before + public void setUp() { + Capabilities capabilities = DesiredCapabilities.firefox(); + driver = new FirefoxDriver(capabilities); + navUrl = "https://baeldung.com"; + driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); + System.setProperty("webdriver.gecko.driver", "geckodriver.exe"); + } + + @After + public void teardown() { + driver.quit(); + } + + @Test + public void whenNavigate_thenCookiesExist() { + driver.navigate().to(navUrl); + Set cookies = driver.manage().getCookies(); + + assertThat(cookies, is(not(empty()))); + } + + @Test + public void whenNavigate_thenLpCookieExists() { + driver.navigate().to(navUrl); + Cookie lpCookie = driver.manage().getCookieNamed("lp_120073"); + + assertThat(lpCookie, is(not(nullValue()))); + } + + @Test + public void whenNavigate_thenLpCookieIsHasCorrectValue() { + driver.navigate().to(navUrl); + Cookie lpCookie = driver.manage().getCookieNamed("lp_120073"); + + assertThat(lpCookie.getValue(), containsString("www.baeldung.com")); + } + + @Test + public void whenNavigate_thenLpCookieHasCorrectProps() { + driver.navigate().to(navUrl); + Cookie lpCookie = driver.manage().getCookieNamed("lp_120073"); + + assertThat(lpCookie.getDomain(), equalTo(".baeldung.com")); + assertThat(lpCookie.getPath(), equalTo("/")); + assertThat(lpCookie.getExpiry(), is(not(nullValue()))); + assertThat(lpCookie.isSecure(), equalTo(false)); + assertThat(lpCookie.isHttpOnly(), equalTo(false)); + } + + @Test + public void whenAddingCookie_thenItIsPresent() { + driver.navigate().to(navUrl); + Cookie cookie = new Cookie("foo", "bar"); + driver.manage().addCookie(cookie); + Cookie driverCookie = driver.manage().getCookieNamed("foo"); + + assertThat(driverCookie.getValue(), equalTo("bar")); + } + + @Test + public void whenDeletingCookie_thenItIsAbsent() { + driver.navigate().to(navUrl); + Cookie lpCookie = driver.manage().getCookieNamed("lp_120073"); + + assertThat(lpCookie, is(not(nullValue()))); + + driver.manage().deleteCookie(lpCookie); + Cookie deletedCookie = driver.manage().getCookieNamed("lp_120073"); + + assertThat(deletedCookie, is(nullValue())); + } + + @Test + public void whenOverridingCookie_thenItIsUpdated() { + driver.navigate().to(navUrl); + Cookie lpCookie = driver.manage().getCookieNamed("lp_120073"); + driver.manage().deleteCookie(lpCookie); + + Cookie newLpCookie = new Cookie("lp_120073", "foo"); + driver.manage().addCookie(newLpCookie); + + Cookie overriddenCookie = driver.manage().getCookieNamed("lp_120073"); + + assertThat(overriddenCookie.getValue(), equalTo("foo")); + } + +} diff --git a/testing-modules/spring-testing/pom.xml b/testing-modules/spring-testing/pom.xml index 22f5f68240..38e7a0dd46 100644 --- a/testing-modules/spring-testing/pom.xml +++ b/testing-modules/spring-testing/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.baeldung + com.baeldung spring-testing 0.1-SNAPSHOT spring-testing diff --git a/testing-modules/spring-testing/src/main/java/org/baeldung/mockito/repository/User.java b/testing-modules/spring-testing/src/main/java/com/baeldung/mockito/repository/User.java similarity index 95% rename from testing-modules/spring-testing/src/main/java/org/baeldung/mockito/repository/User.java rename to testing-modules/spring-testing/src/main/java/com/baeldung/mockito/repository/User.java index 28cd4f9fb0..1854a085ac 100644 --- a/testing-modules/spring-testing/src/main/java/org/baeldung/mockito/repository/User.java +++ b/testing-modules/spring-testing/src/main/java/com/baeldung/mockito/repository/User.java @@ -1,4 +1,4 @@ -package org.baeldung.mockito.repository; +package com.baeldung.mockito.repository; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/testing-modules/spring-testing/src/main/java/org/baeldung/mockito/repository/UserRepository.java b/testing-modules/spring-testing/src/main/java/com/baeldung/mockito/repository/UserRepository.java similarity index 84% rename from testing-modules/spring-testing/src/main/java/org/baeldung/mockito/repository/UserRepository.java rename to testing-modules/spring-testing/src/main/java/com/baeldung/mockito/repository/UserRepository.java index 3f1952a5e7..fd5bd55c84 100644 --- a/testing-modules/spring-testing/src/main/java/org/baeldung/mockito/repository/UserRepository.java +++ b/testing-modules/spring-testing/src/main/java/com/baeldung/mockito/repository/UserRepository.java @@ -1,4 +1,4 @@ -package org.baeldung.mockito.repository; +package com.baeldung.mockito.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/Employee.java b/testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/Employee.java similarity index 87% rename from testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/Employee.java rename to testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/Employee.java index 8d4eeb57c4..d542f9c234 100644 --- a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/Employee.java +++ b/testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/Employee.java @@ -1,4 +1,4 @@ -package org.baeldung.reflectiontestutils.repository; +package com.baeldung.reflectiontestutils.repository; public class Employee { private Integer id; diff --git a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/EmployeeService.java b/testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/EmployeeService.java similarity index 87% rename from testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/EmployeeService.java rename to testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/EmployeeService.java index d28745e2ab..9feae7ae30 100644 --- a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/EmployeeService.java +++ b/testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/EmployeeService.java @@ -1,4 +1,4 @@ -package org.baeldung.reflectiontestutils.repository; +package com.baeldung.reflectiontestutils.repository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/HRService.java b/testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/HRService.java similarity index 77% rename from testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/HRService.java rename to testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/HRService.java index 13a5973ee8..bb2c34d82f 100644 --- a/testing-modules/spring-testing/src/main/java/org/baeldung/reflectiontestutils/repository/HRService.java +++ b/testing-modules/spring-testing/src/main/java/com/baeldung/reflectiontestutils/repository/HRService.java @@ -1,4 +1,4 @@ -package org.baeldung.reflectiontestutils.repository; +package com.baeldung.reflectiontestutils.repository; import org.springframework.stereotype.Component; diff --git a/testing-modules/spring-testing/src/test/java/org/baeldung/mockito/MockAnnotationUnitTest.java b/testing-modules/spring-testing/src/test/java/com/baeldung/mockito/MockAnnotationUnitTest.java similarity index 92% rename from testing-modules/spring-testing/src/test/java/org/baeldung/mockito/MockAnnotationUnitTest.java rename to testing-modules/spring-testing/src/test/java/com/baeldung/mockito/MockAnnotationUnitTest.java index 1fa7f241e7..424a622b65 100644 --- a/testing-modules/spring-testing/src/test/java/org/baeldung/mockito/MockAnnotationUnitTest.java +++ b/testing-modules/spring-testing/src/test/java/com/baeldung/mockito/MockAnnotationUnitTest.java @@ -1,6 +1,6 @@ -package org.baeldung.mockito; +package com.baeldung.mockito; -import org.baeldung.mockito.repository.UserRepository; +import com.baeldung.mockito.repository.UserRepository; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/testing-modules/spring-testing/src/test/java/org/baeldung/mockito/MockBeanAnnotationIntegrationTest.java b/testing-modules/spring-testing/src/test/java/com/baeldung/mockito/MockBeanAnnotationIntegrationTest.java similarity index 91% rename from testing-modules/spring-testing/src/test/java/org/baeldung/mockito/MockBeanAnnotationIntegrationTest.java rename to testing-modules/spring-testing/src/test/java/com/baeldung/mockito/MockBeanAnnotationIntegrationTest.java index 3a7e58fb48..b7617ef652 100644 --- a/testing-modules/spring-testing/src/test/java/org/baeldung/mockito/MockBeanAnnotationIntegrationTest.java +++ b/testing-modules/spring-testing/src/test/java/com/baeldung/mockito/MockBeanAnnotationIntegrationTest.java @@ -1,6 +1,6 @@ -package org.baeldung.mockito; +package com.baeldung.mockito; -import org.baeldung.mockito.repository.UserRepository; +import com.baeldung.mockito.repository.UserRepository; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/testing-modules/spring-testing/src/test/java/org/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java b/testing-modules/spring-testing/src/test/java/com/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java similarity index 87% rename from testing-modules/spring-testing/src/test/java/org/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java rename to testing-modules/spring-testing/src/test/java/com/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java index 36e5428b58..33d4db22f3 100644 --- a/testing-modules/spring-testing/src/test/java/org/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java +++ b/testing-modules/spring-testing/src/test/java/com/baeldung/reflectiontestutils/ReflectionTestUtilsUnitTest.java @@ -1,11 +1,11 @@ -package org.baeldung.reflectiontestutils; +package com.baeldung.reflectiontestutils; import static org.junit.Assert.*; import static org.mockito.Mockito.mock; -import org.baeldung.reflectiontestutils.repository.Employee; -import org.baeldung.reflectiontestutils.repository.EmployeeService; -import org.baeldung.reflectiontestutils.repository.HRService; +import com.baeldung.reflectiontestutils.repository.EmployeeService; +import com.baeldung.reflectiontestutils.repository.HRService; +import com.baeldung.reflectiontestutils.repository.Employee; import org.junit.Test; import org.springframework.test.util.ReflectionTestUtils; diff --git a/testing-modules/testing-libraries/README.md b/testing-modules/testing-libraries/README.md index d76b7b1308..e5145d6af8 100644 --- a/testing-modules/testing-libraries/README.md +++ b/testing-modules/testing-libraries/README.md @@ -8,5 +8,5 @@ - [Introduction to Lambda Behave](http://www.baeldung.com/lambda-behave) - [Introduction to CheckStyle](https://www.baeldung.com/checkstyle-java) - [Introduction to FindBugs](https://www.baeldung.com/intro-to-findbugs) - +- [Cucumber Data Tables](https://www.baeldung.com/cucumber-data-tables) diff --git a/webrtc/README.md b/webrtc/README.md new file mode 100644 index 0000000000..42c06341b4 --- /dev/null +++ b/webrtc/README.md @@ -0,0 +1,8 @@ +## WebRTC + +This module contains articles about WebRTC + +### Relevant Articles: + +- [Guide to WebRTC](https://www.baeldung.com/webrtc) + diff --git a/webrtc/pom.xml b/webrtc/pom.xml new file mode 100644 index 0000000000..2a3b48b2ed --- /dev/null +++ b/webrtc/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + + webrtc + 0.0.1 + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + 1.8 + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/webrtc/src/main/java/com/baeldung/webrtc/SocketHandler.java b/webrtc/src/main/java/com/baeldung/webrtc/SocketHandler.java new file mode 100644 index 0000000000..bffd57f6cf --- /dev/null +++ b/webrtc/src/main/java/com/baeldung/webrtc/SocketHandler.java @@ -0,0 +1,31 @@ +package com.baeldung.webrtc; + +import org.springframework.stereotype.Component; +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.handler.TextWebSocketHandler; + +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +@Component +public class SocketHandler extends TextWebSocketHandler { + + List sessions = new CopyOnWriteArrayList<>(); + + @Override + public void handleTextMessage(WebSocketSession session, TextMessage message) throws InterruptedException, IOException { + + for (WebSocketSession webSocketSession : sessions) { + if (webSocketSession.isOpen() && !session.getId().equals(webSocketSession.getId())) { + webSocketSession.sendMessage(message); + } + } + } + + @Override + public void afterConnectionEstablished(WebSocketSession session) throws Exception { + sessions.add(session); + } +} \ No newline at end of file diff --git a/webrtc/src/main/java/com/baeldung/webrtc/WebRTCDemoApplication.java b/webrtc/src/main/java/com/baeldung/webrtc/WebRTCDemoApplication.java new file mode 100644 index 0000000000..f54946547d --- /dev/null +++ b/webrtc/src/main/java/com/baeldung/webrtc/WebRTCDemoApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.webrtc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class WebRTCDemoApplication { + + public static void main(String[] args) { + SpringApplication.run(WebRTCDemoApplication.class, args); + } +} diff --git a/webrtc/src/main/java/com/baeldung/webrtc/WebSocketConfiguration.java b/webrtc/src/main/java/com/baeldung/webrtc/WebSocketConfiguration.java new file mode 100644 index 0000000000..9deb395dad --- /dev/null +++ b/webrtc/src/main/java/com/baeldung/webrtc/WebSocketConfiguration.java @@ -0,0 +1,17 @@ +package com.baeldung.webrtc; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.config.annotation.EnableWebSocket; +import org.springframework.web.socket.config.annotation.WebSocketConfigurer; +import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; + +@Configuration +@EnableWebSocket +public class WebSocketConfiguration implements WebSocketConfigurer { + + @Override + public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { + registry.addHandler(new SocketHandler(), "/socket") + .setAllowedOrigins("*"); + } +} diff --git a/webrtc/src/main/resources/application.properties b/webrtc/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webrtc/src/main/resources/static/client.js b/webrtc/src/main/resources/static/client.js new file mode 100644 index 0000000000..059dc84bcb --- /dev/null +++ b/webrtc/src/main/resources/static/client.js @@ -0,0 +1,116 @@ +//connecting to our signaling server +var conn = new WebSocket('ws://localhost:8080/socket'); + +conn.onopen = function() { + console.log("Connected to the signaling server"); + initialize(); +}; + +conn.onmessage = function(msg) { + console.log("Got message", msg.data); + var content = JSON.parse(msg.data); + var data = content.data; + switch (content.event) { + // when somebody wants to call us + case "offer": + handleOffer(data); + break; + case "answer": + handleAnswer(data); + break; + // when a remote peer sends an ice candidate to us + case "candidate": + handleCandidate(data); + break; + default: + break; + } +}; + +function send(message) { + conn.send(JSON.stringify(message)); +} + +var peerConnection; +var dataChannel; +var input = document.getElementById("messageInput"); + +function initialize() { + var configuration = null; + + peerConnection = new RTCPeerConnection(configuration, { + optional : [ { + RtpDataChannels : true + } ] + }); + + // Setup ice handling + peerConnection.onicecandidate = function(event) { + if (event.candidate) { + send({ + event : "candidate", + data : event.candidate + }); + } + }; + + // creating data channel + dataChannel = peerConnection.createDataChannel("dataChannel", { + reliable : true + }); + + dataChannel.onerror = function(error) { + console.log("Error occured on datachannel:", error); + }; + + // when we receive a message from the other peer, printing it on the console + dataChannel.onmessage = function(event) { + console.log("message:", event.data); + }; + + dataChannel.onclose = function() { + console.log("data channel is closed"); + }; +} + +function createOffer() { + peerConnection.createOffer(function(offer) { + send({ + event : "offer", + data : offer + }); + peerConnection.setLocalDescription(offer); + }, function(error) { + alert("Error creating an offer"); + }); +} + +function handleOffer(offer) { + peerConnection.setRemoteDescription(new RTCSessionDescription(offer)); + + // create and send an answer to an offer + peerConnection.createAnswer(function(answer) { + peerConnection.setLocalDescription(answer); + send({ + event : "answer", + data : answer + }); + }, function(error) { + alert("Error creating an answer"); + }); + +}; + +function handleCandidate(candidate) { + peerConnection.addIceCandidate(new RTCIceCandidate(candidate)); +}; + +function handleAnswer(answer) { + peerConnection.setRemoteDescription(new RTCSessionDescription(answer)); + console.log("connection established successfully!!"); +}; + +function sendMessage() { + dataChannel.send(input.value); + input.value = ""; +} diff --git a/webrtc/src/main/resources/static/index.html b/webrtc/src/main/resources/static/index.html new file mode 100644 index 0000000000..39a86ec61e --- /dev/null +++ b/webrtc/src/main/resources/static/index.html @@ -0,0 +1,67 @@ + + + +WebRTC demo + + + + + + + + + + +
+

A Demo for messaging in WebRTC

+ +

+ Run two instances of this webpage along with the server to test this + application.
Create an offer, and then send the message.
Check + the browser console to see the output. +

+ + + + + + + + +
+ + + + +