diff --git a/spring-mvc-java-2/pom.xml b/spring-mvc-java-2/pom.xml index d5b7d087ab..7deab74fcb 100644 --- a/spring-mvc-java-2/pom.xml +++ b/spring-mvc-java-2/pom.xml @@ -7,14 +7,14 @@ 0.1-SNAPSHOT spring-mvc-java-2 war - + com.baeldung parent-boot-2 0.0.1-SNAPSHOT ../parent-boot-2 - + javax.servlet @@ -26,14 +26,22 @@ spring-webmvc ${spring.mvc.version} - - + + + spring-mvc-java-2 + + + src/main/resources + true + + + + 4.0.1 5.2.2.RELEASE - \ No newline at end of file diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/SiteController.java b/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/SiteController.java index 0ba6d12a0f..493161b0eb 100644 --- a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/SiteController.java +++ b/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/SiteController.java @@ -4,8 +4,9 @@ import org.springframework.stereotype.Controller; 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.RestController; -@Controller +@RestController @RequestMapping("/site") public class SiteController { diff --git a/spring-mvc-java-2/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-mvc-java-2/src/main/webapp/WEB-INF/mvc-servlet.xml new file mode 100644 index 0000000000..b8e280dfdf --- /dev/null +++ b/spring-mvc-java-2/src/main/webapp/WEB-INF/mvc-servlet.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/spring-mvc-java-2/src/main/webapp/WEB-INF/web.xml b/spring-mvc-java-2/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..86a24e7646 --- /dev/null +++ b/spring-mvc-java-2/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + Spring MVC Application 2 + + + mvc + + org.springframework.web.servlet.DispatcherServlet + + + contextConfigLocation + /WEB-INF/mvc-servlet.xml + + 1 + + + + mvc + / + + \ No newline at end of file