[BAEL-19881] - Rename spring-mvc-simple modules

This commit is contained in:
catalin-burcea
2019-12-16 18:35:04 +02:00
parent bc917e677c
commit 90dab2770d
213 changed files with 301 additions and 302 deletions

View File

@@ -0,0 +1,23 @@
package com.baeldung.controller.optionalpathvars;
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;
@RestController
public class ArticleViewerController {
@RequestMapping(value = {"/article", "/article/{id}"})
public Article getArticle(@PathVariable(name = "id") Integer articleId) {
if (articleId != null) {
return new Article(articleId);
} else {
return DEFAULT_ARTICLE;
}
}
}