From 1e9cc725707c2f39b8011999f884d5e59ca182e7 Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Wed, 8 Dec 2021 18:27:42 +0530 Subject: [PATCH] Removed the used code --- spring-web-modules/spring-web-url/pom.xml | 65 ++----------------- .../exclude_urls_filter/Application.java | 5 +- .../baeldung/spring/slash/Application.java | 20 ++++++ .../spring/slash/SlashParsingController.java | 31 +++++++++ 4 files changed, 58 insertions(+), 63 deletions(-) create mode 100644 spring-web-modules/spring-web-url/src/main/java/com/baeldung/spring/slash/Application.java create mode 100644 spring-web-modules/spring-web-url/src/main/java/com/baeldung/spring/slash/SlashParsingController.java diff --git a/spring-web-modules/spring-web-url/pom.xml b/spring-web-modules/spring-web-url/pom.xml index 0a10afad08..011b17659f 100644 --- a/spring-web-modules/spring-web-url/pom.xml +++ b/spring-web-modules/spring-web-url/pom.xml @@ -46,21 +46,7 @@ org.springframework.boot spring-boot-starter-actuator - - com.h2database - h2 - runtime - - - javax.persistence - javax.persistence-api - ${jpa.version} - - - com.google.guava - guava - ${guava.version} - + org.subethamail subethasmtp @@ -72,6 +58,11 @@ httpclient ${httpclient.version} + + org.junit.vintage + junit-vintage-engine + test + @@ -80,57 +71,13 @@ src/main/resources true - - **/conf.properties - - - - autoconfiguration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - **/*IntegrationTest.java - **/*IntTest.java - - - **/AutoconfigurationTest.java - - - - - - - json - - - - - - - - com.baeldung.exclude_urls_filter.Application - 3.1.1 - 3.3.7-1 - 2.2 - 18.0 3.1.7 4.5.8 diff --git a/spring-web-modules/spring-web-url/src/main/java/com/baeldung/exclude_urls_filter/Application.java b/spring-web-modules/spring-web-url/src/main/java/com/baeldung/exclude_urls_filter/Application.java index 4fb6938694..9841a9b967 100644 --- a/spring-web-modules/spring-web-url/src/main/java/com/baeldung/exclude_urls_filter/Application.java +++ b/spring-web-modules/spring-web-url/src/main/java/com/baeldung/exclude_urls_filter/Application.java @@ -2,11 +2,8 @@ package com.baeldung.exclude_urls_filter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -@ComponentScan(basePackages = "com.baeldung.exclude_urls_filter") -@Configuration + @SpringBootApplication public class Application { diff --git a/spring-web-modules/spring-web-url/src/main/java/com/baeldung/spring/slash/Application.java b/spring-web-modules/spring-web-url/src/main/java/com/baeldung/spring/slash/Application.java new file mode 100644 index 0000000000..6f2352b499 --- /dev/null +++ b/spring-web-modules/spring-web-url/src/main/java/com/baeldung/spring/slash/Application.java @@ -0,0 +1,20 @@ +package com.baeldung.spring.slash; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@SpringBootApplication(exclude = { + DataSourceAutoConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class, + HibernateJpaAutoConfiguration.class}) +public class Application implements WebMvcConfigurer { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/spring-web-modules/spring-web-url/src/main/java/com/baeldung/spring/slash/SlashParsingController.java b/spring-web-modules/spring-web-url/src/main/java/com/baeldung/spring/slash/SlashParsingController.java new file mode 100644 index 0000000000..07b62a5b4d --- /dev/null +++ b/spring-web-modules/spring-web-url/src/main/java/com/baeldung/spring/slash/SlashParsingController.java @@ -0,0 +1,31 @@ +package com.baeldung.spring.slash; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("slash") +public class SlashParsingController { + + @GetMapping("mypaths/{anything}") + public String pathVariable(@PathVariable("anything") String anything) { + return anything; + } + + @GetMapping("all/**") + public String allDirectories(HttpServletRequest request) { + return request.getRequestURI() + .split(request.getContextPath() + "/all/")[1]; + } + + @GetMapping("all") + public String queryParameter(@RequestParam("param") String param) { + return param; + } + +}