Web application development is a major focus area for enterprise systems. In this age of cloud and big data, web applications are under a tremendous load of an ever-increasing number of concurrent users accessing them from multiple devices such as mobiles and tablets, as well as traditional desktop web browsers. Modern web applications have to address a newer set of nonfunctional requirements, such as scalability, performance, productivity, responsiveness, and multi-device support.
Spring MVC is a web framework from Spring, perfectly built from the ground up to address the concerns of modern web applications. A lightweight and high-performance web framework, Spring MVC is designed to be highly productive from day one, flexible, and adaptable with a wide variety of view technologies. Sitting on top of the mighty Spring Framework, it integrates well with all Java EE technologies and other open source frameworks. Just like any technology under the Spring portfolio, Spring MVC also promotes POJO programming with the help of a well-defined set of annotations, namespace XML tags, and web-support components.
This chapter introduces Spring MVC and its powerful features to you, describes how to set it up, and guides you on its advanced usages, configurations, and optimizations with relevant examples. We will mostly use annotations in these examples for simplicity. At the end of this chapter, you will be able to build web applications with Spring MVC that have HTML-based user interfaces as well as RESTful APIs with JSON and XML formats.
Spring MVC bundles a compelling set of features and advantages over rival web technologies. Knowledge of these will help you decide on choosing Spring MVC for your requirements. The following list covers most of them:
What makes Spring MVC outstanding is its simple programming model, a feature inherited from the core Spring Framework itself. A developer familiar with any standard web framework will find Spring MVC very familiar and easy to learn.