@@ -244,15 +247,19 @@
- 3.7.3
- 1.4.191
- 4.2.5.RELEASE
- 1.7.18
- 1.1.3
+ 3.8.6
+ 1.4.193
+ 4.3.4.RELEASE
+ 1.7.21
+ 1.1.7
4.12
- 3.5.1
- 2.19.1
+ 3.6.0
+ 2.19.1
+ 1.0.0
+ 1.5
+ 1.0.0
+
\ No newline at end of file
diff --git a/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java b/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java
index fa3f342ecd..25317309ee 100644
--- a/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java
+++ b/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java
@@ -1,5 +1,10 @@
package com.baeldung.jooq.springboot;
+import static com.baeldung.jooq.introduction.db.public_.tables.Author.AUTHOR;
+import static com.baeldung.jooq.introduction.db.public_.tables.AuthorBook.AUTHOR_BOOK;
+import static com.baeldung.jooq.introduction.db.public_.tables.Book.BOOK;
+import static org.junit.Assert.assertEquals;
+
import org.jooq.DSLContext;
import org.jooq.Record3;
import org.jooq.Result;
@@ -7,19 +12,14 @@ import org.jooq.impl.DSL;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.dao.DataAccessException;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
-import static com.baeldung.jooq.introduction.db.public_.tables.Author.AUTHOR;
-import static com.baeldung.jooq.introduction.db.public_.tables.AuthorBook.AUTHOR_BOOK;
-import static com.baeldung.jooq.introduction.db.public_.tables.Book.BOOK;
-import static org.junit.Assert.assertEquals;
-
-@SpringApplicationConfiguration(Application.class)
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
@Transactional("transactionManager")
-@RunWith(SpringJUnit4ClassRunner.class)
public class SpringBootIntegrationTest {
@Autowired
diff --git a/spring-mvc-handlers/pom.xml b/spring-mvc-handlers/pom.xml
new file mode 100644
index 0000000000..0074898767
--- /dev/null
+++ b/spring-mvc-handlers/pom.xml
@@ -0,0 +1,70 @@
+
+ 4.0.0
+ com.baeldung
+ SpringMVCHandlers
+ war
+ 0.0.1-SNAPSHOT
+ SpringMVCHandlers Maven Webapp
+ http://maven.apache.org
+
+
+ 4.3.4.RELEASE
+ 3.5.1
+ 2.6
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+
+
+ commons-logging
+ commons-logging
+ 1.2
+
+
+ org.springframework
+ spring-webmvc
+ ${springframework.version}
+
+
+ org.springframework
+ spring-context
+ ${springframework.version}
+
+
+ org.springframework
+ spring-core
+ ${springframework.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ 1.7
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ ${maven-war-plugin.version}
+
+ src/main/webapp
+ springMVCHandlers
+ false
+
+
+
+
+ springMVCHandlers
+
+
diff --git a/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java
new file mode 100644
index 0000000000..164830cd6a
--- /dev/null
+++ b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/AnnotationMethodHandlerAdapterExample.java
@@ -0,0 +1,15 @@
+package com.baeldung.spring.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+public class AnnotationMethodHandlerAdapterExample {
+ @RequestMapping("/annotedName")
+ public ModelAndView getEmployeeName() {
+ ModelAndView model = new ModelAndView("Greeting");
+ model.addObject("message", "Dinesh");
+ return model;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java
new file mode 100644
index 0000000000..76ac3e2806
--- /dev/null
+++ b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/RequestMappingHandlerAdapterExample.java
@@ -0,0 +1,15 @@
+package com.baeldung.spring.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+public class RequestMappingHandlerAdapterExample {
+ @RequestMapping("/requestName")
+ public ModelAndView getEmployeeName() {
+ ModelAndView model = new ModelAndView("Greeting");
+ model.addObject("message", "Madhwal");
+ return model;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java
new file mode 100644
index 0000000000..bac091ffeb
--- /dev/null
+++ b/spring-mvc-handlers/src/main/java/com/baeldung/spring/controller/SimpleControllerHandlerAdapterExample.java
@@ -0,0 +1,18 @@
+package com.baeldung.spring.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.AbstractController;
+
+public class SimpleControllerHandlerAdapterExample extends
+ AbstractController {
+ @Override
+ protected ModelAndView handleRequestInternal(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ ModelAndView model = new ModelAndView("Greeting");
+ model.addObject("message", "Dinesh Madhwal");
+ return model;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-handlers/src/main/resources/spring-servlet_AnnotationMethodHandlerAdapter.xml b/spring-mvc-handlers/src/main/resources/spring-servlet_AnnotationMethodHandlerAdapter.xml
new file mode 100644
index 0000000000..a8071a622f
--- /dev/null
+++ b/spring-mvc-handlers/src/main/resources/spring-servlet_AnnotationMethodHandlerAdapter.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-handlers/src/main/resources/spring-servlet_RequestMappingHandlerAdapter.xml b/spring-mvc-handlers/src/main/resources/spring-servlet_RequestMappingHandlerAdapter.xml
new file mode 100644
index 0000000000..b32a213eb3
--- /dev/null
+++ b/spring-mvc-handlers/src/main/resources/spring-servlet_RequestMappingHandlerAdapter.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-handlers/src/main/resources/spring-servlet_SimpleControllerHandlerAdapter.xml b/spring-mvc-handlers/src/main/resources/spring-servlet_SimpleControllerHandlerAdapter.xml
new file mode 100644
index 0000000000..60c9b9e3df
--- /dev/null
+++ b/spring-mvc-handlers/src/main/resources/spring-servlet_SimpleControllerHandlerAdapter.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-handlers/src/main/webapp/WEB-INF/Greeting.jsp b/spring-mvc-handlers/src/main/webapp/WEB-INF/Greeting.jsp
new file mode 100644
index 0000000000..820d2f380f
--- /dev/null
+++ b/spring-mvc-handlers/src/main/webapp/WEB-INF/Greeting.jsp
@@ -0,0 +1,5 @@
+
+
+ Hello ${message}
+
+
\ No newline at end of file
diff --git a/spring-mvc-handlers/src/main/webapp/WEB-INF/web.xml b/spring-mvc-handlers/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..b6f1065cad
--- /dev/null
+++ b/spring-mvc-handlers/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,19 @@
+
+
+
+ spring
+ org.springframework.web.servlet.DispatcherServlet
+
+ contextConfigLocation
+ classpath*:spring-servlet_RequestMappingHandlerAdapter.xml
+
+ 1
+
+
+ spring
+ /
+
+
\ No newline at end of file
diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md
index 996a7d96b1..3da7b42fa3 100644
--- a/spring-mvc-java/README.md
+++ b/spring-mvc-java/README.md
@@ -16,3 +16,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Intro to WebSockets with Spring](http://www.baeldung.com/websockets-spring)
- [File Upload with Spring MVC](http://www.baeldung.com/spring-file-upload)
- [Spring MVC Content Negotiation](http://www.baeldung.com/spring-mvc-content-negotiation-json-xml)
+- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring)
diff --git a/spring-mvc-java/src/main/README.md b/spring-mvc-java/src/main/README.md
deleted file mode 100644
index 20ee1918af..0000000000
--- a/spring-mvc-java/src/main/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-### Relevant Articles:
-- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring)
diff --git a/spring-mvc-java/src/test/README.md b/spring-mvc-java/src/test/README.md
deleted file mode 100644
index 20ee1918af..0000000000
--- a/spring-mvc-java/src/test/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-### Relevant Articles:
-- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring)
diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java
index 45e441f47f..da1b0e484a 100644
--- a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java
+++ b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java
@@ -1,10 +1,7 @@
package com.baeldung.htmlunit;
-import java.io.IOException;
-
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,7 +11,6 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.htmlunit.MockMvcWebClientBuilder;
import org.springframework.web.context.WebApplicationContext;
-import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -33,8 +29,7 @@ public class HtmlUnitAndSpringTest {
@Before
public void setup() {
- webClient = MockMvcWebClientBuilder
- .webAppContextSetup(wac).build();
+ webClient = MockMvcWebClientBuilder.webAppContextSetup(wac).build();
}
@Test
@@ -44,18 +39,16 @@ public class HtmlUnitAndSpringTest {
String url = "http://localhost/message/showForm";
page = webClient.getPage(url);
-
+
HtmlTextInput messageText = page.getHtmlElementById("message");
messageText.setValueAttribute(text);
HtmlForm form = page.getForms().get(0);
- HtmlSubmitInput submit = form.getOneHtmlElementByAttribute(
- "input", "type", "submit");
+ HtmlSubmitInput submit = form.getOneHtmlElementByAttribute("input", "type", "submit");
HtmlPage newPage = submit.click();
- String receivedText = newPage.getHtmlElementById("received")
- .getTextContent();
+ String receivedText = newPage.getHtmlElementById("received").getTextContent();
- Assert.assertEquals(receivedText, text);
+ Assert.assertEquals(receivedText, text);
}
}
diff --git a/spring-mvc-tiles/README.md b/spring-mvc-tiles/README.md
new file mode 100644
index 0000000000..58991005f5
--- /dev/null
+++ b/spring-mvc-tiles/README.md
@@ -0,0 +1,2 @@
+###Relevant Articles:
+- [Apache Tiles Integration with Spring MVC](http://www.baeldung.com/spring-mvc-apache-tiles)
diff --git a/spring-mvc-xml/README.md b/spring-mvc-xml/README.md
index e96a8d0392..097353c88c 100644
--- a/spring-mvc-xml/README.md
+++ b/spring-mvc-xml/README.md
@@ -13,3 +13,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Basic Forms with Spring MVC](http://www.baeldung.com/spring-mvc-form-tutorial)
- [Returning Image/Media Data with Spring MVC](http://www.baeldung.com/spring-mvc-image-media-data)
- [Geolocation by IP in Java](http://www.baeldung.com/geolocation-by-ip-with-maxmind)
+- [Guide to JSP](http://www.baeldung.com/guide-to-jsp)
\ No newline at end of file
diff --git a/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java b/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java
new file mode 100644
index 0000000000..0b153bf8ec
--- /dev/null
+++ b/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleOne.java
@@ -0,0 +1,31 @@
+package com.baeldung.jsp;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class ExampleOne extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println(
+ "" +
+ "" +
+ "" +
+ "HTML Rendered by Servlet" +
+ "" +
+ "" +
+ "HTML Rendered by Servlet
" +
+ "This page was rendered by the ExampleOne Servlet!
" +
+ "" +
+ ""
+ );
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java b/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java
new file mode 100644
index 0000000000..49fefcffde
--- /dev/null
+++ b/spring-mvc-xml/src/main/java/com/baeldung/jsp/ExampleThree.java
@@ -0,0 +1,24 @@
+package com.baeldung.jsp;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@WebServlet(
+ name = "ExampleThree",
+ description = "JSP Servlet With Annotations",
+ urlPatterns = {"/ExampleThree"}
+)
+public class ExampleThree extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ String message = request.getParameter("message");
+ request.setAttribute("text", message);
+ request.getRequestDispatcher("/jsp/ExampleThree.jsp").forward(request, response);
+ }
+}
diff --git a/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml b/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml
index e68c88d19d..41422d8954 100644
--- a/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml
+++ b/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml
@@ -11,7 +11,7 @@
http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">
-
+
diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml b/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml
index 2240ac0a22..1ea3051426 100644
--- a/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml
+++ b/spring-mvc-xml/src/main/webapp/WEB-INF/web.xml
@@ -34,6 +34,25 @@
/
+
+
+
+ ExampleOne
+ com.baeldung.jsp.ExampleOne
+
+
+ ExampleOne
+ /jsp/ExampleOne
+
+
+ ExampleThree
+ com.baeldung.jsp.ExampleThree
+
+
+ ExampleThree
+ /jsp/ExampleThree
+
+
diff --git a/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp b/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp
new file mode 100644
index 0000000000..665eb86a30
--- /dev/null
+++ b/spring-mvc-xml/src/main/webapp/jsp/ExampleThree.jsp
@@ -0,0 +1,10 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ Java Binding Example
+
+
+ Bound Value
+ You said: ${text}
+
+