The spring-kitchensink-springmvctest
quickstart demonstrates how to create an MVC application using JSP, JPA and Spring 4.x.
The spring-kitchensink-springmvctest
quickstart demonstrates how to create an MVC application using JSP, JPA and Spring 4.x in {productNameFull}.
-
This module adds
MemberMockMVCTest.java
to showcase a use case ofMockMVC
andRestTemplate
to test the MVC aspect of the application. -
By using
@WebAppConfiguration
and@ContextConfiguration
we tell Spring the configuration files we would like the tests to use. -
In the
jboss-as-spring-mvc-context.xml
file, thecontext:component-scan
andmvc:annotation-driven
elements are used to register both the non-rest and rest controllers. -
The controllers map the respective urls to methods using
@RequestMapping(url)
. -
To return JSON, the rest controller uses
@ResponseBody
. -
The datasource and entitymanager are retrieved via JNDI.
The application will be running at the following URL: http://localhost:8080/{artifactId}/.
You will see the following warnings in the server log. You can ignore these warnings.
WARN [org.jboss.as.ee] (MSC service thread 1-5) WFLYEE0007: Not installing optional component org.springframework.http.server.ServletServerHttpAsyncRequestControl due to an exception (enable DEBUG log level to see the cause)
WARN [org.jboss.as.ee] (MSC service thread 1-5) WFLYEE0007: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to an exception (enable DEBUG log level to see the cause)