Spring MVC: Designing Real-World Web Applications

Unleash the power of Spring MVC and build enterprise-grade, lightning-fast web applications
Preview in Mapt

Spring MVC: Designing Real-World Web Applications

Shameer Kunjumohamed et al.

2 customer reviews
Unleash the power of Spring MVC and build enterprise-grade, lightning-fast web applications
Mapt Subscription
FREE
$29.99/m after trial
eBook
$35.00
RRP $69.99
Save 49%
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
$35.00
$29.99 p/m after trial
RRP $69.99
Subscription
eBook
Start 14 Day Trial

Frequently bought together


Spring MVC: Designing Real-World Web Applications Book Cover
Spring MVC: Designing Real-World Web Applications
$ 69.99
$ 35.00
Spring: Developing Java Applications for the Enterprise Book Cover
Spring: Developing Java Applications for the Enterprise
$ 67.99
$ 34.00
Buy 2 for $35.00
Save $102.98
Add to Cart

Book Details

ISBN 139781787126398
Paperback944 pages

Book Description

Spring MVC helps you build flexible and loosely coupled web applications. The Spring MVC Framework is designed in such a way that every piece of logic and functionality is highly configurable. This Learning Path aims to make you an expert in designing web applications with Spring MVC 4.

In our first module, we’ll begin with an introduction to the Spring framework. You'll then learn aspect-oriented programming. Packed with real-world examples, you’ll get an insight into how you can use Spring Expression Language in your applications to make them easier to manage and maintain.

In the second module, you'll learn everything you need to build modern Spring-based enterprise web applications. From practical development techniques and useful tools from the wider Spring ecosystem, to the new JEE standards, the impact of JavaScript, and even the Internet of Things, you'll feel confident that you can deploy Spring for an impressive range of creative purposes.

In the final module, you'll find out how to take advantage of Spring MVC's advanced features - essential if you are to properly master the framework. To do this you'll investigate the inner mechanics of Spring MVC, and how they tie into to the broader principles that inform many modern web architectures. With further guidance on how to test, secure, and optimize your application, as well as designing RESTful services, you'll very quickly be ready to use Spring in your next web project.

This Learning Path combines some of the best that Packt has to offer in one complete, curated package. It includes content from the following Packt products:

Table of Contents

Chapter 1: Getting Started with Spring Core
The Spring landscape
Design concepts behind Spring Framework
Setting up the development environment
Your first Spring application
Dependency Injection
Beans in detail
Hooking to bean life cycles
Container-level default-init-method and default-destroy-method
Working with bean definition profiles
Injecting properties into the Spring environment
Externalizing properties with PropertyPlaceholderConfigurer
Handling resources
Spring Expression Language
Aspect Oriented Programming
Testing with Spring
Summary
Chapter 2: Building the Web Layer with Spring Web MVC
Features of Spring MVC
The Model-View-Controller pattern
Your first Spring MVC application
Setting up a Spring MVC application
The architecture and components of Spring MVC
DispatcherServlet explained
Controllers in detail
Asynchronous request processing in Spring MVC
Working with views
Spring and Spring form tag libraries
Composing a form in JSP
Validating forms
Handling file uploads
Resolving Thymeleaf views
More view technologies
Summary
Chapter 3: Accessing Data with Spring
Configuring DataSource
Using embedded databases
Handling exceptions in the Spring Data layer
DAO support and @Repository annotation
Spring JDBC abstraction
Spring Data
Spring Transaction support
Relevance of Spring Transaction
Summary
Chapter 4: Understanding WebSocket
Creating a simple WebSocket application
STOMP over WebSocket and the fallback option in Spring 4
Broadcasting a message to a single user in a WebSocket application
Summary
Chapter 5: Securing Your Applications
Authentication
Authorization
Summary
Chapter 6: Building a Single-Page Spring Application
The motivations behind SPAs
SPAs explained
Introducing Ember.js
The anatomy of an Ember application
Working with Ember CLI
Understanding the Ember object model
Working with collections
Building UI templates using Handlebars
Handling routes
Handling UI behavior using components
Persisting data with Ember Data
Building a Taskify application
Building the API server app
Building the Taskify Ember app
Summary
Chapter 7: Integrating with Other Web Frameworks
Spring's JSF integration
Spring's Struts integration
Summary
Chapter 8: 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 9: 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 10: 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 11: 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 12: 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 13: 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 14: 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 15: 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 16: 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
Chapter 17: Mastering the MVC Architecture
The MVC architecture
MVC critics and best practices
Spring MVC 1-0-1
Using Thymeleaf
Spring MVC architecture
Spring Expression Language
Enough Hello Worlds, let's fetch tweets!
Java 8 streams and lambdas
Material design with WebJars
The check point
Summary
Chapter 18: Handling Forms and Complex URL Mapping
The profile page – a form
Validation
Internationalization
Client validation
The check point
Summary
Chapter 19: File Upload and Error Handling
Uploading a file
Translating the error messages
Placing the profile in a session
Custom error pages
URL mapping with matrix variables
Putting it together
The check point
Summary
Chapter 20: Crafting a RESTful Application
What is REST?
Richardson's maturity model
API versioning
Useful HTTP codes
Client is the king
Debugging a RESTful API
Customizing the JSON output
A user management API
Status codes and exception handling
Documentation with Swagger
Generating XML
The check point
Summary
Chapter 21: Securing Your Application
Basic authentication
The login form
Twitter authentication
Distributed sessions
SSL
The check point
Summary
Chapter 22: Leaving Nothing to Luck – Unit Tests and Acceptance Tests
Why should I test my code?
How should I test my code?
Test-driven development
The unit tests
The acceptance tests
Our first unit test
Mocks and stubs
Unit testing REST controllers
Testing the authentication
Writing acceptance tests
The check point
Summary
Chapter 23: Optimizing Your Requests
A production profile
Gzipping
Cache control
Application cache
Async methods
ETags
WebSockets
The check point
Summary
Chapter 24: Deploying Your Web Application to the Cloud
Choosing your host
Deploying your web application to Pivotal Web Services
Deploying your web application on Heroku
Improving your application
Summary
Chapter 25: Beyond Spring Web
The Spring ecosystem
The deployment
Single Page Applications
Summary

What You Will Learn

  • Set up and build standalone and web-based projects using Spring Framework with Maven or Gradle
  • Develop RESTful API applications for XML and JSON data transfers
  • Investigate Spring data access mechanisms with Spring Data Repositories
  • Generate templates for a responsive and powerful front end with AngularJS and Bootstrap
  • Authenticate over REST with a BASIC authentication scheme and OAuth2; handle roles and permissions
  • Communicate through WebSocket and STOMP messages
  • Design complex advanced-level forms and validate the model
  • Create maintainable unit and acceptance tests to secure the apps
  • Deploy the web application to the cloud in a snap

Authors

Table of Contents

Chapter 1: Getting Started with Spring Core
The Spring landscape
Design concepts behind Spring Framework
Setting up the development environment
Your first Spring application
Dependency Injection
Beans in detail
Hooking to bean life cycles
Container-level default-init-method and default-destroy-method
Working with bean definition profiles
Injecting properties into the Spring environment
Externalizing properties with PropertyPlaceholderConfigurer
Handling resources
Spring Expression Language
Aspect Oriented Programming
Testing with Spring
Summary
Chapter 2: Building the Web Layer with Spring Web MVC
Features of Spring MVC
The Model-View-Controller pattern
Your first Spring MVC application
Setting up a Spring MVC application
The architecture and components of Spring MVC
DispatcherServlet explained
Controllers in detail
Asynchronous request processing in Spring MVC
Working with views
Spring and Spring form tag libraries
Composing a form in JSP
Validating forms
Handling file uploads
Resolving Thymeleaf views
More view technologies
Summary
Chapter 3: Accessing Data with Spring
Configuring DataSource
Using embedded databases
Handling exceptions in the Spring Data layer
DAO support and @Repository annotation
Spring JDBC abstraction
Spring Data
Spring Transaction support
Relevance of Spring Transaction
Summary
Chapter 4: Understanding WebSocket
Creating a simple WebSocket application
STOMP over WebSocket and the fallback option in Spring 4
Broadcasting a message to a single user in a WebSocket application
Summary
Chapter 5: Securing Your Applications
Authentication
Authorization
Summary
Chapter 6: Building a Single-Page Spring Application
The motivations behind SPAs
SPAs explained
Introducing Ember.js
The anatomy of an Ember application
Working with Ember CLI
Understanding the Ember object model
Working with collections
Building UI templates using Handlebars
Handling routes
Handling UI behavior using components
Persisting data with Ember Data
Building a Taskify application
Building the API server app
Building the Taskify Ember app
Summary
Chapter 7: Integrating with Other Web Frameworks
Spring's JSF integration
Spring's Struts integration
Summary
Chapter 8: 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 9: 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 10: 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 11: 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 12: 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 13: 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 14: 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 15: 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 16: 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
Chapter 17: Mastering the MVC Architecture
The MVC architecture
MVC critics and best practices
Spring MVC 1-0-1
Using Thymeleaf
Spring MVC architecture
Spring Expression Language
Enough Hello Worlds, let's fetch tweets!
Java 8 streams and lambdas
Material design with WebJars
The check point
Summary
Chapter 18: Handling Forms and Complex URL Mapping
The profile page – a form
Validation
Internationalization
Client validation
The check point
Summary
Chapter 19: File Upload and Error Handling
Uploading a file
Translating the error messages
Placing the profile in a session
Custom error pages
URL mapping with matrix variables
Putting it together
The check point
Summary
Chapter 20: Crafting a RESTful Application
What is REST?
Richardson's maturity model
API versioning
Useful HTTP codes
Client is the king
Debugging a RESTful API
Customizing the JSON output
A user management API
Status codes and exception handling
Documentation with Swagger
Generating XML
The check point
Summary
Chapter 21: Securing Your Application
Basic authentication
The login form
Twitter authentication
Distributed sessions
SSL
The check point
Summary
Chapter 22: Leaving Nothing to Luck – Unit Tests and Acceptance Tests
Why should I test my code?
How should I test my code?
Test-driven development
The unit tests
The acceptance tests
Our first unit test
Mocks and stubs
Unit testing REST controllers
Testing the authentication
Writing acceptance tests
The check point
Summary
Chapter 23: Optimizing Your Requests
A production profile
Gzipping
Cache control
Application cache
Async methods
ETags
WebSockets
The check point
Summary
Chapter 24: Deploying Your Web Application to the Cloud
Choosing your host
Deploying your web application to Pivotal Web Services
Deploying your web application on Heroku
Improving your application
Summary
Chapter 25: Beyond Spring Web
The Spring ecosystem
The deployment
Single Page Applications
Summary

Book Details

ISBN 139781787126398
Paperback944 pages
Read More
From 2 reviews

Read More Reviews

Recommended for You

Spring: Developing Java Applications for the Enterprise Book Cover
Spring: Developing Java Applications for the Enterprise
$ 67.99
$ 34.00
Building Web Apps with Spring 5 and Angular 4 Book Cover
Building Web Apps with Spring 5 and Angular 4
$ 39.99
$ 20.00
Spring 5.0 Microservices - Second Edition Book Cover
Spring 5.0 Microservices - Second Edition
$ 39.99
$ 20.00
Spring Boot 2.0 Cookbook - Second Edition Book Cover
Spring Boot 2.0 Cookbook - Second Edition
$ 35.99
$ 18.00
Spring Security - Third Edition Book Cover
Spring Security - Third Edition
$ 39.99
$ 20.00
Spring 5.0 Cookbook Book Cover
Spring 5.0 Cookbook
$ 39.99
$ 20.00