Book Image

Spring MVC Cookbook

By : Alexandre Bretet, Alex Bretet
Book Image

Spring MVC Cookbook

By: Alexandre Bretet, Alex Bretet

Overview of this book

Spring MVC is a lightweight application framework that comes with a great configuration by default. Being part of the Spring Framework, it naturally extended and supported it with an amazing set of recognizable annotations. External libraries can be plugged in and plugged out. It also possesses a request flow. Complete support of REST web services makes the Spring architecture an extremely consistent choice to support your front-end needs and Internet transformations. From the design of your Maven modules, you will achieve an Enterprise-standard for a stateless REST application based on Spring and Spring MVC with this book. This guide is unique in its style as it features a massive overview of practical development techniques brought together from the Spring ecosystem, the new JEE standards, the JavaScript revolution and Internet of Things. You will begin with the very first steps of Spring MVC's product design. Focused on deployment, viability, and maintainability, you will learn the use of Eclipse, Maven, and Git. You will walk through the separation of concerns driven by the microservices principles. Using Bootstrap and AngularJS, you will develop a responsive front-end, capable of interacting autonomously with a REST API. Later in the book, you will setup the Java Persistence API (JPA) within Spring; learn how to configure your Entities to reflect your domain needs, and discover Spring Data repositories. You will analyze how Spring MVC responds to complex HTTP requests. You will implement Hypermedia and HATEOAS to guide your customer's stateless conversation with the product and see how a messaging-service based on WebSocket can be configured. Finally you will learn how to set up and organize different levels of automated-tests, including logging and monitoring.
Table of Contents (16 chapters)
Spring MVC Cookbook
About the Author
About the Reviewer


The Java Persistence API (JPA) is a specification that has been produced in different releases from 2006 (JPA 1.0) to 2013 (JPA 2.1) by a group of various experts. Historically, it is one of the three pieces of the EJB 3.0 specification, which has come along with JEE5.

More than an upgrade of Enterprise JavaBeans (EJB), JPA was pretty much a complete redesign. At the time, the leading providers of Object Relational Mapping solution (such as Hibernate) and of J2EE application servers (such as WebSphere, JBoss) have been involved, and the global result has been unarguably simpler. All the types of EJBs (stateful, stateless, and entities) are now simple Plain Old Java Objects (POJOs) that are enriched with specific metadata that is nicely presented as annotations.

The Entities' benefits

Entities play a key role in the EJB3 model. As simple POJOs, they can be used in every single layer of the application.

Ideally, an entity represents an identifiable functional unit within a business...