Spring MVC Cookbook

Over 40 recipes for creating cloud-ready Java web applications with Spring MVC
Preview in Mapt

Spring MVC Cookbook

Alex Bretet

Over 40 recipes for creating cloud-ready Java web applications with Spring MVC
Mapt Subscription
FREE
$20.83/m after trial
eBook
$30.80
RRP $43.99
Save 29%
Print + eBook
$54.99
RRP $54.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$30.80
$54.99
$20.83p/m after trial
RRP $43.99
RRP $54.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Spring MVC Cookbook Book Cover
Spring MVC Cookbook
$ 43.99
$ 30.80
Spring MVC: Designing Real-World Web Applications Book Cover
Spring MVC: Designing Real-World Web Applications
$ 69.99
$ 49.00
Buy 2 for $35.00
Save $78.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781784396411
Paperback466 pages

Book Description

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

Chapter 1: Setup Routine for an Enterprise Spring Application
Introduction
Installing Eclipse for JEE Developers and Java SE 8
Configuring Eclipse for Java 8, Maven 3, and Tomcat 8
Defining the project structure with Maven
Installing Spring, Spring MVC, and a web structure
Chapter 2: Designing a Microservice Architecture with Spring MVC
Introduction
Configuring a controller with simple URL mapping
Configuring a fallback controller using ViewResolver
Setting up and customizing a responsive single page webdesign with Bootstrap
Displaying a model in the View, using the JSTL
Defining a common WebContentInterceptor
Designing a client-side MVC pattern with AngularJS
Chapter 3: Working with Java Persistence and Entities
Introduction
Configuring the Java Persistence API in Spring
Defining useful EJB3 entities and relationships
Making use of the JPA and Spring Data JPA
Chapter 4: Building a REST API for a Stateless Architecture
Introduction
Binding requests and marshalling responses
Configuring content-negotiation (JSON, XML, and so on)
Adding pagination, filters, and sorting capabilities
Handling exceptions globally
Documenting and exposing an API with Swagger
Chapter 5: Authenticating with Spring MVC
Introduction
Configuring Apache HTTP to proxy your Tomcat(s)
Adapting users and roles to Spring Security
Authenticating over a BASIC scheme
Authenticating with a third-party OAuth2 scheme
Storing credentials in a REST environment
Authorizing on services and controllers
Chapter 6: Implementing HATEOAS
Introduction
Turning DTOs into Spring HATEOAS resources
Building links for a hypermedia-driven API
Choosing a strategy to expose JPA Entities
Retrieving data from a third-party API with OAuth
Chapter 7: Developing CRUD Operations and Validations
Introduction
Extending REST handlers to all HTTP methods
Validating resources using bean validation support
Internationalizing messages and contents for REST
Validating client-side forms with HTML5 AngularJS
Chapter 8: Communicating Through WebSockets and STOMP
Introduction
Streaming social events with STOMP over SockJS
Using RabbitMQ as a multiprotocol message broker
Stacking and consuming tasks with RabbitMQ and AMQP
Securing messages with Spring Session and Redis
Chapter 9: Testing and Troubleshooting
Introduction
Automating Database Migrations with FlyWay
Unit testing with Mockito and Maven Surefire
Integration testing with Cargo, Rest-assured, and Maven failsafe
Injecting Spring Beans into integration tests
Modern application Logging with Log4j2

What You Will Learn

  • Structure your project with Maven and create self-tested, domain-specific deployable web archives
  • Generate templates for a responsive and powerful frontend with AngularJS and Bootstrap
  • Build a high performance stateless RESTful and hypermedia application to support your multiple customer experiences
  • Authenticate over REST with a BASIC authentication scheme and OAuth2; handle roles and permissions
  • Document and publish your REST API using Swagger and Swagger UI
  • Scale your Spring web application
  • Communicate through WebSocket and STOMP messages
  • Provide support to your application and efficiently maintain its business features with a relevant test stack

Authors

Table of Contents

Chapter 1: Setup Routine for an Enterprise Spring Application
Introduction
Installing Eclipse for JEE Developers and Java SE 8
Configuring Eclipse for Java 8, Maven 3, and Tomcat 8
Defining the project structure with Maven
Installing Spring, Spring MVC, and a web structure
Chapter 2: Designing a Microservice Architecture with Spring MVC
Introduction
Configuring a controller with simple URL mapping
Configuring a fallback controller using ViewResolver
Setting up and customizing a responsive single page webdesign with Bootstrap
Displaying a model in the View, using the JSTL
Defining a common WebContentInterceptor
Designing a client-side MVC pattern with AngularJS
Chapter 3: Working with Java Persistence and Entities
Introduction
Configuring the Java Persistence API in Spring
Defining useful EJB3 entities and relationships
Making use of the JPA and Spring Data JPA
Chapter 4: Building a REST API for a Stateless Architecture
Introduction
Binding requests and marshalling responses
Configuring content-negotiation (JSON, XML, and so on)
Adding pagination, filters, and sorting capabilities
Handling exceptions globally
Documenting and exposing an API with Swagger
Chapter 5: Authenticating with Spring MVC
Introduction
Configuring Apache HTTP to proxy your Tomcat(s)
Adapting users and roles to Spring Security
Authenticating over a BASIC scheme
Authenticating with a third-party OAuth2 scheme
Storing credentials in a REST environment
Authorizing on services and controllers
Chapter 6: Implementing HATEOAS
Introduction
Turning DTOs into Spring HATEOAS resources
Building links for a hypermedia-driven API
Choosing a strategy to expose JPA Entities
Retrieving data from a third-party API with OAuth
Chapter 7: Developing CRUD Operations and Validations
Introduction
Extending REST handlers to all HTTP methods
Validating resources using bean validation support
Internationalizing messages and contents for REST
Validating client-side forms with HTML5 AngularJS
Chapter 8: Communicating Through WebSockets and STOMP
Introduction
Streaming social events with STOMP over SockJS
Using RabbitMQ as a multiprotocol message broker
Stacking and consuming tasks with RabbitMQ and AMQP
Securing messages with Spring Session and Redis
Chapter 9: Testing and Troubleshooting
Introduction
Automating Database Migrations with FlyWay
Unit testing with Mockito and Maven Surefire
Integration testing with Cargo, Rest-assured, and Maven failsafe
Injecting Spring Beans into integration tests
Modern application Logging with Log4j2

Book Details

ISBN 139781784396411
Paperback466 pages
Read More

Read More Reviews

Recommended for You

Mastering Web Application Development with AngularJS Book Cover
Mastering Web Application Development with AngularJS
$ 26.99
$ 5.40
AngularJS UI Development Book Cover
AngularJS UI Development
$ 26.99
$ 18.90
AngularJS by Example Book Cover
AngularJS by Example
$ 24.99
$ 17.50
AngularJS Web Application Development Cookbook Book Cover
AngularJS Web Application Development Cookbook
$ 29.99
$ 6.00
Spring MVC Beginner’s Guide Book Cover
Spring MVC Beginner’s Guide
$ 26.99
$ 18.90
Learning Spring Boot Book Cover
Learning Spring Boot
$ 26.99
$ 18.90