Skip to content

Latest commit

 

History

History
102 lines (74 loc) · 3.89 KB

File metadata and controls

102 lines (74 loc) · 3.89 KB

spring-kitchensink-springmvctest: Kitchensink MVC Example Using Spring 4.x

The spring-kitchensink-springmvctest quickstart demonstrates how to create an MVC application using JSP, JPA and Spring 4.x.

What is it?

The spring-kitchensink-springmvctest quickstart demonstrates how to create an MVC application using JSP, JPA and Spring 4.x in WildFly Application Server.

  • This module adds MemberMockMVCTest.java to showcase a use case of MockMVC and RestTemplate 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, the context:component-scan and mvc: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.

Debug the Application

If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following commands to pull them into your local repository. The IDE should then detect them.

$ mvn dependency:sources
$ mvn dependency:resolve -Dclassifier=javadoc