Building a Commercial Web Application Using REST

We were playing around till now, but Java is not a toy. We want to use Java for something real and serious, commercial and professional. In this chapter, we will do that. The example is not something that is only interesting to play with, such as Mastermind in the previous three chapters, but rather a real commercial application. Not a real-life application actually. You should not expect anything like that in a book. It would be too long and not educating enough. However, the application that we will develop in this chapter can be extended and can be used as a core for a real-life application in case you decided to do so.

In the previous chapter, we created servlets. To do so, we used the servlet specification, and we hand-implemented servlets. That is something you will rarely do these days. Instead, we will use a readily available framework, this time, Spring. It is the most widely used framework for Java commercial applications, and I dare say it is the de facto standard. It will do all the tedious work that we had to do (at least to understand and learn how a servlet works) in the previous chapter. We will also use Spring for dependency injection (why use two frameworks when one does it all?), and we will use Tomcat.

In the previous chapter, we used Guice as a DI framework and Jetty as a servlet container. They can be a perfectly good choice for some projects. For other projects, other frameworks do better. To have the opportunity to look at different tools in this book, we will use different frameworks even though all the examples could be created by simply using Tomcat and Spring.

The commercial application we will develop will be an ordering system targeting resellers. The interface we will provide to the users will not be a web browser; rather, it will be REST. The users will themselves develop applications that communicate with our system and place orders for different products. The structure of the application we will develop will be microservices architecture, and we will use soapUI to test the application, in addition to the standard Chrome developer tool features.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.144.216