Develop the Presentation Tier

This is the final step in the service development process.

We'll cover the following

REST-based Spring Controller

The last tier in the stack is the REST-based Spring Controller. First, we’ll look at how to write the test and then follow with the corresponding method in the controller. The @WebAppConfiguration is used to make sure the ApplicationContext is of the WebApplicationContext type. Gson is a Java library that can be used to convert Java Objects into their JSON representation. MockMvc instance is constructed from the WebApplicationContext.

MockMvcRequestBuilders post and get methods are used to send the request.

Get hands-on with 1200+ tech skills courses.