Bael 3395 - spring optional path var (#8341)
* initial test cases * changes in @requestMapping * moving code to spring-mvc-basic-2 project * moving Article class
This commit is contained in:
parent
337c83b463
commit
96d4c3c95b
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.model;
|
||||
package com.baeldung.controller.optionalpathvars;
|
||||
|
||||
public class Article {
|
||||
|
|
@ -1,13 +1,11 @@
|
|||
package com.baeldung.controller.optionalpathvars;
|
||||
|
||||
import static com.baeldung.model.Article.DEFAULT_ARTICLE;
|
||||
import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baeldung.model.Article;
|
||||
|
||||
@RestController
|
||||
public class ArticleViewerController {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.baeldung.controller.optionalpathvars;
|
||||
|
||||
import static com.baeldung.model.Article.DEFAULT_ARTICLE;
|
||||
import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -8,8 +8,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baeldung.model.Article;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/mapParam")
|
||||
public class ArticleViewerWithMapParamController {
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package com.baeldung.controller.optionalpathvars;
|
||||
|
||||
import static com.baeldung.model.Article.DEFAULT_ARTICLE;
|
||||
import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baeldung.model.Article;;
|
||||
import org.springframework.web.bind.annotation.RestController;;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/optionalParam")
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.baeldung.controller.optionalpathvars;
|
||||
|
||||
import static com.baeldung.model.Article.DEFAULT_ARTICLE;
|
||||
import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baeldung.model.Article;;
|
||||
import org.springframework.web.bind.annotation.RestController;;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/requiredAttribute")
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package com.baeldung.controller.optionalpathvars;
|
||||
|
||||
import static com.baeldung.model.Article.DEFAULT_ARTICLE;
|
||||
import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baeldung.model.Article;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/seperateMethods")
|
||||
public class ArticleViewerWithTwoSeparateMethodsController {
|
||||
|
|
|
@ -12,8 +12,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import com.baeldung.model.Article;
|
||||
import org.baeldung.controller.config.WebConfig;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
|
|
@ -12,8 +12,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import com.baeldung.model.Article;
|
||||
import org.baeldung.controller.config.WebConfig;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
|
|
@ -12,8 +12,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import com.baeldung.model.Article;
|
||||
import org.baeldung.controller.config.WebConfig;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
|
|
@ -12,8 +12,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import com.baeldung.model.Article;
|
||||
import org.baeldung.controller.config.WebConfig;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
|
Loading…
Reference in New Issue