diff --git a/core-java-modules/core-java-11-2/pom.xml b/core-java-modules/core-java-11-2/pom.xml index e2b129ae00..b92963a5c8 100644 --- a/core-java-modules/core-java-11-2/pom.xml +++ b/core-java-modules/core-java-11-2/pom.xml @@ -28,6 +28,29 @@ ${assertj.version} test + + org.mock-server + mockserver-junit-jupiter + ${mockserver.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + @@ -48,7 +71,9 @@ 11 11 29.0-jre + 5.7.0 3.17.2 + 5.11.1 diff --git a/core-java-modules/core-java-11-2/src/main/java/com/baeldung/features/MainClass.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/features/MainClass.java new file mode 100644 index 0000000000..b00c56fcd7 --- /dev/null +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/features/MainClass.java @@ -0,0 +1,17 @@ +package com.baeldung.features; + +public class MainClass { + + private static boolean mainPrivateMethod() { + return true; + } + + public static class NestedClass { + + boolean nestedPublicMethod() { + return mainPrivateMethod(); + } + + } + +} diff --git a/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/HttpClientIntegrationTest.java b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/HttpClientIntegrationTest.java new file mode 100644 index 0000000000..1d49f5dbd1 --- /dev/null +++ b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/HttpClientIntegrationTest.java @@ -0,0 +1,54 @@ +package com.baeldung.features; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.model.HttpStatusCode; +import org.mockserver.socket.PortFactory; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockserver.integration.ClientAndServer.startClientAndServer; + +class HttpClientIntegrationTest { + + private static ClientAndServer mockServer; + private static int port; + + @BeforeAll + static void startServer() { + port = PortFactory.findFreePort(); + mockServer = startClientAndServer(port); + mockServer.when(new org.mockserver.model.HttpRequest().withMethod("GET")) + .respond(new org.mockserver.model.HttpResponse() + .withStatusCode(HttpStatusCode.OK_200.code()) + .withBody("Hello from the server!")); + } + + @AfterAll + static void stopServer() { + mockServer.stop(); + } + + @Test + void givenSampleHttpRequest_whenRequestIsSent_thenServerResponseIsReceived() throws IOException, InterruptedException { + HttpClient httpClient = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .connectTimeout(Duration.ofSeconds(20)) + .build(); + HttpRequest httpRequest = HttpRequest.newBuilder() + .GET() + .uri(URI.create("http://localhost:" + port)) + .build(); + HttpResponse httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString()); + assertThat(httpResponse.body()).isEqualTo("Hello from the server!"); + } + +} diff --git a/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/JavaElevenFeaturesUnitTest.java b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/JavaElevenFeaturesUnitTest.java new file mode 100644 index 0000000000..61ce9c7c13 --- /dev/null +++ b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/JavaElevenFeaturesUnitTest.java @@ -0,0 +1,61 @@ +package com.baeldung.features; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import javax.annotation.Nonnull; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; + +class JavaElevenFeaturesUnitTest { + + @Test + void givenMultilineString_whenExtractingNonBlankStrippedLines_thenLinesAreReturned() { + String multilineString = "Baeldung helps \n \n developers \n explore Java."; + List lines = multilineString.lines() + .filter(line -> !line.isBlank()) + .map(String::strip) + .collect(Collectors.toList()); + assertThat(lines).containsExactly("Baeldung helps", "developers", "explore Java."); + } + + @Test + void givenTemporaryFile_whenReadingStringContent_thenContentIsReturned(@TempDir Path tempDir) throws IOException { + Path filePath = Files.writeString(Files.createTempFile(tempDir, "demo", ".txt"), "Sample text"); + String fileContent = Files.readString(filePath); + assertThat(fileContent).isEqualTo("Sample text"); + } + + @Test + void givenSampleList_whenConvertingToArray_thenItemsRemainUnchanged() { + List sampleList = Arrays.asList("Java", "Kotlin"); + String[] sampleArray = sampleList.toArray(String[]::new); + assertThat(sampleArray).containsExactly("Java", "Kotlin"); + } + + @Test + void givenSampleList_whenConvertingToUppercaseString_thenUppercaseIsReturned() { + List sampleList = Arrays.asList("Java", "Kotlin"); + String resultString = sampleList.stream() + .map((@Nonnull var x) -> x.toUpperCase()) + .collect(Collectors.joining(", ")); + assertThat(resultString).isEqualTo("JAVA, KOTLIN"); + } + + @Test + void givenSampleList_whenExtractingNonBlankValues_thenOnlyNonBlanksAreReturned() { + List sampleList = Arrays.asList("Java", "\n \n", "Kotlin", " "); + List withoutBlanks = sampleList.stream() + .filter(Predicate.not(String::isBlank)) + .collect(Collectors.toList()); + assertThat(withoutBlanks).containsExactly("Java", "Kotlin"); + } + +} diff --git a/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/NestedClassesUnitTest.java b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/NestedClassesUnitTest.java new file mode 100644 index 0000000000..902ad9c6f8 --- /dev/null +++ b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/features/NestedClassesUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.features; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; + +class NestedClassesUnitTest { + + @Test + public void giveNestedClass_whenCallingMainClassPrivateMethod_thenNoExceptionIsThrown() { + MainClass.NestedClass nestedInstance = new MainClass.NestedClass(); + assertThat(nestedInstance.nestedPublicMethod()).isTrue(); + } + + @Test + public void giveNestedClass_whenCheckingNestmate_thenNestedClassIsReturned() { + assertThat(MainClass.class.isNestmateOf(MainClass.NestedClass.class)).isTrue(); + } + + @Test + public void giveNestedClass_whenCheckingNestHost_thenMainClassIsReturned() { + assertThat(MainClass.NestedClass.class.getNestHost()).isEqualTo(MainClass.class); + } + + @Test + public void giveNestedClass_whenCheckingNestMembers_thenNestMembersAreReturned() { + Set nestedMembers = Arrays.stream(MainClass.NestedClass.class.getNestMembers()) + .map(Class::getName) + .collect(Collectors.toSet()); + assertThat(nestedMembers).contains(MainClass.class.getName(), MainClass.NestedClass.class.getName()); + } + +} diff --git a/core-java-modules/core-java-os/src/main/java/com/baeldung/java9/process/OutputStreamExample.java b/core-java-modules/core-java-os/src/main/java/com/baeldung/java9/process/OutputStreamExample.java index 37378f9d6c..fc6d907bfd 100644 --- a/core-java-modules/core-java-os/src/main/java/com/baeldung/java9/process/OutputStreamExample.java +++ b/core-java-modules/core-java-os/src/main/java/com/baeldung/java9/process/OutputStreamExample.java @@ -6,8 +6,7 @@ import java.util.logging.Logger; public class OutputStreamExample { public static void main(String[] args) { - Logger log = Logger.getLogger(OutputStreamExample.class.getName()); - log.log(Level.INFO, Integer.toString(sum(1,2))); + System.out.println(sum(1,2)); } public static int sum(int a, int b) { diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessUnderstandingUnitTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessUnderstandingUnitTest.java index c8932efb4f..69b65852cc 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessUnderstandingUnitTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessUnderstandingUnitTest.java @@ -5,10 +5,10 @@ import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.*; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.lang.String; -import java.util.Optional; import java.util.concurrent.TimeUnit; import java.lang.Integer; @@ -88,4 +88,21 @@ class ProcessUnderstandingUnitTest { .filter(ph -> (ph.pid() > 10000 && ph.pid() < 50000)) .count()) > 0); } + + @Test + public void givenSourceProgram_whenReadingInputStream_thenFirstLineEquals3() throws IOException { + + Runtime.getRuntime() + .exec("javac -cp src src/main/java/com/baeldung/java9/process/OutputStreamExample.java" + .replace("/", File.separator)); + + Process process = Runtime.getRuntime() + .exec("java -cp src/main/java com.baeldung.java9.process.OutputStreamExample" + .replace("/", File.separator)); + + BufferedReader output = new BufferedReader(new InputStreamReader(process.getInputStream())); + int value = Integer.parseInt(output.readLine()); + + assertEquals(3, value); + } } diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java index ac358b4e71..bf271ef2cc 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java @@ -9,11 +9,13 @@ import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; + +import org.junit.Ignore; import org.junit.Test; -import org.junit.jupiter.api.Disabled; import static org.junit.Assert.assertTrue; +@Ignore public class ScreenshotUnitTest { @Test @@ -43,7 +45,6 @@ public class ScreenshotUnitTest { // This methods needs a component as a parameter and can only be run from an application with a GUI @Test - @Disabled public void givenComponent_whenTakeScreenshot_thenSaveToFile(Component component) throws Exception { Rectangle componentRect = component.getBounds(); BufferedImage bufferedImage = new BufferedImage(componentRect.width, componentRect.height, BufferedImage.TYPE_INT_ARGB); diff --git a/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java b/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java index 1611a3002f..52dc9ba1c6 100644 --- a/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java +++ b/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java @@ -18,15 +18,6 @@ import static org.powermock.api.mockito.PowerMockito.mockStatic; @PrepareForTest({ LocalDateTime.class }) public class LocalDateTimeUnitTest { - @Test - public void givenLocalDateTimeMock_whenNow_thenGetFixedLocalDateTime() { - Clock clock = Clock.fixed(Instant.parse("2014-12-22T10:15:30.00Z"), ZoneId.of("UTC")); - String dateTimeExpected = "2014-12-22T10:15:30"; - LocalDateTime now = LocalDateTime.now(clock); - - assertThat(now).isEqualTo(dateTimeExpected); - } - @Test public void givenFixedClock_whenNow_thenGetFixedLocalDateTime() { Clock clock = Clock.fixed(Instant.parse("2014-12-22T10:15:30.00Z"), ZoneId.of("UTC")); diff --git a/pom.xml b/pom.xml index 44a87ecd3c..16de220d8c 100644 --- a/pom.xml +++ b/pom.xml @@ -658,21 +658,11 @@ spring-mobile spring-mockito - - spring-mvc-forms-thymeleaf - spring-mvc-java - spring-mvc-java-2 - - spring-mvc-velocity - spring-mvc-xml - spring-protobuf spring-quartz spring-reactor spring-remoting - spring-rest-http-2 - spring-rest-query-language spring-rest-simple spring-resttemplate spring-rest-testing @@ -1124,19 +1114,11 @@ spring-mobile spring-mockito - spring-mvc-forms-thymeleaf - spring-mvc-java - spring-mvc-java-2 - - spring-mvc-velocity - spring-mvc-xml - spring-protobuf spring-quartz spring-reactor spring-remoting - spring-rest-query-language spring-rest-simple spring-resttemplate spring-rest-testing diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index 825af8fb9e..c562d522e2 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -24,6 +24,7 @@ spring-boot-angular spring-boot-annotations spring-boot-artifacts + spring-boot-artifacts-2 spring-boot-autoconfiguration spring-boot-basic-customization spring-boot-basic-customization-2 diff --git a/spring-boot-modules/spring-boot-artifacts-2/README.md b/spring-boot-modules/spring-boot-artifacts-2/README.md new file mode 100644 index 0000000000..80e3d95d14 --- /dev/null +++ b/spring-boot-modules/spring-boot-artifacts-2/README.md @@ -0,0 +1,7 @@ +## Spring Boot Artifacts 2 + +This module contains articles about configuring the Spring Boot build process 2. + +### Relevant Articles: + +TBD \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-artifacts-2/pom.xml b/spring-boot-modules/spring-boot-artifacts-2/pom.xml new file mode 100644 index 0000000000..abea13151e --- /dev/null +++ b/spring-boot-modules/spring-boot-artifacts-2/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + + com.baeldung.spring-boot-modules + spring-boot-modules + 1.0.0-SNAPSHOT + ../ + + + spring-boot-artifacts-2 + jar + + spring-boot-artifacts-2 + Demo project for Spring Boot + + + + org.springframework.boot + spring-boot-starter-web + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + com.baeldung.demo.DemoApplication + + + diff --git a/spring-boot-modules/spring-boot-artifacts-2/src/main/java/com/baeldung/demo/DemoApplication.java b/spring-boot-modules/spring-boot-artifacts-2/src/main/java/com/baeldung/demo/DemoApplication.java new file mode 100644 index 0000000000..177d3c834e --- /dev/null +++ b/spring-boot-modules/spring-boot-artifacts-2/src/main/java/com/baeldung/demo/DemoApplication.java @@ -0,0 +1,11 @@ +package com.baeldung.demo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DemoApplication { + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } +} diff --git a/spring-boot-modules/spring-boot-artifacts-2/src/main/java/com/baeldung/demo/DemoRestController.java b/spring-boot-modules/spring-boot-artifacts-2/src/main/java/com/baeldung/demo/DemoRestController.java new file mode 100644 index 0000000000..0869927926 --- /dev/null +++ b/spring-boot-modules/spring-boot-artifacts-2/src/main/java/com/baeldung/demo/DemoRestController.java @@ -0,0 +1,15 @@ +package com.baeldung.demo; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class DemoRestController { + + @GetMapping(value = "/welcome") + public ResponseEntity welcomeEndpoint() { + return ResponseEntity.ok("Welcome to Baeldung Spring Boot Demo!"); + } + +} diff --git a/spring-boot-modules/spring-boot-artifacts-2/src/main/resources/application.yml b/spring-boot-modules/spring-boot-artifacts-2/src/main/resources/application.yml new file mode 100644 index 0000000000..3cd1d2e797 --- /dev/null +++ b/spring-boot-modules/spring-boot-artifacts-2/src/main/resources/application.yml @@ -0,0 +1,3 @@ +spring: + application: + name: Baeldung_SpringBoot_Demo \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerManualTest.java b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerIntegrationTest.java similarity index 88% rename from spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerManualTest.java rename to spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerIntegrationTest.java index 4d3cede534..7fdc723305 100644 --- a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerManualTest.java +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/java/com/baeldung/spring/cloud/zuulratelimitdemo/controller/GreetingControllerIntegrationTest.java @@ -5,14 +5,21 @@ import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateL import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateLimitConstants.HEADER_REMAINING; import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateLimitConstants.HEADER_REMAINING_QUOTA; import static com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.support.RateLimitConstants.HEADER_RESET; +import static java.lang.Integer.parseInt; +import static org.hamcrest.Matchers.both; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.lessThanOrEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.TOO_MANY_REQUESTS; import java.util.concurrent.TimeUnit; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +33,7 @@ import org.springframework.test.context.junit4.SpringRunner; @AutoConfigureTestDatabase @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class GreetingControllerManualTest { +public class GreetingControllerIntegrationTest { private static final String SIMPLE_GREETING = "/greeting/simple"; private static final String ADVANCED_GREETING = "/greeting/advanced"; @@ -44,9 +51,13 @@ public class GreetingControllerManualTest { String remaining = headers.getFirst(HEADER_REMAINING + key); String reset = headers.getFirst(HEADER_RESET + key); - assertEquals(limit, "5"); - assertEquals(remaining, "4"); - assertEquals(reset, "60000"); + assertEquals("5", limit); + assertEquals(remaining, "4", remaining); + assertNotNull(reset); + assertThat( + parseInt(reset), + is(both(greaterThanOrEqualTo(0)).and(lessThanOrEqualTo(60000))) + ); assertEquals(OK, response.getStatusCode()); } diff --git a/spring-web-modules/pom.xml b/spring-web-modules/pom.xml index 9fb40a1ed3..d2d8b5d816 100644 --- a/spring-web-modules/pom.xml +++ b/spring-web-modules/pom.xml @@ -20,10 +20,17 @@ spring-mvc-basics-4 spring-mvc-crash spring-mvc-forms-jsp + spring-mvc-forms-thymeleaf + spring-mvc-java + spring-mvc-java-2 + spring-mvc-velocity spring-mvc-views spring-mvc-webflow + spring-mvc-xml spring-rest-angular spring-rest-http + spring-rest-http-2 + spring-rest-query-language spring-rest-shell spring-resttemplate-2 spring-thymeleaf diff --git a/spring-mvc-forms-thymeleaf/README.md b/spring-web-modules/spring-mvc-forms-thymeleaf/README.md similarity index 100% rename from spring-mvc-forms-thymeleaf/README.md rename to spring-web-modules/spring-mvc-forms-thymeleaf/README.md diff --git a/spring-mvc-forms-thymeleaf/pom.xml b/spring-web-modules/spring-mvc-forms-thymeleaf/pom.xml similarity index 96% rename from spring-mvc-forms-thymeleaf/pom.xml rename to spring-web-modules/spring-mvc-forms-thymeleaf/pom.xml index 2aed7f70ad..641f64b93c 100644 --- a/spring-mvc-forms-thymeleaf/pom.xml +++ b/spring-web-modules/spring-mvc-forms-thymeleaf/pom.xml @@ -11,7 +11,7 @@ com.baeldung parent-boot-2 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/Book.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/Book.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/Book.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/Book.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/BookService.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/BookService.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/BookService.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/BookService.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/BooksCreationDto.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/BooksCreationDto.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/BooksCreationDto.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/BooksCreationDto.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/Config.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/Config.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/Config.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/Config.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/InMemoryBookService.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/InMemoryBookService.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/InMemoryBookService.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/InMemoryBookService.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/ListBindingApplication.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/ListBindingApplication.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/ListBindingApplication.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/ListBindingApplication.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/MultipleBooksController.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/MultipleBooksController.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/MultipleBooksController.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/listbindingexample/MultipleBooksController.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/Config.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/Config.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/Config.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/Config.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/SessionAttrsApplication.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/SessionAttrsApplication.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/SessionAttrsApplication.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/SessionAttrsApplication.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoControllerWithScopedProxy.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoControllerWithScopedProxy.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoControllerWithScopedProxy.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoControllerWithScopedProxy.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoControllerWithSessionAttributes.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoControllerWithSessionAttributes.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoControllerWithSessionAttributes.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoControllerWithSessionAttributes.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoItem.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoItem.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoItem.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoItem.java diff --git a/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoList.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoList.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoList.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/java/com/baeldung/sessionattrs/TodoList.java diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/application.properties b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/application.properties similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/application.properties rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/application.properties diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/logback.xml rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/allBooks.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/allBooks.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/books/allBooks.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/allBooks.html diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/createBooksForm.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/createBooksForm.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/books/createBooksForm.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/createBooksForm.html diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/editBooksForm.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/editBooksForm.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/books/editBooksForm.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/editBooksForm.html diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/index.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/index.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/books/index.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/books/index.html diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/index.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/index.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/index.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/index.html diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/scopedproxyform.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/scopedproxyform.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/scopedproxyform.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/scopedproxyform.html diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/scopedproxytodos.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/scopedproxytodos.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/scopedproxytodos.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/scopedproxytodos.html diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/sessionattributesform.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/sessionattributesform.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/sessionattributesform.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/sessionattributesform.html diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/sessionattributestodos.html b/spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/sessionattributestodos.html similarity index 100% rename from spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/sessionattributestodos.html rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/main/resources/templates/sessionattrs/sessionattributestodos.html diff --git a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextTest.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/listbindingexample/SpringContextTest.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextTest.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/listbindingexample/SpringContextTest.java diff --git a/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/SessionAttrsApplicationIntegrationTest.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/SessionAttrsApplicationIntegrationTest.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/SessionAttrsApplicationIntegrationTest.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/SessionAttrsApplicationIntegrationTest.java diff --git a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextTest.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/SpringContextTest.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextTest.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/SpringContextTest.java diff --git a/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TestConfig.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TestConfig.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TestConfig.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TestConfig.java diff --git a/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TodoControllerWithScopedProxyIntegrationTest.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TodoControllerWithScopedProxyIntegrationTest.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TodoControllerWithScopedProxyIntegrationTest.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TodoControllerWithScopedProxyIntegrationTest.java diff --git a/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TodoControllerWithSessionAttributesIntegrationTest.java b/spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TodoControllerWithSessionAttributesIntegrationTest.java similarity index 100% rename from spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TodoControllerWithSessionAttributesIntegrationTest.java rename to spring-web-modules/spring-mvc-forms-thymeleaf/src/test/java/com/baeldung/sessionattrs/TodoControllerWithSessionAttributesIntegrationTest.java diff --git a/spring-mvc-java-2/.gitignore b/spring-web-modules/spring-mvc-java-2/.gitignore similarity index 100% rename from spring-mvc-java-2/.gitignore rename to spring-web-modules/spring-mvc-java-2/.gitignore diff --git a/spring-mvc-java-2/README.md b/spring-web-modules/spring-mvc-java-2/README.md similarity index 100% rename from spring-mvc-java-2/README.md rename to spring-web-modules/spring-mvc-java-2/README.md diff --git a/spring-mvc-java-2/pom.xml b/spring-web-modules/spring-mvc-java-2/pom.xml similarity index 97% rename from spring-mvc-java-2/pom.xml rename to spring-web-modules/spring-mvc-java-2/pom.xml index 533a24771a..8a025defac 100644 --- a/spring-mvc-java-2/pom.xml +++ b/spring-web-modules/spring-mvc-java-2/pom.xml @@ -12,7 +12,7 @@ com.baeldung parent-boot-2 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheWebConfig.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheWebConfig.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheWebConfig.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheWebConfig.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeController.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeController.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeController.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeController.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/matrix/config/MatrixWebConfig.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/config/MatrixWebConfig.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/matrix/config/MatrixWebConfig.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/config/MatrixWebConfig.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/matrix/controller/CompanyController.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/controller/CompanyController.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/matrix/controller/CompanyController.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/controller/CompanyController.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/matrix/controller/EmployeeController.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/controller/EmployeeController.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/matrix/controller/EmployeeController.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/controller/EmployeeController.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/matrix/model/Company.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/model/Company.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/matrix/model/Company.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/model/Company.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/matrix/model/Employee.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/model/Employee.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/matrix/model/Employee.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/matrix/model/Employee.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/multiparttesting/MultipartPostRequestController.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/multiparttesting/MultipartPostRequestController.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/multiparttesting/MultipartPostRequestController.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/multiparttesting/MultipartPostRequestController.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/CustomWebMvcConfigurationSupport.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/CustomWebMvcConfigurationSupport.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/CustomWebMvcConfigurationSupport.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/CustomWebMvcConfigurationSupport.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/SiteController.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/SiteController.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/SiteController.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/SiteController.java diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java b/spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java similarity index 100% rename from spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java rename to spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java diff --git a/spring-mvc-java-2/src/main/resources/targetFile.tmp b/spring-web-modules/spring-mvc-java-2/src/main/resources/targetFile.tmp similarity index 100% rename from spring-mvc-java-2/src/main/resources/targetFile.tmp rename to spring-web-modules/spring-mvc-java-2/src/main/resources/targetFile.tmp diff --git a/spring-mvc-java-2/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-mvc-java-2/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-mvc-java-2/src/main/webapp/WEB-INF/view/companyHome.jsp b/spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/view/companyHome.jsp similarity index 100% rename from spring-mvc-java-2/src/main/webapp/WEB-INF/view/companyHome.jsp rename to spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/view/companyHome.jsp diff --git a/spring-mvc-java-2/src/main/webapp/WEB-INF/view/companyView.jsp b/spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/view/companyView.jsp similarity index 100% rename from spring-mvc-java-2/src/main/webapp/WEB-INF/view/companyView.jsp rename to spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/view/companyView.jsp diff --git a/spring-mvc-java-2/src/main/webapp/WEB-INF/view/employeeHome.jsp b/spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/view/employeeHome.jsp similarity index 100% rename from spring-mvc-java-2/src/main/webapp/WEB-INF/view/employeeHome.jsp rename to spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/view/employeeHome.jsp diff --git a/spring-mvc-java-2/src/main/webapp/WEB-INF/view/employeeView.jsp b/spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/view/employeeView.jsp similarity index 100% rename from spring-mvc-java-2/src/main/webapp/WEB-INF/view/employeeView.jsp rename to spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/view/employeeView.jsp diff --git a/spring-mvc-java-2/src/main/webapp/WEB-INF/web.xml b/spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-mvc-java-2/src/main/webapp/WEB-INF/web.xml rename to spring-web-modules/spring-mvc-java-2/src/main/webapp/WEB-INF/web.xml diff --git a/spring-mvc-java-2/src/main/webapp/resources/hello.css b/spring-web-modules/spring-mvc-java-2/src/main/webapp/resources/hello.css similarity index 100% rename from spring-mvc-java-2/src/main/webapp/resources/hello.css rename to spring-web-modules/spring-mvc-java-2/src/main/webapp/resources/hello.css diff --git a/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java b/spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java similarity index 100% rename from spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java rename to spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java diff --git a/spring-mvc-java-2/src/test/java/com/baeldung/matrix/EmployeeMvcIntegrationTest.java b/spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/matrix/EmployeeMvcIntegrationTest.java similarity index 100% rename from spring-mvc-java-2/src/test/java/com/baeldung/matrix/EmployeeMvcIntegrationTest.java rename to spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/matrix/EmployeeMvcIntegrationTest.java diff --git a/spring-mvc-java-2/src/test/java/com/baeldung/matrix/EmployeeNoMvcIntegrationTest.java b/spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/matrix/EmployeeNoMvcIntegrationTest.java similarity index 100% rename from spring-mvc-java-2/src/test/java/com/baeldung/matrix/EmployeeNoMvcIntegrationTest.java rename to spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/matrix/EmployeeNoMvcIntegrationTest.java diff --git a/spring-mvc-java-2/src/test/java/com/baeldung/multipart/file/ConvertMultipartFileUnitTest.java b/spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/multipart/file/ConvertMultipartFileUnitTest.java similarity index 100% rename from spring-mvc-java-2/src/test/java/com/baeldung/multipart/file/ConvertMultipartFileUnitTest.java rename to spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/multipart/file/ConvertMultipartFileUnitTest.java diff --git a/spring-mvc-java-2/src/test/java/com/baeldung/multiparttesting/MultipartPostRequestControllerUnitTest.java b/spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/multiparttesting/MultipartPostRequestControllerUnitTest.java similarity index 100% rename from spring-mvc-java-2/src/test/java/com/baeldung/multiparttesting/MultipartPostRequestControllerUnitTest.java rename to spring-web-modules/spring-mvc-java-2/src/test/java/com/baeldung/multiparttesting/MultipartPostRequestControllerUnitTest.java diff --git a/spring-mvc-java/.gitignore b/spring-web-modules/spring-mvc-java/.gitignore similarity index 100% rename from spring-mvc-java/.gitignore rename to spring-web-modules/spring-mvc-java/.gitignore diff --git a/spring-mvc-java/README.md b/spring-web-modules/spring-mvc-java/README.md similarity index 92% rename from spring-mvc-java/README.md rename to spring-web-modules/spring-mvc-java/README.md index 877d92901a..afd1aea3bf 100644 --- a/spring-mvc-java/README.md +++ b/spring-web-modules/spring-mvc-java/README.md @@ -4,7 +4,7 @@ This module contains articles about Spring MVC with Java configuration ### The Course -The "REST With Spring" Classes: http://bit.ly/restwithspring +The "REST With Spring" Classes: https://bit.ly/restwithspring ### Relevant Articles: - [Integration Testing in Spring](https://www.baeldung.com/integration-testing-in-spring) diff --git a/spring-mvc-java/persons.xls b/spring-web-modules/spring-mvc-java/persons.xls similarity index 100% rename from spring-mvc-java/persons.xls rename to spring-web-modules/spring-mvc-java/persons.xls diff --git a/spring-mvc-java/persons.xlsx b/spring-web-modules/spring-mvc-java/persons.xlsx similarity index 100% rename from spring-mvc-java/persons.xlsx rename to spring-web-modules/spring-mvc-java/persons.xlsx diff --git a/spring-mvc-java/pom.xml b/spring-web-modules/spring-mvc-java/pom.xml similarity index 99% rename from spring-mvc-java/pom.xml rename to spring-web-modules/spring-mvc-java/pom.xml index a45e9c8521..179ac0fb54 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-web-modules/spring-mvc-java/pom.xml @@ -11,7 +11,7 @@ com.baeldung parent-boot-2 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 diff --git a/spring-mvc-java/src/main/java/com/baeldung/SpringMVCApplication.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/SpringMVCApplication.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/SpringMVCApplication.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/SpringMVCApplication.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/App.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/App.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/App.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/App.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/Controller.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/Controller.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/Controller.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/accessparamsjs/Controller.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/cache/BookService.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/cache/BookService.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/cache/BookService.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/cache/BookService.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/cache/CustomKeyGenerator.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/cache/CustomKeyGenerator.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/cache/CustomKeyGenerator.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/cache/CustomKeyGenerator.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/excel/ExcelPOIHelper.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/excel/ExcelPOIHelper.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/excel/ExcelPOIHelper.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/excel/ExcelPOIHelper.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/excel/MyCell.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/excel/MyCell.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/excel/MyCell.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/excel/MyCell.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/filters/EmptyParamFilter.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/filters/EmptyParamFilter.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/filters/EmptyParamFilter.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/filters/EmptyParamFilter.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/listeners/AppListener.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/listeners/AppListener.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/listeners/AppListener.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/listeners/AppListener.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/listeners/RequestListener.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/listeners/RequestListener.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/listeners/RequestListener.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/listeners/RequestListener.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/Article.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/Article.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/model/Article.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/Article.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/Book.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/Book.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/model/Book.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/Book.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/FormDataWithFile.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/FormDataWithFile.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/model/FormDataWithFile.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/FormDataWithFile.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/Greeting.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/Greeting.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/model/Greeting.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/Greeting.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/User.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/User.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/model/User.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/model/User.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/servlets/CounterServlet.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/servlets/CounterServlet.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/servlets/CounterServlet.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/servlets/CounterServlet.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/servlets/UppercaseServlet.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/servlets/UppercaseServlet.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/servlets/UppercaseServlet.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/servlets/UppercaseServlet.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/ApplicationCacheConfig.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/ApplicationCacheConfig.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/spring/web/config/ApplicationCacheConfig.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/ApplicationCacheConfig.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/MainWebAppInitializer.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/MainWebAppInitializer.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/spring/web/config/MainWebAppInitializer.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/MainWebAppInitializer.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/BeanA.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/BeanA.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/BeanA.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/BeanA.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/BeanB.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/BeanB.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/BeanB.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/BeanB.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/ExcelController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/ExcelController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/ExcelController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/ExcelController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/FileUploadController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/FileUploadController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/FileUploadController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/FileUploadController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/GreetController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/GreetController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/GreetController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/GreetController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/ImageController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/ImageController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/ImageController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/ImageController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/MultipartFileUploadStubController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/MultipartFileUploadStubController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/MultipartFileUploadStubController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/MultipartFileUploadStubController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/SampleController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/SampleController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/SampleController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/SampleController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/UserController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/UserController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/UserController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/UserController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/message/MessageController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/message/MessageController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/message/MessageController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/message/MessageController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithMapParamController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithMapParamController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithMapParamController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithMapParamController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithOptionalParamController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithRequiredAttributeController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java b/spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java similarity index 100% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java rename to spring-web-modules/spring-mvc-java/src/main/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java diff --git a/spring-mvc-java/src/main/resources/annotations.properties b/spring-web-modules/spring-mvc-java/src/main/resources/annotations.properties similarity index 100% rename from spring-mvc-java/src/main/resources/annotations.properties rename to spring-web-modules/spring-mvc-java/src/main/resources/annotations.properties diff --git a/spring-mvc-java/src/main/resources/annotations.xml b/spring-web-modules/spring-mvc-java/src/main/resources/annotations.xml similarity index 100% rename from spring-mvc-java/src/main/resources/annotations.xml rename to spring-web-modules/spring-mvc-java/src/main/resources/annotations.xml diff --git a/spring-mvc-java/src/main/resources/application.properties b/spring-web-modules/spring-mvc-java/src/main/resources/application.properties similarity index 100% rename from spring-mvc-java/src/main/resources/application.properties rename to spring-web-modules/spring-mvc-java/src/main/resources/application.properties diff --git a/spring-mvc-java/src/main/resources/logback.xml b/spring-web-modules/spring-mvc-java/src/main/resources/logback.xml similarity index 100% rename from spring-mvc-java/src/main/resources/logback.xml rename to spring-web-modules/spring-mvc-java/src/main/resources/logback.xml diff --git a/spring-mvc-java/src/main/resources/messages_en.properties b/spring-web-modules/spring-mvc-java/src/main/resources/messages_en.properties similarity index 100% rename from spring-mvc-java/src/main/resources/messages_en.properties rename to spring-web-modules/spring-mvc-java/src/main/resources/messages_en.properties diff --git a/spring-mvc-java/src/main/resources/mvc-configuration.xml b/spring-web-modules/spring-mvc-java/src/main/resources/mvc-configuration.xml similarity index 100% rename from spring-mvc-java/src/main/resources/mvc-configuration.xml rename to spring-web-modules/spring-mvc-java/src/main/resources/mvc-configuration.xml diff --git a/spring-mvc-java/src/main/resources/templates/thymeleaf/index.html b/spring-web-modules/spring-mvc-java/src/main/resources/templates/thymeleaf/index.html similarity index 100% rename from spring-mvc-java/src/main/resources/templates/thymeleaf/index.html rename to spring-web-modules/spring-mvc-java/src/main/resources/templates/thymeleaf/index.html diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/images/image-example.jpg b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/images/image-example.jpg similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/images/image-example.jpg rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/images/image-example.jpg diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/jsp/index.jsp b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/jsp/index.jsp similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/jsp/index.jsp rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/jsp/index.jsp diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/templates/footer.html b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/templates/footer.html similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/templates/footer.html rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/templates/footer.html diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/templates/hello.html b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/templates/hello.html similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/templates/hello.html rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/templates/hello.html diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/templates/index.html b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/templates/index.html similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/templates/index.html rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/templates/index.html diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/templates/message.html b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/templates/message.html similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/templates/message.html rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/templates/message.html diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/view/excel.jsp b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/excel.jsp similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/view/excel.jsp rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/excel.jsp diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/view/fileUploadForm.jsp b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/fileUploadForm.jsp similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/view/fileUploadForm.jsp rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/fileUploadForm.jsp diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/view/fileUploadView.jsp b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/fileUploadView.jsp similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/view/fileUploadView.jsp rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/fileUploadView.jsp diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/view/index.jsp b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/index.jsp similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/view/index.jsp rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/index.jsp diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/view/sample.jsp b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/sample.jsp similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/view/sample.jsp rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/view/sample.jsp diff --git a/spring-mvc-java/src/main/webapp/WEB-INF/web_old.xml b/spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/web_old.xml similarity index 100% rename from spring-mvc-java/src/main/webapp/WEB-INF/web_old.xml rename to spring-web-modules/spring-mvc-java/src/main/webapp/WEB-INF/web_old.xml diff --git a/spring-mvc-java/src/main/webapp/js/jquery.js b/spring-web-modules/spring-mvc-java/src/main/webapp/js/jquery.js similarity index 100% rename from spring-mvc-java/src/main/webapp/js/jquery.js rename to spring-web-modules/spring-mvc-java/src/main/webapp/js/jquery.js diff --git a/spring-mvc-java/src/main/webapp/js/script-async-jquery.js b/spring-web-modules/spring-mvc-java/src/main/webapp/js/script-async-jquery.js similarity index 100% rename from spring-mvc-java/src/main/webapp/js/script-async-jquery.js rename to spring-web-modules/spring-mvc-java/src/main/webapp/js/script-async-jquery.js diff --git a/spring-mvc-java/src/main/webapp/js/script-async.js b/spring-web-modules/spring-mvc-java/src/main/webapp/js/script-async.js similarity index 100% rename from spring-mvc-java/src/main/webapp/js/script-async.js rename to spring-web-modules/spring-mvc-java/src/main/webapp/js/script-async.js diff --git a/spring-mvc-java/src/main/webapp/js/script.js b/spring-web-modules/spring-mvc-java/src/main/webapp/js/script.js similarity index 100% rename from spring-mvc-java/src/main/webapp/js/script.js rename to spring-web-modules/spring-mvc-java/src/main/webapp/js/script.js diff --git a/spring-mvc-java/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitLiveTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitLiveTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitLiveTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitLiveTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringLiveTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringLiveTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringLiveTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringLiveTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebScrapingLiveTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebScrapingLiveTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebScrapingLiveTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebScrapingLiveTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/TestConfig.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/htmlunit/TestConfig.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/htmlunit/TestConfig.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/htmlunit/TestConfig.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerIntegrationTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerRealIntegrationTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerRealIntegrationTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerRealIntegrationTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerRealIntegrationTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/README.md b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/README.md similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/README.md rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/README.md diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java similarity index 100% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java rename to spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java diff --git a/spring-mvc-java/src/test/resources/.gitignore b/spring-web-modules/spring-mvc-java/src/test/resources/.gitignore similarity index 100% rename from spring-mvc-java/src/test/resources/.gitignore rename to spring-web-modules/spring-mvc-java/src/test/resources/.gitignore diff --git a/spring-mvc-java/src/test/resources/logback-test.xml b/spring-web-modules/spring-mvc-java/src/test/resources/logback-test.xml similarity index 100% rename from spring-mvc-java/src/test/resources/logback-test.xml rename to spring-web-modules/spring-mvc-java/src/test/resources/logback-test.xml diff --git a/spring-mvc-velocity/README.md b/spring-web-modules/spring-mvc-velocity/README.md similarity index 100% rename from spring-mvc-velocity/README.md rename to spring-web-modules/spring-mvc-velocity/README.md diff --git a/spring-mvc-velocity/pom.xml b/spring-web-modules/spring-mvc-velocity/pom.xml similarity index 98% rename from spring-mvc-velocity/pom.xml rename to spring-web-modules/spring-mvc-velocity/pom.xml index 2269f05fa4..05016962a5 100644 --- a/spring-mvc-velocity/pom.xml +++ b/spring-web-modules/spring-mvc-velocity/pom.xml @@ -11,7 +11,7 @@ com.baeldung parent-spring-4 0.0.1-SNAPSHOT - ../parent-spring-4 + ../../parent-spring-4 diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java b/spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java similarity index 100% rename from spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java rename to spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/controller/MainController.java diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java b/spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java similarity index 100% rename from spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java rename to spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/domain/Tutorial.java diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/ITutorialsService.java b/spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/ITutorialsService.java similarity index 100% rename from spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/ITutorialsService.java rename to spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/ITutorialsService.java diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java b/spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java similarity index 100% rename from spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java rename to spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/service/TutorialsService.java diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/MainWebAppInitializer.java b/spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/MainWebAppInitializer.java similarity index 100% rename from spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/MainWebAppInitializer.java rename to spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/MainWebAppInitializer.java diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/WebConfig.java b/spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/WebConfig.java similarity index 100% rename from spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/WebConfig.java rename to spring-web-modules/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/WebConfig.java diff --git a/spring-mvc-velocity/src/main/resources/logback.xml b/spring-web-modules/spring-mvc-velocity/src/main/resources/logback.xml similarity index 100% rename from spring-mvc-velocity/src/main/resources/logback.xml rename to spring-web-modules/spring-mvc-velocity/src/main/resources/logback.xml diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm b/spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm similarity index 100% rename from spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm rename to spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm b/spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm similarity index 100% rename from spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm rename to spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm b/spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm similarity index 100% rename from spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm rename to spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml b/spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml similarity index 100% rename from spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml rename to spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm b/spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm similarity index 100% rename from spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm rename to spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/views/list.vm b/spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/views/list.vm similarity index 100% rename from spring-mvc-velocity/src/main/webapp/WEB-INF/views/list.vm rename to spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/views/list.vm diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/web_old.xml b/spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/web_old.xml similarity index 100% rename from spring-mvc-velocity/src/main/webapp/WEB-INF/web_old.xml rename to spring-web-modules/spring-mvc-velocity/src/main/webapp/WEB-INF/web_old.xml diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/DataContentControllerIntegrationTest.java b/spring-web-modules/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/DataContentControllerIntegrationTest.java similarity index 100% rename from spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/DataContentControllerIntegrationTest.java rename to spring-web-modules/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/DataContentControllerIntegrationTest.java diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/config/TestConfig.java b/spring-web-modules/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/config/TestConfig.java similarity index 100% rename from spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/config/TestConfig.java rename to spring-web-modules/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/config/TestConfig.java diff --git a/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextTest.java b/spring-web-modules/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextTest.java similarity index 100% rename from spring-mvc-velocity/src/test/java/org/baeldung/SpringContextTest.java rename to spring-web-modules/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextTest.java diff --git a/spring-mvc-velocity/src/test/resources/mvc-servlet.xml b/spring-web-modules/spring-mvc-velocity/src/test/resources/mvc-servlet.xml similarity index 100% rename from spring-mvc-velocity/src/test/resources/mvc-servlet.xml rename to spring-web-modules/spring-mvc-velocity/src/test/resources/mvc-servlet.xml diff --git a/spring-mvc-xml/.gitignore b/spring-web-modules/spring-mvc-xml/.gitignore similarity index 100% rename from spring-mvc-xml/.gitignore rename to spring-web-modules/spring-mvc-xml/.gitignore diff --git a/spring-mvc-xml/README.md b/spring-web-modules/spring-mvc-xml/README.md similarity index 100% rename from spring-mvc-xml/README.md rename to spring-web-modules/spring-mvc-xml/README.md diff --git a/spring-mvc-xml/pom.xml b/spring-web-modules/spring-mvc-xml/pom.xml similarity index 100% rename from spring-mvc-xml/pom.xml rename to spring-web-modules/spring-mvc-xml/pom.xml diff --git a/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfigJava.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfigJava.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfigJava.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfigJava.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ConstraintViolationExceptionHandler.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ConstraintViolationExceptionHandler.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ConstraintViolationExceptionHandler.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ConstraintViolationExceptionHandler.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ErrorController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ErrorController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ErrorController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ErrorController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GeoIPTestController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GeoIPTestController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GeoIPTestController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GeoIPTestController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GreetingController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GreetingController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GreetingController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GreetingController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloGuestController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloGuestController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloGuestController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloGuestController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloWorldController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloWorldController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloWorldController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/HelloWorldController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ImageController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ImageController.java similarity index 97% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ImageController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ImageController.java index fc46c07e06..c02e76d4c0 100644 --- a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ImageController.java +++ b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/ImageController.java @@ -1,61 +1,61 @@ -package com.baeldung.spring.controller; - -import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.Resource; -import org.springframework.http.*; -import org.springframework.stereotype.Controller; -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.context.support.ServletContextResource; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; - -@Controller -public class ImageController { - - @Autowired - private ServletContext servletContext; - - @RequestMapping(value = "/image-view", method = RequestMethod.GET) - public String imageView() throws IOException { - return "image-download"; - } - - @RequestMapping(value = "/image-manual-response", method = RequestMethod.GET) - public void getImageAsByteArray(HttpServletResponse response) throws IOException { - final InputStream in = servletContext.getResourceAsStream("/WEB-INF/images/image-example.jpg"); - response.setContentType(MediaType.IMAGE_JPEG_VALUE); - IOUtils.copy(in, response.getOutputStream()); - } - - @RequestMapping(value = "/image-byte-array", method = RequestMethod.GET) - @ResponseBody - public byte[] getImageAsByteArray() throws IOException { - final InputStream in = servletContext.getResourceAsStream("/WEB-INF/images/image-example.jpg"); - return IOUtils.toByteArray(in); - } - - @RequestMapping(value = "/image-response-entity", method = RequestMethod.GET) - public ResponseEntity getImageAsResponseEntity() throws IOException { - ResponseEntity responseEntity; - final HttpHeaders headers = new HttpHeaders(); - final InputStream in = servletContext.getResourceAsStream("/WEB-INF/images/image-example.jpg"); - byte[] media = IOUtils.toByteArray(in); - headers.setCacheControl(CacheControl.noCache().getHeaderValue()); - responseEntity = new ResponseEntity<>(media, headers, HttpStatus.OK); - return responseEntity; - } - - @RequestMapping(value = "/image-resource", method = RequestMethod.GET) - @ResponseBody - public ResponseEntity getImageAsResource() { - final HttpHeaders headers = new HttpHeaders(); - Resource resource = new ServletContextResource(servletContext, "/WEB-INF/images/image-example.jpg"); - return new ResponseEntity<>(resource, headers, HttpStatus.OK); - } -} +package com.baeldung.spring.controller; + +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.http.*; +import org.springframework.stereotype.Controller; +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.context.support.ServletContextResource; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; + +@Controller +public class ImageController { + + @Autowired + private ServletContext servletContext; + + @RequestMapping(value = "/image-view", method = RequestMethod.GET) + public String imageView() throws IOException { + return "image-download"; + } + + @RequestMapping(value = "/image-manual-response", method = RequestMethod.GET) + public void getImageAsByteArray(HttpServletResponse response) throws IOException { + final InputStream in = servletContext.getResourceAsStream("/WEB-INF/images/image-example.jpg"); + response.setContentType(MediaType.IMAGE_JPEG_VALUE); + IOUtils.copy(in, response.getOutputStream()); + } + + @RequestMapping(value = "/image-byte-array", method = RequestMethod.GET) + @ResponseBody + public byte[] getImageAsByteArray() throws IOException { + final InputStream in = servletContext.getResourceAsStream("/WEB-INF/images/image-example.jpg"); + return IOUtils.toByteArray(in); + } + + @RequestMapping(value = "/image-response-entity", method = RequestMethod.GET) + public ResponseEntity getImageAsResponseEntity() throws IOException { + ResponseEntity responseEntity; + final HttpHeaders headers = new HttpHeaders(); + final InputStream in = servletContext.getResourceAsStream("/WEB-INF/images/image-example.jpg"); + byte[] media = IOUtils.toByteArray(in); + headers.setCacheControl(CacheControl.noCache().getHeaderValue()); + responseEntity = new ResponseEntity<>(media, headers, HttpStatus.OK); + return responseEntity; + } + + @RequestMapping(value = "/image-resource", method = RequestMethod.GET) + @ResponseBody + public ResponseEntity getImageAsResource() { + final HttpHeaders headers = new HttpHeaders(); + Resource resource = new ServletContextResource(servletContext, "/WEB-INF/images/image-example.jpg"); + return new ResponseEntity<>(resource, headers, HttpStatus.OK); + } +} diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/PersonController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/PersonController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/PersonController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/PersonController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/RequestAndPathVariableValidationController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/RequestAndPathVariableValidationController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/RequestAndPathVariableValidationController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/RequestAndPathVariableValidationController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/WelcomeController.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/WelcomeController.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/controller/WelcomeController.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/WelcomeController.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/form/GeoIP.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/form/GeoIP.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/form/GeoIP.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/form/GeoIP.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/form/Person.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/form/Person.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/form/Person.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/form/Person.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/service/RawDBDemoGeoIPLocationService.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/service/RawDBDemoGeoIPLocationService.java similarity index 100% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/service/RawDBDemoGeoIPLocationService.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/service/RawDBDemoGeoIPLocationService.java diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/validator/PersonValidator.java b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/validator/PersonValidator.java similarity index 96% rename from spring-mvc-xml/src/main/java/com/baeldung/spring/validator/PersonValidator.java rename to spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/validator/PersonValidator.java index f7625bacd9..cda756cdfc 100644 --- a/spring-mvc-xml/src/main/java/com/baeldung/spring/validator/PersonValidator.java +++ b/spring-web-modules/spring-mvc-xml/src/main/java/com/baeldung/spring/validator/PersonValidator.java @@ -1,22 +1,22 @@ -package com.baeldung.spring.validator; - -import com.baeldung.spring.form.Person; -import org.springframework.stereotype.Component; -import org.springframework.validation.Errors; -import org.springframework.validation.ValidationUtils; -import org.springframework.validation.Validator; - -@Component -public class PersonValidator implements Validator { - - @Override - public boolean supports(final Class calzz) { - return Person.class.isAssignableFrom(calzz); - } - - @Override - public void validate(final Object obj, final Errors errors) { - - ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "required.name"); - } +package com.baeldung.spring.validator; + +import com.baeldung.spring.form.Person; +import org.springframework.stereotype.Component; +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +@Component +public class PersonValidator implements Validator { + + @Override + public boolean supports(final Class calzz) { + return Person.class.isAssignableFrom(calzz); + } + + @Override + public void validate(final Object obj, final Errors errors) { + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "required.name"); + } } \ No newline at end of file diff --git a/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml b/spring-web-modules/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml similarity index 100% rename from spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml rename to spring-web-modules/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml diff --git a/spring-mvc-xml/src/main/resources/logback.xml b/spring-web-modules/spring-mvc-xml/src/main/resources/logback.xml similarity index 100% rename from spring-mvc-xml/src/main/resources/logback.xml rename to spring-web-modules/spring-mvc-xml/src/main/resources/logback.xml diff --git a/spring-mvc-xml/src/main/resources/messages.properties b/spring-web-modules/spring-mvc-xml/src/main/resources/messages.properties similarity index 98% rename from spring-mvc-xml/src/main/resources/messages.properties rename to spring-web-modules/spring-mvc-xml/src/main/resources/messages.properties index 2a3cccf76c..8d886c8449 100644 --- a/spring-mvc-xml/src/main/resources/messages.properties +++ b/spring-web-modules/spring-mvc-xml/src/main/resources/messages.properties @@ -1,2 +1,2 @@ -required.name = Name is required! +required.name = Name is required! NotEmpty.person.password = Password is required! \ No newline at end of file diff --git a/spring-mvc-xml/src/main/resources/webMvcConfig.xml b/spring-web-modules/spring-mvc-xml/src/main/resources/webMvcConfig.xml similarity index 100% rename from spring-mvc-xml/src/main/resources/webMvcConfig.xml rename to spring-web-modules/spring-mvc-xml/src/main/resources/webMvcConfig.xml diff --git a/spring-mvc-xml/src/main/webapp/GeoIpTest.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/GeoIpTest.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/GeoIpTest.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/GeoIpTest.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message.groovy b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message.groovy similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message.groovy rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message.groovy diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message2.java b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message2.java similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message2.java rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/crash/commands/message2.java diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/crash/crash.properties b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/crash/crash.properties similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/crash/crash.properties rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/crash/crash.properties diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/crash/telnet.properties b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/crash/telnet.properties similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/crash/telnet.properties rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/crash/telnet.properties diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/images/image-example.jpg b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/images/image-example.jpg similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/images/image-example.jpg rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/images/image-example.jpg diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/error.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/error.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/error.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/error.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/errorPage.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/errorPage.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/errorPage.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/errorPage.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/greeting.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/greeting.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/greeting.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/greeting.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/hello.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/hello.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/hello.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/hello.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/helloworld.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/helloworld.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/helloworld.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/helloworld.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/image-download.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/image-download.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/image-download.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/image-download.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/personForm.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/personForm.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/personForm.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/personForm.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/personView.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/personView.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/personView.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/personView.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/sample.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/sample.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/sample.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/sample.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/welcome.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/welcome.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/view/welcome.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/view/welcome.jsp diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml b/spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-mvc-xml/src/main/webapp/WEB-INF/web.xml rename to spring-web-modules/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml diff --git a/spring-mvc-xml/src/main/webapp/index.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/index.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/index.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/index.jsp diff --git a/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp diff --git a/spring-mvc-xml/src/main/webapp/jsp/ExampleTwo.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/jsp/ExampleTwo.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/jsp/ExampleTwo.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/jsp/ExampleTwo.jsp diff --git a/spring-mvc-xml/src/main/webapp/jsp/index.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/jsp/index.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/jsp/index.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/jsp/index.jsp diff --git a/spring-mvc-xml/src/main/webapp/spring-handler-index.jsp b/spring-web-modules/spring-mvc-xml/src/main/webapp/spring-handler-index.jsp similarity index 100% rename from spring-mvc-xml/src/main/webapp/spring-handler-index.jsp rename to spring-web-modules/spring-mvc-xml/src/main/webapp/spring-handler-index.jsp diff --git a/spring-mvc-xml/src/test/java/org/baeldung/SpringContextTest.java b/spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-mvc-xml/src/test/java/org/baeldung/SpringContextTest.java rename to spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java b/spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java similarity index 100% rename from spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java rename to spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java diff --git a/spring-mvc-xml/src/test/java/com/baeldung/spring/controller/RequestAndPathVariableValidationControllerIntegrationTest.java b/spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/spring/controller/RequestAndPathVariableValidationControllerIntegrationTest.java similarity index 100% rename from spring-mvc-xml/src/test/java/com/baeldung/spring/controller/RequestAndPathVariableValidationControllerIntegrationTest.java rename to spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/spring/controller/RequestAndPathVariableValidationControllerIntegrationTest.java diff --git a/spring-mvc-xml/src/test/resources/GeoLite2-City.mmdb b/spring-web-modules/spring-mvc-xml/src/test/resources/GeoLite2-City.mmdb similarity index 100% rename from spring-mvc-xml/src/test/resources/GeoLite2-City.mmdb rename to spring-web-modules/spring-mvc-xml/src/test/resources/GeoLite2-City.mmdb diff --git a/spring-rest-http-2/README.md b/spring-web-modules/spring-rest-http-2/README.md similarity index 100% rename from spring-rest-http-2/README.md rename to spring-web-modules/spring-rest-http-2/README.md diff --git a/spring-rest-http-2/pom.xml b/spring-web-modules/spring-rest-http-2/pom.xml similarity index 95% rename from spring-rest-http-2/pom.xml rename to spring-web-modules/spring-rest-http-2/pom.xml index 8678d7243d..6aa8be365c 100644 --- a/spring-rest-http-2/pom.xml +++ b/spring-web-modules/spring-rest-http-2/pom.xml @@ -11,7 +11,7 @@ com.baeldung parent-boot-2 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 diff --git a/spring-rest-http-2/src/main/java/com/baeldung/SpringBootRest2Application.java b/spring-web-modules/spring-rest-http-2/src/main/java/com/baeldung/SpringBootRest2Application.java similarity index 100% rename from spring-rest-http-2/src/main/java/com/baeldung/SpringBootRest2Application.java rename to spring-web-modules/spring-rest-http-2/src/main/java/com/baeldung/SpringBootRest2Application.java diff --git a/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/config/SwaggerConfig.java b/spring-web-modules/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/config/SwaggerConfig.java similarity index 100% rename from spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/config/SwaggerConfig.java rename to spring-web-modules/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/config/SwaggerConfig.java diff --git a/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/controllers/VersionController.java b/spring-web-modules/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/controllers/VersionController.java similarity index 100% rename from spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/controllers/VersionController.java rename to spring-web-modules/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/controllers/VersionController.java diff --git a/spring-rest-query-language/.gitignore b/spring-web-modules/spring-rest-query-language/.gitignore similarity index 100% rename from spring-rest-query-language/.gitignore rename to spring-web-modules/spring-rest-query-language/.gitignore diff --git a/spring-rest-query-language/README.md b/spring-web-modules/spring-rest-query-language/README.md similarity index 100% rename from spring-rest-query-language/README.md rename to spring-web-modules/spring-rest-query-language/README.md diff --git a/spring-rest-query-language/pom.xml b/spring-web-modules/spring-rest-query-language/pom.xml similarity index 99% rename from spring-rest-query-language/pom.xml rename to spring-web-modules/spring-rest-query-language/pom.xml index 4458aa0580..5e7ca023dd 100644 --- a/spring-rest-query-language/pom.xml +++ b/spring-web-modules/spring-rest-query-language/pom.xml @@ -11,7 +11,7 @@ com.baeldung parent-boot-2 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java similarity index 97% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java index 75fb4456c4..b6623e8885 100644 --- a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java +++ b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/GenericSpecificationsBuilder.java @@ -1,100 +1,100 @@ -package com.baeldung.persistence.dao; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Deque; -import java.util.LinkedList; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.springframework.data.jpa.domain.Specification; - -import com.baeldung.web.util.SearchOperation; -import com.baeldung.web.util.SpecSearchCriteria; - -public class GenericSpecificationsBuilder { - - private final List params; - - public GenericSpecificationsBuilder() { - this.params = new ArrayList<>(); - } - - public final GenericSpecificationsBuilder with(final String key, final String operation, final Object value, final String prefix, final String suffix) { - return with(null, key, operation, value, prefix, suffix); - } - - public final GenericSpecificationsBuilder with(final String precedenceIndicator, final String key, final String operation, final Object value, final String prefix, final String suffix) { - SearchOperation op = SearchOperation.getSimpleOperation(operation.charAt(0)); - if (op != null) { - if (op == SearchOperation.EQUALITY) // the operation may be complex operation - { - final boolean startWithAsterisk = prefix != null && prefix.contains(SearchOperation.ZERO_OR_MORE_REGEX); - final boolean endWithAsterisk = suffix != null && suffix.contains(SearchOperation.ZERO_OR_MORE_REGEX); - - if (startWithAsterisk && endWithAsterisk) { - op = SearchOperation.CONTAINS; - } else if (startWithAsterisk) { - op = SearchOperation.ENDS_WITH; - } else if (endWithAsterisk) { - op = SearchOperation.STARTS_WITH; - } - } - params.add(new SpecSearchCriteria(precedenceIndicator, key, op, value)); - } - return this; - } - - public Specification build(Function> converter) { - - if (params.size() == 0) { - return null; - } - - final List> specs = params.stream() - .map(converter) - .collect(Collectors.toCollection(ArrayList::new)); - - Specification result = specs.get(0); - - for (int idx = 1; idx < specs.size(); idx++) { - result = params.get(idx) - .isOrPredicate() - ? Specification.where(result) - .or(specs.get(idx)) - : Specification.where(result) - .and(specs.get(idx)); - } - - return result; - } - - public Specification build(Deque postFixedExprStack, Function> converter) { - - Deque> specStack = new LinkedList<>(); - - Collections.reverse((List) postFixedExprStack); - - while (!postFixedExprStack.isEmpty()) { - Object mayBeOperand = postFixedExprStack.pop(); - - if (!(mayBeOperand instanceof String)) { - specStack.push(converter.apply((SpecSearchCriteria) mayBeOperand)); - } else { - Specification operand1 = specStack.pop(); - Specification operand2 = specStack.pop(); - if (mayBeOperand.equals(SearchOperation.AND_OPERATOR)) - specStack.push(Specification.where(operand1) - .and(operand2)); - else if (mayBeOperand.equals(SearchOperation.OR_OPERATOR)) - specStack.push(Specification.where(operand1) - .or(operand2)); - } - - } - return specStack.pop(); - - } - -} +package com.baeldung.persistence.dao; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Deque; +import java.util.LinkedList; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.springframework.data.jpa.domain.Specification; + +import com.baeldung.web.util.SearchOperation; +import com.baeldung.web.util.SpecSearchCriteria; + +public class GenericSpecificationsBuilder { + + private final List params; + + public GenericSpecificationsBuilder() { + this.params = new ArrayList<>(); + } + + public final GenericSpecificationsBuilder with(final String key, final String operation, final Object value, final String prefix, final String suffix) { + return with(null, key, operation, value, prefix, suffix); + } + + public final GenericSpecificationsBuilder with(final String precedenceIndicator, final String key, final String operation, final Object value, final String prefix, final String suffix) { + SearchOperation op = SearchOperation.getSimpleOperation(operation.charAt(0)); + if (op != null) { + if (op == SearchOperation.EQUALITY) // the operation may be complex operation + { + final boolean startWithAsterisk = prefix != null && prefix.contains(SearchOperation.ZERO_OR_MORE_REGEX); + final boolean endWithAsterisk = suffix != null && suffix.contains(SearchOperation.ZERO_OR_MORE_REGEX); + + if (startWithAsterisk && endWithAsterisk) { + op = SearchOperation.CONTAINS; + } else if (startWithAsterisk) { + op = SearchOperation.ENDS_WITH; + } else if (endWithAsterisk) { + op = SearchOperation.STARTS_WITH; + } + } + params.add(new SpecSearchCriteria(precedenceIndicator, key, op, value)); + } + return this; + } + + public Specification build(Function> converter) { + + if (params.size() == 0) { + return null; + } + + final List> specs = params.stream() + .map(converter) + .collect(Collectors.toCollection(ArrayList::new)); + + Specification result = specs.get(0); + + for (int idx = 1; idx < specs.size(); idx++) { + result = params.get(idx) + .isOrPredicate() + ? Specification.where(result) + .or(specs.get(idx)) + : Specification.where(result) + .and(specs.get(idx)); + } + + return result; + } + + public Specification build(Deque postFixedExprStack, Function> converter) { + + Deque> specStack = new LinkedList<>(); + + Collections.reverse((List) postFixedExprStack); + + while (!postFixedExprStack.isEmpty()) { + Object mayBeOperand = postFixedExprStack.pop(); + + if (!(mayBeOperand instanceof String)) { + specStack.push(converter.apply((SpecSearchCriteria) mayBeOperand)); + } else { + Specification operand1 = specStack.pop(); + Specification operand2 = specStack.pop(); + if (mayBeOperand.equals(SearchOperation.AND_OPERATOR)) + specStack.push(Specification.where(operand1) + .and(operand2)); + else if (mayBeOperand.equals(SearchOperation.OR_OPERATOR)) + specStack.push(Specification.where(operand1) + .or(operand2)); + } + + } + return specStack.pop(); + + } + +} diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/IUserDAO.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/IUserDAO.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/IUserDAO.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/IUserDAO.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicate.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicate.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicate.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicate.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicatesBuilder.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicatesBuilder.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicatesBuilder.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserPredicatesBuilder.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserRepository.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserRepository.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserRepository.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/MyUserRepository.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserDAO.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserDAO.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserDAO.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserDAO.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserRepository.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserRepository.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserRepository.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserRepository.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSearchQueryCriteriaConsumer.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSearchQueryCriteriaConsumer.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSearchQueryCriteriaConsumer.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSearchQueryCriteriaConsumer.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecification.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecification.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecification.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecification.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java similarity index 97% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java index 72d7274226..eac1562294 100644 --- a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java +++ b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/UserSpecificationsBuilder.java @@ -1,70 +1,70 @@ -package com.baeldung.persistence.dao; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.data.jpa.domain.Specification; - -import com.baeldung.persistence.model.User; -import com.baeldung.web.util.SearchOperation; -import com.baeldung.web.util.SpecSearchCriteria; - -public final class UserSpecificationsBuilder { - - private final List params; - - public UserSpecificationsBuilder() { - params = new ArrayList<>(); - } - - // API - - public final UserSpecificationsBuilder with(final String key, final String operation, final Object value, final String prefix, final String suffix) { - return with(null, key, operation, value, prefix, suffix); - } - - public final UserSpecificationsBuilder with(final String orPredicate, final String key, final String operation, final Object value, final String prefix, final String suffix) { - SearchOperation op = SearchOperation.getSimpleOperation(operation.charAt(0)); - if (op != null) { - if (op == SearchOperation.EQUALITY) { // the operation may be complex operation - final boolean startWithAsterisk = prefix != null && prefix.contains(SearchOperation.ZERO_OR_MORE_REGEX); - final boolean endWithAsterisk = suffix != null && suffix.contains(SearchOperation.ZERO_OR_MORE_REGEX); - - if (startWithAsterisk && endWithAsterisk) { - op = SearchOperation.CONTAINS; - } else if (startWithAsterisk) { - op = SearchOperation.ENDS_WITH; - } else if (endWithAsterisk) { - op = SearchOperation.STARTS_WITH; - } - } - params.add(new SpecSearchCriteria(orPredicate, key, op, value)); - } - return this; - } - - public Specification build() { - if (params.size() == 0) - return null; - - Specification result = new UserSpecification(params.get(0)); - - for (int i = 1; i < params.size(); i++) { - result = params.get(i).isOrPredicate() - ? Specification.where(result).or(new UserSpecification(params.get(i))) - : Specification.where(result).and(new UserSpecification(params.get(i))); - } - - return result; - } - - public final UserSpecificationsBuilder with(UserSpecification spec) { - params.add(spec.getCriteria()); - return this; - } - - public final UserSpecificationsBuilder with(SpecSearchCriteria criteria) { - params.add(criteria); - return this; - } -} +package com.baeldung.persistence.dao; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.data.jpa.domain.Specification; + +import com.baeldung.persistence.model.User; +import com.baeldung.web.util.SearchOperation; +import com.baeldung.web.util.SpecSearchCriteria; + +public final class UserSpecificationsBuilder { + + private final List params; + + public UserSpecificationsBuilder() { + params = new ArrayList<>(); + } + + // API + + public final UserSpecificationsBuilder with(final String key, final String operation, final Object value, final String prefix, final String suffix) { + return with(null, key, operation, value, prefix, suffix); + } + + public final UserSpecificationsBuilder with(final String orPredicate, final String key, final String operation, final Object value, final String prefix, final String suffix) { + SearchOperation op = SearchOperation.getSimpleOperation(operation.charAt(0)); + if (op != null) { + if (op == SearchOperation.EQUALITY) { // the operation may be complex operation + final boolean startWithAsterisk = prefix != null && prefix.contains(SearchOperation.ZERO_OR_MORE_REGEX); + final boolean endWithAsterisk = suffix != null && suffix.contains(SearchOperation.ZERO_OR_MORE_REGEX); + + if (startWithAsterisk && endWithAsterisk) { + op = SearchOperation.CONTAINS; + } else if (startWithAsterisk) { + op = SearchOperation.ENDS_WITH; + } else if (endWithAsterisk) { + op = SearchOperation.STARTS_WITH; + } + } + params.add(new SpecSearchCriteria(orPredicate, key, op, value)); + } + return this; + } + + public Specification build() { + if (params.size() == 0) + return null; + + Specification result = new UserSpecification(params.get(0)); + + for (int i = 1; i < params.size(); i++) { + result = params.get(i).isOrPredicate() + ? Specification.where(result).or(new UserSpecification(params.get(i))) + : Specification.where(result).and(new UserSpecification(params.get(i))); + } + + return result; + } + + public final UserSpecificationsBuilder with(UserSpecification spec) { + params.add(spec.getCriteria()); + return this; + } + + public final UserSpecificationsBuilder with(SpecSearchCriteria criteria) { + params.add(criteria); + return this; + } +} diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/CustomRsqlVisitor.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecBuilder.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/GenericRsqlSpecification.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/RsqlSearchOperation.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/RsqlSearchOperation.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/RsqlSearchOperation.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/dao/rsql/RsqlSearchOperation.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/MyUser.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/MyUser.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/model/MyUser.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/MyUser.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User_.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User_.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User_.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/persistence/model/User_.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/spring/Application.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/spring/Application.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/spring/Application.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/spring/Application.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/spring/PersistenceConfig.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/spring/PersistenceConfig.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/spring/PersistenceConfig.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/spring/PersistenceConfig.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/spring/WebConfig.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/spring/WebConfig.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/spring/WebConfig.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/spring/WebConfig.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/web/controller/HomeController.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/controller/HomeController.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/web/controller/HomeController.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/controller/HomeController.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java similarity index 97% rename from spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java index 54e8618b27..73a97f84ae 100644 --- a/spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java +++ b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/controller/UserController.java @@ -1,171 +1,171 @@ -package com.baeldung.web.controller; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.jpa.domain.Specification; -import org.springframework.data.querydsl.binding.QuerydslPredicate; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -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.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; - -import com.baeldung.persistence.dao.GenericSpecificationsBuilder; -import com.baeldung.persistence.dao.IUserDAO; -import com.baeldung.persistence.dao.MyUserPredicatesBuilder; -import com.baeldung.persistence.dao.MyUserRepository; -import com.baeldung.persistence.dao.UserRepository; -import com.baeldung.persistence.dao.UserSpecification; -import com.baeldung.persistence.dao.UserSpecificationsBuilder; -import com.baeldung.persistence.dao.rsql.CustomRsqlVisitor; -import com.baeldung.persistence.model.MyUser; -import com.baeldung.persistence.model.User; -import com.baeldung.web.util.CriteriaParser; -import com.baeldung.web.util.SearchCriteria; -import com.baeldung.web.util.SearchOperation; -import com.google.common.base.Joiner; -import com.google.common.base.Preconditions; -import com.querydsl.core.types.Predicate; -import com.querydsl.core.types.dsl.BooleanExpression; - -import cz.jirutka.rsql.parser.RSQLParser; -import cz.jirutka.rsql.parser.ast.Node; - -//@EnableSpringDataWebSupport -@Controller -@RequestMapping(value = "/auth/") -public class UserController { - - @Autowired - private IUserDAO service; - - @Autowired - private UserRepository dao; - - @Autowired - private MyUserRepository myUserRepository; - - public UserController() { - super(); - } - - // API - READ - - @RequestMapping(method = RequestMethod.GET, value = "/users") - @ResponseBody - public List search(@RequestParam(value = "search", required = false) String search) { - List params = new ArrayList(); - if (search != null) { - Pattern pattern = Pattern.compile("(\\w+?)(:|<|>)(\\w+?),"); - Matcher matcher = pattern.matcher(search + ","); - while (matcher.find()) { - params.add(new SearchCriteria(matcher.group(1), matcher.group(2), matcher.group(3))); - } - } - return service.searchUser(params); - } - - @RequestMapping(method = RequestMethod.GET, value = "/users/spec") - @ResponseBody - public List findAllBySpecification(@RequestParam(value = "search") String search) { - UserSpecificationsBuilder builder = new UserSpecificationsBuilder(); - String operationSetExper = Joiner.on("|") - .join(SearchOperation.SIMPLE_OPERATION_SET); - Pattern pattern = Pattern.compile("(\\w+?)(" + operationSetExper + ")(\\p{Punct}?)(\\w+?)(\\p{Punct}?),"); - Matcher matcher = pattern.matcher(search + ","); - while (matcher.find()) { - builder.with(matcher.group(1), matcher.group(2), matcher.group(4), matcher.group(3), matcher.group(5)); - } - - Specification spec = builder.build(); - return dao.findAll(spec); - } - - @GetMapping(value = "/users/espec") - @ResponseBody - public List findAllByOrPredicate(@RequestParam(value = "search") String search) { - Specification spec = resolveSpecification(search); - return dao.findAll(spec); - } - - @GetMapping(value = "/users/spec/adv") - @ResponseBody - public List findAllByAdvPredicate(@RequestParam(value = "search") String search) { - Specification spec = resolveSpecificationFromInfixExpr(search); - return dao.findAll(spec); - } - - protected Specification resolveSpecificationFromInfixExpr(String searchParameters) { - CriteriaParser parser = new CriteriaParser(); - GenericSpecificationsBuilder specBuilder = new GenericSpecificationsBuilder<>(); - return specBuilder.build(parser.parse(searchParameters), UserSpecification::new); - } - - protected Specification resolveSpecification(String searchParameters) { - - UserSpecificationsBuilder builder = new UserSpecificationsBuilder(); - String operationSetExper = Joiner.on("|") - .join(SearchOperation.SIMPLE_OPERATION_SET); - Pattern pattern = Pattern.compile("(\\p{Punct}?)(\\w+?)(" + operationSetExper + ")(\\p{Punct}?)(\\w+?)(\\p{Punct}?),"); - Matcher matcher = pattern.matcher(searchParameters + ","); - while (matcher.find()) { - builder.with(matcher.group(1), matcher.group(2), matcher.group(3), matcher.group(5), matcher.group(4), matcher.group(6)); - } - return builder.build(); - } - - @RequestMapping(method = RequestMethod.GET, value = "/myusers") - @ResponseBody - public Iterable findAllByQuerydsl(@RequestParam(value = "search") String search) { - MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder(); - if (search != null) { - Pattern pattern = Pattern.compile("(\\w+?)(:|<|>)(\\w+?),"); - Matcher matcher = pattern.matcher(search + ","); - while (matcher.find()) { - builder.with(matcher.group(1), matcher.group(2), matcher.group(3)); - } - } - BooleanExpression exp = builder.build(); - return myUserRepository.findAll(exp); - } - - @RequestMapping(method = RequestMethod.GET, value = "/users/rsql") - @ResponseBody - public List findAllByRsql(@RequestParam(value = "search") String search) { - Node rootNode = new RSQLParser().parse(search); - Specification spec = rootNode.accept(new CustomRsqlVisitor()); - return dao.findAll(spec); - } - - @RequestMapping(method = RequestMethod.GET, value = "/api/myusers") - @ResponseBody - public Iterable findAllByWebQuerydsl(@QuerydslPredicate(root = MyUser.class) Predicate predicate) { - return myUserRepository.findAll(predicate); - } - - // API - WRITE - - @RequestMapping(method = RequestMethod.POST, value = "/users") - @ResponseStatus(HttpStatus.CREATED) - public void create(@RequestBody User resource) { - Preconditions.checkNotNull(resource); - dao.save(resource); - } - - @RequestMapping(method = RequestMethod.POST, value = "/myusers") - @ResponseStatus(HttpStatus.CREATED) - public void addMyUser(@RequestBody MyUser resource) { - Preconditions.checkNotNull(resource); - myUserRepository.save(resource); - - } - -} +package com.baeldung.web.controller; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.data.querydsl.binding.QuerydslPredicate; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +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.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +import com.baeldung.persistence.dao.GenericSpecificationsBuilder; +import com.baeldung.persistence.dao.IUserDAO; +import com.baeldung.persistence.dao.MyUserPredicatesBuilder; +import com.baeldung.persistence.dao.MyUserRepository; +import com.baeldung.persistence.dao.UserRepository; +import com.baeldung.persistence.dao.UserSpecification; +import com.baeldung.persistence.dao.UserSpecificationsBuilder; +import com.baeldung.persistence.dao.rsql.CustomRsqlVisitor; +import com.baeldung.persistence.model.MyUser; +import com.baeldung.persistence.model.User; +import com.baeldung.web.util.CriteriaParser; +import com.baeldung.web.util.SearchCriteria; +import com.baeldung.web.util.SearchOperation; +import com.google.common.base.Joiner; +import com.google.common.base.Preconditions; +import com.querydsl.core.types.Predicate; +import com.querydsl.core.types.dsl.BooleanExpression; + +import cz.jirutka.rsql.parser.RSQLParser; +import cz.jirutka.rsql.parser.ast.Node; + +//@EnableSpringDataWebSupport +@Controller +@RequestMapping(value = "/auth/") +public class UserController { + + @Autowired + private IUserDAO service; + + @Autowired + private UserRepository dao; + + @Autowired + private MyUserRepository myUserRepository; + + public UserController() { + super(); + } + + // API - READ + + @RequestMapping(method = RequestMethod.GET, value = "/users") + @ResponseBody + public List search(@RequestParam(value = "search", required = false) String search) { + List params = new ArrayList(); + if (search != null) { + Pattern pattern = Pattern.compile("(\\w+?)(:|<|>)(\\w+?),"); + Matcher matcher = pattern.matcher(search + ","); + while (matcher.find()) { + params.add(new SearchCriteria(matcher.group(1), matcher.group(2), matcher.group(3))); + } + } + return service.searchUser(params); + } + + @RequestMapping(method = RequestMethod.GET, value = "/users/spec") + @ResponseBody + public List findAllBySpecification(@RequestParam(value = "search") String search) { + UserSpecificationsBuilder builder = new UserSpecificationsBuilder(); + String operationSetExper = Joiner.on("|") + .join(SearchOperation.SIMPLE_OPERATION_SET); + Pattern pattern = Pattern.compile("(\\w+?)(" + operationSetExper + ")(\\p{Punct}?)(\\w+?)(\\p{Punct}?),"); + Matcher matcher = pattern.matcher(search + ","); + while (matcher.find()) { + builder.with(matcher.group(1), matcher.group(2), matcher.group(4), matcher.group(3), matcher.group(5)); + } + + Specification spec = builder.build(); + return dao.findAll(spec); + } + + @GetMapping(value = "/users/espec") + @ResponseBody + public List findAllByOrPredicate(@RequestParam(value = "search") String search) { + Specification spec = resolveSpecification(search); + return dao.findAll(spec); + } + + @GetMapping(value = "/users/spec/adv") + @ResponseBody + public List findAllByAdvPredicate(@RequestParam(value = "search") String search) { + Specification spec = resolveSpecificationFromInfixExpr(search); + return dao.findAll(spec); + } + + protected Specification resolveSpecificationFromInfixExpr(String searchParameters) { + CriteriaParser parser = new CriteriaParser(); + GenericSpecificationsBuilder specBuilder = new GenericSpecificationsBuilder<>(); + return specBuilder.build(parser.parse(searchParameters), UserSpecification::new); + } + + protected Specification resolveSpecification(String searchParameters) { + + UserSpecificationsBuilder builder = new UserSpecificationsBuilder(); + String operationSetExper = Joiner.on("|") + .join(SearchOperation.SIMPLE_OPERATION_SET); + Pattern pattern = Pattern.compile("(\\p{Punct}?)(\\w+?)(" + operationSetExper + ")(\\p{Punct}?)(\\w+?)(\\p{Punct}?),"); + Matcher matcher = pattern.matcher(searchParameters + ","); + while (matcher.find()) { + builder.with(matcher.group(1), matcher.group(2), matcher.group(3), matcher.group(5), matcher.group(4), matcher.group(6)); + } + return builder.build(); + } + + @RequestMapping(method = RequestMethod.GET, value = "/myusers") + @ResponseBody + public Iterable findAllByQuerydsl(@RequestParam(value = "search") String search) { + MyUserPredicatesBuilder builder = new MyUserPredicatesBuilder(); + if (search != null) { + Pattern pattern = Pattern.compile("(\\w+?)(:|<|>)(\\w+?),"); + Matcher matcher = pattern.matcher(search + ","); + while (matcher.find()) { + builder.with(matcher.group(1), matcher.group(2), matcher.group(3)); + } + } + BooleanExpression exp = builder.build(); + return myUserRepository.findAll(exp); + } + + @RequestMapping(method = RequestMethod.GET, value = "/users/rsql") + @ResponseBody + public List findAllByRsql(@RequestParam(value = "search") String search) { + Node rootNode = new RSQLParser().parse(search); + Specification spec = rootNode.accept(new CustomRsqlVisitor()); + return dao.findAll(spec); + } + + @RequestMapping(method = RequestMethod.GET, value = "/api/myusers") + @ResponseBody + public Iterable findAllByWebQuerydsl(@QuerydslPredicate(root = MyUser.class) Predicate predicate) { + return myUserRepository.findAll(predicate); + } + + // API - WRITE + + @RequestMapping(method = RequestMethod.POST, value = "/users") + @ResponseStatus(HttpStatus.CREATED) + public void create(@RequestBody User resource) { + Preconditions.checkNotNull(resource); + dao.save(resource); + } + + @RequestMapping(method = RequestMethod.POST, value = "/myusers") + @ResponseStatus(HttpStatus.CREATED) + public void addMyUser(@RequestBody MyUser resource) { + Preconditions.checkNotNull(resource); + myUserRepository.save(resource); + + } + +} diff --git a/spring-rest-query-language/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/web/util/CriteriaParser.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/CriteriaParser.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/web/util/CriteriaParser.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/CriteriaParser.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchCriteria.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchCriteria.java similarity index 100% rename from spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchCriteria.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchCriteria.java diff --git a/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java similarity index 96% rename from spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java index acc9e0c0a8..86ad9ad749 100644 --- a/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java +++ b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/SearchOperation.java @@ -1,36 +1,36 @@ -package com.baeldung.web.util; - -public enum SearchOperation { - EQUALITY, NEGATION, GREATER_THAN, LESS_THAN, LIKE, STARTS_WITH, ENDS_WITH, CONTAINS; - - public static final String[] SIMPLE_OPERATION_SET = { ":", "!", ">", "<", "~" }; - - public static final String OR_PREDICATE_FLAG = "'"; - - public static final String ZERO_OR_MORE_REGEX = "*"; - - public static final String OR_OPERATOR = "OR"; - - public static final String AND_OPERATOR = "AND"; - - public static final String LEFT_PARANTHESIS = "("; - - public static final String RIGHT_PARANTHESIS = ")"; - - public static SearchOperation getSimpleOperation(final char input) { - switch (input) { - case ':': - return EQUALITY; - case '!': - return NEGATION; - case '>': - return GREATER_THAN; - case '<': - return LESS_THAN; - case '~': - return LIKE; - default: - return null; - } - } -} +package com.baeldung.web.util; + +public enum SearchOperation { + EQUALITY, NEGATION, GREATER_THAN, LESS_THAN, LIKE, STARTS_WITH, ENDS_WITH, CONTAINS; + + public static final String[] SIMPLE_OPERATION_SET = { ":", "!", ">", "<", "~" }; + + public static final String OR_PREDICATE_FLAG = "'"; + + public static final String ZERO_OR_MORE_REGEX = "*"; + + public static final String OR_OPERATOR = "OR"; + + public static final String AND_OPERATOR = "AND"; + + public static final String LEFT_PARANTHESIS = "("; + + public static final String RIGHT_PARANTHESIS = ")"; + + public static SearchOperation getSimpleOperation(final char input) { + switch (input) { + case ':': + return EQUALITY; + case '!': + return NEGATION; + case '>': + return GREATER_THAN; + case '<': + return LESS_THAN; + case '~': + return LIKE; + default: + return null; + } + } +} diff --git a/spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java similarity index 96% rename from spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java rename to spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java index 73b690673b..22b55c78fb 100644 --- a/spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java +++ b/spring-web-modules/spring-rest-query-language/src/main/java/com/baeldung/web/util/SpecSearchCriteria.java @@ -1,82 +1,82 @@ -package com.baeldung.web.util; - -public class SpecSearchCriteria { - - private String key; - private SearchOperation operation; - private Object value; - private boolean orPredicate; - - public SpecSearchCriteria() { - - } - - public SpecSearchCriteria(final String key, final SearchOperation operation, final Object value) { - super(); - this.key = key; - this.operation = operation; - this.value = value; - } - - public SpecSearchCriteria(final String orPredicate, final String key, final SearchOperation operation, final Object value) { - super(); - this.orPredicate = orPredicate != null && orPredicate.equals(SearchOperation.OR_PREDICATE_FLAG); - this.key = key; - this.operation = operation; - this.value = value; - } - - public SpecSearchCriteria(String key, String operation, String prefix, String value, String suffix) { - SearchOperation op = SearchOperation.getSimpleOperation(operation.charAt(0)); - if (op != null) { - if (op == SearchOperation.EQUALITY) { // the operation may be complex operation - final boolean startWithAsterisk = prefix != null && prefix.contains(SearchOperation.ZERO_OR_MORE_REGEX); - final boolean endWithAsterisk = suffix != null && suffix.contains(SearchOperation.ZERO_OR_MORE_REGEX); - - if (startWithAsterisk && endWithAsterisk) { - op = SearchOperation.CONTAINS; - } else if (startWithAsterisk) { - op = SearchOperation.ENDS_WITH; - } else if (endWithAsterisk) { - op = SearchOperation.STARTS_WITH; - } - } - } - this.key = key; - this.operation = op; - this.value = value; - } - - public String getKey() { - return key; - } - - public void setKey(final String key) { - this.key = key; - } - - public SearchOperation getOperation() { - return operation; - } - - public void setOperation(final SearchOperation operation) { - this.operation = operation; - } - - public Object getValue() { - return value; - } - - public void setValue(final Object value) { - this.value = value; - } - - public boolean isOrPredicate() { - return orPredicate; - } - - public void setOrPredicate(boolean orPredicate) { - this.orPredicate = orPredicate; - } - -} +package com.baeldung.web.util; + +public class SpecSearchCriteria { + + private String key; + private SearchOperation operation; + private Object value; + private boolean orPredicate; + + public SpecSearchCriteria() { + + } + + public SpecSearchCriteria(final String key, final SearchOperation operation, final Object value) { + super(); + this.key = key; + this.operation = operation; + this.value = value; + } + + public SpecSearchCriteria(final String orPredicate, final String key, final SearchOperation operation, final Object value) { + super(); + this.orPredicate = orPredicate != null && orPredicate.equals(SearchOperation.OR_PREDICATE_FLAG); + this.key = key; + this.operation = operation; + this.value = value; + } + + public SpecSearchCriteria(String key, String operation, String prefix, String value, String suffix) { + SearchOperation op = SearchOperation.getSimpleOperation(operation.charAt(0)); + if (op != null) { + if (op == SearchOperation.EQUALITY) { // the operation may be complex operation + final boolean startWithAsterisk = prefix != null && prefix.contains(SearchOperation.ZERO_OR_MORE_REGEX); + final boolean endWithAsterisk = suffix != null && suffix.contains(SearchOperation.ZERO_OR_MORE_REGEX); + + if (startWithAsterisk && endWithAsterisk) { + op = SearchOperation.CONTAINS; + } else if (startWithAsterisk) { + op = SearchOperation.ENDS_WITH; + } else if (endWithAsterisk) { + op = SearchOperation.STARTS_WITH; + } + } + } + this.key = key; + this.operation = op; + this.value = value; + } + + public String getKey() { + return key; + } + + public void setKey(final String key) { + this.key = key; + } + + public SearchOperation getOperation() { + return operation; + } + + public void setOperation(final SearchOperation operation) { + this.operation = operation; + } + + public Object getValue() { + return value; + } + + public void setValue(final Object value) { + this.value = value; + } + + public boolean isOrPredicate() { + return orPredicate; + } + + public void setOrPredicate(boolean orPredicate) { + this.orPredicate = orPredicate; + } + +} diff --git a/spring-rest-query-language/src/main/resources/application.properties b/spring-web-modules/spring-rest-query-language/src/main/resources/application.properties similarity index 100% rename from spring-rest-query-language/src/main/resources/application.properties rename to spring-web-modules/spring-rest-query-language/src/main/resources/application.properties diff --git a/spring-rest-query-language/src/main/resources/data.sql b/spring-web-modules/spring-rest-query-language/src/main/resources/data.sql similarity index 100% rename from spring-rest-query-language/src/main/resources/data.sql rename to spring-web-modules/spring-rest-query-language/src/main/resources/data.sql diff --git a/spring-rest-query-language/src/main/resources/logback.xml b/spring-web-modules/spring-rest-query-language/src/main/resources/logback.xml similarity index 100% rename from spring-rest-query-language/src/main/resources/logback.xml rename to spring-web-modules/spring-rest-query-language/src/main/resources/logback.xml diff --git a/spring-rest-query-language/src/main/resources/persistence-h2.properties b/spring-web-modules/spring-rest-query-language/src/main/resources/persistence-h2.properties similarity index 100% rename from spring-rest-query-language/src/main/resources/persistence-h2.properties rename to spring-web-modules/spring-rest-query-language/src/main/resources/persistence-h2.properties diff --git a/spring-rest-query-language/src/main/resources/persistence-mysql.properties b/spring-web-modules/spring-rest-query-language/src/main/resources/persistence-mysql.properties similarity index 100% rename from spring-rest-query-language/src/main/resources/persistence-mysql.properties rename to spring-web-modules/spring-rest-query-language/src/main/resources/persistence-mysql.properties diff --git a/spring-rest-query-language/src/main/resources/springDataPersistenceConfig.xml b/spring-web-modules/spring-rest-query-language/src/main/resources/springDataPersistenceConfig.xml similarity index 100% rename from spring-rest-query-language/src/main/resources/springDataPersistenceConfig.xml rename to spring-web-modules/spring-rest-query-language/src/main/resources/springDataPersistenceConfig.xml diff --git a/spring-rest-query-language/src/main/webapp/WEB-INF/api-servlet.xml b/spring-web-modules/spring-rest-query-language/src/main/webapp/WEB-INF/api-servlet.xml similarity index 100% rename from spring-rest-query-language/src/main/webapp/WEB-INF/api-servlet.xml rename to spring-web-modules/spring-rest-query-language/src/main/webapp/WEB-INF/api-servlet.xml diff --git a/spring-rest-query-language/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-web-modules/spring-rest-query-language/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-rest-query-language/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-web-modules/spring-rest-query-language/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-rest-query-language/src/main/webapp/WEB-INF/web.xml b/spring-web-modules/spring-rest-query-language/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-rest-query-language/src/main/webapp/WEB-INF/web.xml rename to spring-web-modules/spring-rest-query-language/src/main/webapp/WEB-INF/web.xml diff --git a/spring-rest-query-language/src/test/java/com/baeldung/SpringContextTest.java b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-rest-query-language/src/test/java/com/baeldung/SpringContextTest.java rename to spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java similarity index 100% rename from spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java rename to spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPACriteriaQueryIntegrationTest.java diff --git a/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPAQuerydslIntegrationTest.java b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPAQuerydslIntegrationTest.java similarity index 100% rename from spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPAQuerydslIntegrationTest.java rename to spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPAQuerydslIntegrationTest.java diff --git a/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java similarity index 97% rename from spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java rename to spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java index 707426769e..f6fff10506 100644 --- a/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java +++ b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationIntegrationTest.java @@ -1,180 +1,180 @@ -package com.baeldung.persistence.query; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.jpa.domain.Specification; -import org.springframework.test.annotation.Rollback; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.persistence.dao.GenericSpecificationsBuilder; -import com.baeldung.persistence.dao.UserRepository; -import com.baeldung.persistence.dao.UserSpecification; -import com.baeldung.persistence.dao.UserSpecificationsBuilder; -import com.baeldung.persistence.model.User; -import com.baeldung.spring.PersistenceConfig; -import com.baeldung.web.util.CriteriaParser; -import com.baeldung.web.util.SearchOperation; -import com.baeldung.web.util.SpecSearchCriteria; - -import java.util.List; -import java.util.function.Function; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.collection.IsIn.isIn; -import static org.hamcrest.core.IsNot.not; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }) -@Transactional -@Rollback -public class JPASpecificationIntegrationTest { - - @Autowired - private UserRepository repository; - - private User userJohn; - - private User userTom; - - private User userPercy; - - @Before - public void init() { - userJohn = new User(); - userJohn.setFirstName("john"); - userJohn.setLastName("doe"); - userJohn.setEmail("john@doe.com"); - userJohn.setAge(22); - repository.save(userJohn); - - userTom = new User(); - userTom.setFirstName("tom"); - userTom.setLastName("doe"); - userTom.setEmail("tom@doe.com"); - userTom.setAge(26); - repository.save(userTom); - - userPercy = new User(); - userPercy.setFirstName("percy"); - userPercy.setLastName("blackney"); - userPercy.setEmail("percy@blackney.com"); - userPercy.setAge(30); - repository.save(userPercy); - } - - @Test - public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() { - final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.EQUALITY, "john")); - final UserSpecification spec1 = new UserSpecification(new SpecSearchCriteria("lastName", SearchOperation.EQUALITY, "doe")); - final List results = repository.findAll(Specification - .where(spec) - .and(spec1)); - - assertThat(userJohn, isIn(results)); - assertThat(userTom, not(isIn(results))); - } - - @Test - public void givenFirstOrLastName_whenGettingListOfUsers_thenCorrect() { - UserSpecificationsBuilder builder = new UserSpecificationsBuilder(); - - SpecSearchCriteria spec = new SpecSearchCriteria("firstName", SearchOperation.EQUALITY, "john"); - SpecSearchCriteria spec1 = new SpecSearchCriteria("'","lastName", SearchOperation.EQUALITY, "doe"); - - List results = repository.findAll(builder - .with(spec) - .with(spec1) - .build()); - - assertThat(results, hasSize(2)); - assertThat(userJohn, isIn(results)); - assertThat(userTom, isIn(results)); - } - - @Test - public void givenFirstOrLastNameAndAgeGenericBuilder_whenGettingListOfUsers_thenCorrect() { - GenericSpecificationsBuilder builder = new GenericSpecificationsBuilder<>(); - Function> converter = UserSpecification::new; - - CriteriaParser parser=new CriteriaParser(); - List results = repository.findAll(builder.build(parser.parse("( lastName:doe OR firstName:john ) AND age:22"), converter)); - - assertThat(results, hasSize(1)); - assertThat(userJohn, isIn(results)); - assertThat(userTom, not(isIn(results))); - } - - @Test - public void givenFirstOrLastNameGenericBuilder_whenGettingListOfUsers_thenCorrect() { - GenericSpecificationsBuilder builder = new GenericSpecificationsBuilder<>(); - Function> converter = UserSpecification::new; - - builder.with("firstName", ":", "john", null, null); - builder.with("'", "lastName", ":", "doe", null, null); - - List results = repository.findAll(builder.build(converter)); - - assertThat(results, hasSize(2)); - assertThat(userJohn, isIn(results)); - assertThat(userTom, isIn(results)); - } - - @Test - public void givenFirstNameInverse_whenGettingListOfUsers_thenCorrect() { - final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.NEGATION, "john")); - final List results = repository.findAll(Specification.where(spec)); - - assertThat(userTom, isIn(results)); - assertThat(userJohn, not(isIn(results))); - } - - @Test - public void givenMinAge_whenGettingListOfUsers_thenCorrect() { - final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.GREATER_THAN, "25")); - final List results = repository.findAll(Specification.where(spec)); - assertThat(userTom, isIn(results)); - assertThat(userJohn, not(isIn(results))); - } - - @Test - public void givenFirstNamePrefix_whenGettingListOfUsers_thenCorrect() { - final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.STARTS_WITH, "jo")); - final List results = repository.findAll(spec); - assertThat(userJohn, isIn(results)); - assertThat(userTom, not(isIn(results))); - } - - @Test - public void givenFirstNameSuffix_whenGettingListOfUsers_thenCorrect() { - final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.ENDS_WITH, "n")); - final List results = repository.findAll(spec); - assertThat(userJohn, isIn(results)); - assertThat(userTom, not(isIn(results))); - } - - @Test - public void givenFirstNameSubstring_whenGettingListOfUsers_thenCorrect() { - final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.CONTAINS, "oh")); - final List results = repository.findAll(spec); - - assertThat(userJohn, isIn(results)); - assertThat(userTom, not(isIn(results))); - } - - @Test - public void givenAgeRange_whenGettingListOfUsers_thenCorrect() { - final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.GREATER_THAN, "20")); - final UserSpecification spec1 = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.LESS_THAN, "25")); - final List results = repository.findAll(Specification - .where(spec) - .and(spec1)); - - assertThat(userJohn, isIn(results)); - assertThat(userTom, not(isIn(results))); - } -} +package com.baeldung.persistence.query; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.test.annotation.Rollback; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.persistence.dao.GenericSpecificationsBuilder; +import com.baeldung.persistence.dao.UserRepository; +import com.baeldung.persistence.dao.UserSpecification; +import com.baeldung.persistence.dao.UserSpecificationsBuilder; +import com.baeldung.persistence.model.User; +import com.baeldung.spring.PersistenceConfig; +import com.baeldung.web.util.CriteriaParser; +import com.baeldung.web.util.SearchOperation; +import com.baeldung.web.util.SpecSearchCriteria; + +import java.util.List; +import java.util.function.Function; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.hamcrest.collection.IsIn.isIn; +import static org.hamcrest.core.IsNot.not; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }) +@Transactional +@Rollback +public class JPASpecificationIntegrationTest { + + @Autowired + private UserRepository repository; + + private User userJohn; + + private User userTom; + + private User userPercy; + + @Before + public void init() { + userJohn = new User(); + userJohn.setFirstName("john"); + userJohn.setLastName("doe"); + userJohn.setEmail("john@doe.com"); + userJohn.setAge(22); + repository.save(userJohn); + + userTom = new User(); + userTom.setFirstName("tom"); + userTom.setLastName("doe"); + userTom.setEmail("tom@doe.com"); + userTom.setAge(26); + repository.save(userTom); + + userPercy = new User(); + userPercy.setFirstName("percy"); + userPercy.setLastName("blackney"); + userPercy.setEmail("percy@blackney.com"); + userPercy.setAge(30); + repository.save(userPercy); + } + + @Test + public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() { + final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.EQUALITY, "john")); + final UserSpecification spec1 = new UserSpecification(new SpecSearchCriteria("lastName", SearchOperation.EQUALITY, "doe")); + final List results = repository.findAll(Specification + .where(spec) + .and(spec1)); + + assertThat(userJohn, isIn(results)); + assertThat(userTom, not(isIn(results))); + } + + @Test + public void givenFirstOrLastName_whenGettingListOfUsers_thenCorrect() { + UserSpecificationsBuilder builder = new UserSpecificationsBuilder(); + + SpecSearchCriteria spec = new SpecSearchCriteria("firstName", SearchOperation.EQUALITY, "john"); + SpecSearchCriteria spec1 = new SpecSearchCriteria("'","lastName", SearchOperation.EQUALITY, "doe"); + + List results = repository.findAll(builder + .with(spec) + .with(spec1) + .build()); + + assertThat(results, hasSize(2)); + assertThat(userJohn, isIn(results)); + assertThat(userTom, isIn(results)); + } + + @Test + public void givenFirstOrLastNameAndAgeGenericBuilder_whenGettingListOfUsers_thenCorrect() { + GenericSpecificationsBuilder builder = new GenericSpecificationsBuilder<>(); + Function> converter = UserSpecification::new; + + CriteriaParser parser=new CriteriaParser(); + List results = repository.findAll(builder.build(parser.parse("( lastName:doe OR firstName:john ) AND age:22"), converter)); + + assertThat(results, hasSize(1)); + assertThat(userJohn, isIn(results)); + assertThat(userTom, not(isIn(results))); + } + + @Test + public void givenFirstOrLastNameGenericBuilder_whenGettingListOfUsers_thenCorrect() { + GenericSpecificationsBuilder builder = new GenericSpecificationsBuilder<>(); + Function> converter = UserSpecification::new; + + builder.with("firstName", ":", "john", null, null); + builder.with("'", "lastName", ":", "doe", null, null); + + List results = repository.findAll(builder.build(converter)); + + assertThat(results, hasSize(2)); + assertThat(userJohn, isIn(results)); + assertThat(userTom, isIn(results)); + } + + @Test + public void givenFirstNameInverse_whenGettingListOfUsers_thenCorrect() { + final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.NEGATION, "john")); + final List results = repository.findAll(Specification.where(spec)); + + assertThat(userTom, isIn(results)); + assertThat(userJohn, not(isIn(results))); + } + + @Test + public void givenMinAge_whenGettingListOfUsers_thenCorrect() { + final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.GREATER_THAN, "25")); + final List results = repository.findAll(Specification.where(spec)); + assertThat(userTom, isIn(results)); + assertThat(userJohn, not(isIn(results))); + } + + @Test + public void givenFirstNamePrefix_whenGettingListOfUsers_thenCorrect() { + final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.STARTS_WITH, "jo")); + final List results = repository.findAll(spec); + assertThat(userJohn, isIn(results)); + assertThat(userTom, not(isIn(results))); + } + + @Test + public void givenFirstNameSuffix_whenGettingListOfUsers_thenCorrect() { + final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.ENDS_WITH, "n")); + final List results = repository.findAll(spec); + assertThat(userJohn, isIn(results)); + assertThat(userTom, not(isIn(results))); + } + + @Test + public void givenFirstNameSubstring_whenGettingListOfUsers_thenCorrect() { + final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("firstName", SearchOperation.CONTAINS, "oh")); + final List results = repository.findAll(spec); + + assertThat(userJohn, isIn(results)); + assertThat(userTom, not(isIn(results))); + } + + @Test + public void givenAgeRange_whenGettingListOfUsers_thenCorrect() { + final UserSpecification spec = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.GREATER_THAN, "20")); + final UserSpecification spec1 = new UserSpecification(new SpecSearchCriteria("age", SearchOperation.LESS_THAN, "25")); + final List results = repository.findAll(Specification + .where(spec) + .and(spec1)); + + assertThat(userJohn, isIn(results)); + assertThat(userTom, not(isIn(results))); + } +} diff --git a/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java similarity index 97% rename from spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java rename to spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java index ad6a4259e7..d1fded3f10 100644 --- a/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java +++ b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/JPASpecificationLiveTest.java @@ -1,147 +1,147 @@ -package com.baeldung.persistence.query; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import io.restassured.RestAssured; -import io.restassured.response.Response; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.test.context.ActiveProfiles; - -import com.baeldung.persistence.model.User; - -//@RunWith(SpringJUnit4ClassRunner.class) -//@ContextConfiguration(classes = { ConfigTest.class, -// PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -@ActiveProfiles("test") -public class JPASpecificationLiveTest { - - // @Autowired - // private UserRepository repository; - - private User userJohn; - - private User userTom; - - private final String URL_PREFIX = "http://localhost:8082/spring-rest-query-language/auth/users/spec?search="; - - @Before - public void init() { - userJohn = new User(); - userJohn.setFirstName("john"); - userJohn.setLastName("doe"); - userJohn.setEmail("john@doe.com"); - userJohn.setAge(22); - // repository.save(userJohn); - - userTom = new User(); - userTom.setFirstName("tom"); - userTom.setLastName("doe"); - userTom.setEmail("tom@doe.com"); - userTom.setAge(26); - // repository.save(userTom); - } - - private final String EURL_PREFIX = "http://localhost:8082/spring-rest-query-language/auth/users/espec?search="; - - @Test - public void givenFirstOrLastName_whenGettingListOfUsers_thenCorrect() { - final Response response = RestAssured.get(EURL_PREFIX + "firstName:john,'lastName:doe"); - final String result = response.body() - .asString(); - assertTrue(result.contains(userJohn.getEmail())); - assertTrue(result.contains(userTom.getEmail())); - } - - @Test - public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() { - final Response response = RestAssured.get(URL_PREFIX + "firstName:john,lastName:doe"); - final String result = response.body() - .asString(); - - assertTrue(result.contains(userJohn.getEmail())); - assertFalse(result.contains(userTom.getEmail())); - } - - @Test - public void givenFirstNameInverse_whenGettingListOfUsers_thenCorrect() { - final Response response = RestAssured.get(URL_PREFIX + "firstName!john"); - final String result = response.body() - .asString(); - - assertTrue(result.contains(userTom.getEmail())); - assertFalse(result.contains(userJohn.getEmail())); - } - - @Test - public void givenMinAge_whenGettingListOfUsers_thenCorrect() { - final Response response = RestAssured.get(URL_PREFIX + "age>25"); - final String result = response.body() - .asString(); - - assertTrue(result.contains(userTom.getEmail())); - assertFalse(result.contains(userJohn.getEmail())); - } - - @Test - public void givenFirstNamePrefix_whenGettingListOfUsers_thenCorrect() { - final Response response = RestAssured.get(URL_PREFIX + "firstName:jo*"); - final String result = response.body() - .asString(); - - assertTrue(result.contains(userJohn.getEmail())); - assertFalse(result.contains(userTom.getEmail())); - } - - @Test - public void givenFirstNameSuffix_whenGettingListOfUsers_thenCorrect() { - final Response response = RestAssured.get(URL_PREFIX + "firstName:*n"); - final String result = response.body() - .asString(); - - assertTrue(result.contains(userJohn.getEmail())); - assertFalse(result.contains(userTom.getEmail())); - } - - @Test - public void givenFirstNameSubstring_whenGettingListOfUsers_thenCorrect() { - final Response response = RestAssured.get(URL_PREFIX + "firstName:*oh*"); - final String result = response.body() - .asString(); - - assertTrue(result.contains(userJohn.getEmail())); - assertFalse(result.contains(userTom.getEmail())); - } - - @Test - public void givenAgeRange_whenGettingListOfUsers_thenCorrect() { - final Response response = RestAssured.get(URL_PREFIX + "age>20,age<25"); - final String result = response.body() - .asString(); - - assertTrue(result.contains(userJohn.getEmail())); - assertFalse(result.contains(userTom.getEmail())); - } - - private final String ADV_URL_PREFIX = "http://localhost:8082/spring-rest-query-language/auth/users/spec/adv?search="; - - @Test - public void givenFirstOrLastName_whenGettingAdvListOfUsers_thenCorrect() { - final Response response = RestAssured.get(ADV_URL_PREFIX + "firstName:john OR lastName:doe"); - final String result = response.body() - .asString(); - assertTrue(result.contains(userJohn.getEmail())); - assertTrue(result.contains(userTom.getEmail())); - } - - @Test - public void givenFirstOrFirstNameAndAge_whenGettingAdvListOfUsers_thenCorrect() { - final Response response = RestAssured.get(ADV_URL_PREFIX + "( firstName:john OR firstName:tom ) AND age>22"); - final String result = response.body() - .asString(); - assertFalse(result.contains(userJohn.getEmail())); - assertTrue(result.contains(userTom.getEmail())); - } - -} +package com.baeldung.persistence.query; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import io.restassured.RestAssured; +import io.restassured.response.Response; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.test.context.ActiveProfiles; + +import com.baeldung.persistence.model.User; + +//@RunWith(SpringJUnit4ClassRunner.class) +//@ContextConfiguration(classes = { ConfigTest.class, +// PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +@ActiveProfiles("test") +public class JPASpecificationLiveTest { + + // @Autowired + // private UserRepository repository; + + private User userJohn; + + private User userTom; + + private final String URL_PREFIX = "http://localhost:8082/spring-rest-query-language/auth/users/spec?search="; + + @Before + public void init() { + userJohn = new User(); + userJohn.setFirstName("john"); + userJohn.setLastName("doe"); + userJohn.setEmail("john@doe.com"); + userJohn.setAge(22); + // repository.save(userJohn); + + userTom = new User(); + userTom.setFirstName("tom"); + userTom.setLastName("doe"); + userTom.setEmail("tom@doe.com"); + userTom.setAge(26); + // repository.save(userTom); + } + + private final String EURL_PREFIX = "http://localhost:8082/spring-rest-query-language/auth/users/espec?search="; + + @Test + public void givenFirstOrLastName_whenGettingListOfUsers_thenCorrect() { + final Response response = RestAssured.get(EURL_PREFIX + "firstName:john,'lastName:doe"); + final String result = response.body() + .asString(); + assertTrue(result.contains(userJohn.getEmail())); + assertTrue(result.contains(userTom.getEmail())); + } + + @Test + public void givenFirstAndLastName_whenGettingListOfUsers_thenCorrect() { + final Response response = RestAssured.get(URL_PREFIX + "firstName:john,lastName:doe"); + final String result = response.body() + .asString(); + + assertTrue(result.contains(userJohn.getEmail())); + assertFalse(result.contains(userTom.getEmail())); + } + + @Test + public void givenFirstNameInverse_whenGettingListOfUsers_thenCorrect() { + final Response response = RestAssured.get(URL_PREFIX + "firstName!john"); + final String result = response.body() + .asString(); + + assertTrue(result.contains(userTom.getEmail())); + assertFalse(result.contains(userJohn.getEmail())); + } + + @Test + public void givenMinAge_whenGettingListOfUsers_thenCorrect() { + final Response response = RestAssured.get(URL_PREFIX + "age>25"); + final String result = response.body() + .asString(); + + assertTrue(result.contains(userTom.getEmail())); + assertFalse(result.contains(userJohn.getEmail())); + } + + @Test + public void givenFirstNamePrefix_whenGettingListOfUsers_thenCorrect() { + final Response response = RestAssured.get(URL_PREFIX + "firstName:jo*"); + final String result = response.body() + .asString(); + + assertTrue(result.contains(userJohn.getEmail())); + assertFalse(result.contains(userTom.getEmail())); + } + + @Test + public void givenFirstNameSuffix_whenGettingListOfUsers_thenCorrect() { + final Response response = RestAssured.get(URL_PREFIX + "firstName:*n"); + final String result = response.body() + .asString(); + + assertTrue(result.contains(userJohn.getEmail())); + assertFalse(result.contains(userTom.getEmail())); + } + + @Test + public void givenFirstNameSubstring_whenGettingListOfUsers_thenCorrect() { + final Response response = RestAssured.get(URL_PREFIX + "firstName:*oh*"); + final String result = response.body() + .asString(); + + assertTrue(result.contains(userJohn.getEmail())); + assertFalse(result.contains(userTom.getEmail())); + } + + @Test + public void givenAgeRange_whenGettingListOfUsers_thenCorrect() { + final Response response = RestAssured.get(URL_PREFIX + "age>20,age<25"); + final String result = response.body() + .asString(); + + assertTrue(result.contains(userJohn.getEmail())); + assertFalse(result.contains(userTom.getEmail())); + } + + private final String ADV_URL_PREFIX = "http://localhost:8082/spring-rest-query-language/auth/users/spec/adv?search="; + + @Test + public void givenFirstOrLastName_whenGettingAdvListOfUsers_thenCorrect() { + final Response response = RestAssured.get(ADV_URL_PREFIX + "firstName:john OR lastName:doe"); + final String result = response.body() + .asString(); + assertTrue(result.contains(userJohn.getEmail())); + assertTrue(result.contains(userTom.getEmail())); + } + + @Test + public void givenFirstOrFirstNameAndAge_whenGettingAdvListOfUsers_thenCorrect() { + final Response response = RestAssured.get(ADV_URL_PREFIX + "( firstName:john OR firstName:tom ) AND age>22"); + final String result = response.body() + .asString(); + assertFalse(result.contains(userJohn.getEmail())); + assertTrue(result.contains(userTom.getEmail())); + } + +} diff --git a/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/RsqlIntegrationTest.java b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/RsqlIntegrationTest.java similarity index 100% rename from spring-rest-query-language/src/test/java/com/baeldung/persistence/query/RsqlIntegrationTest.java rename to spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/persistence/query/RsqlIntegrationTest.java diff --git a/spring-rest-query-language/src/test/java/com/baeldung/web/MyUserLiveTest.java b/spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/web/MyUserLiveTest.java similarity index 100% rename from spring-rest-query-language/src/test/java/com/baeldung/web/MyUserLiveTest.java rename to spring-web-modules/spring-rest-query-language/src/test/java/com/baeldung/web/MyUserLiveTest.java diff --git a/spring-rest-query-language/src/test/resources/.gitignore b/spring-web-modules/spring-rest-query-language/src/test/resources/.gitignore similarity index 100% rename from spring-rest-query-language/src/test/resources/.gitignore rename to spring-web-modules/spring-rest-query-language/src/test/resources/.gitignore