Hello, dear visitor! I think I have an idea of what you want…
You want to learn how to create a complete Spring web application with
oauth support, security, file upload and distributed sessions.
You want to master the principles of REST and develop a clean API with top-notch
exception handling and following the best practices.
You also want to deploy it in the cloud and for it to be fully tested with
both unit and end-to-end tests.
What a coincidence! I just wrote the book
you are looking for!
If you want to have a look at what you will be building,
its source code is available on GitHub
and it is deployed on heroku
I just finished writing the first chapter of Mastering Spring MVC 4. That was a lot of fun. I enjoyed sharing the tips and tricks that I use when I bootstrap a Spring application.
In this first chapter, you will learn how to get started with spring MVC in a snap.
Know thy tools Have you heard of Spring Tool Suite? Do you know start.spring.io? Did you know you could actually curl start.spring.io?
You will learn all that and much more in this action-packed first chapter!
...
I was so busy writing the third chapter of Mastering Spring MVC 4, I did not take the time to write about chapter 2.
In this outstanding chapter you will learn the principles of the MVC Architecture. We will also be discussing good practices, the basis of Domain Driven Design and the trade-offs this kind of design imply on a Spring MVC architecture.
A good read on the subject is available on Petri Kainulainen’s blog.
...
The third chapter of Mastering Spring MVC 4 is about the cornerstone of web application: forms. Oh boy, what a chapter.
In this epic piece of literature, we will create a complete profile form like this one:
We will discuss forms, validation, conversion and formatting.
See the birth date field up there? That’s a java.time.LocalDate. Do you wonder how to make it work with Spring MVC?
...
In the fourth chapter of Mastering Spring MVC 4 We will allow the user to upload his profile picture.
The file upload component implies handling errors at two levels: I/O exceptions at the controller level and multipart exception (a file too big, for instance) at the container level.
If your curious about this part take a look at this stackoverflow question.
This will give us the opportunity to discuss error handling in Spring MVC and Spring boot.
...
In this chapter of Mastering Spring MVC 4, we’ll tackle main principles of a RESTful architecture. We’ll learn how to convert data to JSON and handle different media types in the application.
We will use the JSR-310 (Java DateTime) spec from the get-go and see how to handle them properly in your MVC application.
Forever RESTful We will see how REST works in theory: HTTP codes and verbs, API versioning, HATEOAS, etc.
...
In this chapter of Mastering Spring MVC 4, we’ll learn how to secure our web application and also how to cope with the security challenges of modern, distributed web applications.
This is a parts chapter:
First, we will set up basic HTTP authentication in a minute Then, we will design a form-based authentication for the web pages, keeping the basic authentication for the REST API We will allow the users to signup via the Twitter OAuth API Then, we will leverage Spring Session to make sure our application can scale using a distributed session mechanism Last, we will configure Tomcat to use secured connection through SSL ...
In this chapter, we will make sure our application never regresses thanks to a handful of unit tests.
To test or not to test? Chapter 5 is by far my favorite chapter of Mastering Spring MVC 4!
In this uplifting piece of literature, you will learn more about testing best practices: TDD, the pyramid of tests, unit tests and end-to-end tests.
We will see the difference behind mocking and stubbing and use mockito and the power of Spring’s IOC to study both options.
...
In this chapter of Mastering Spring MVC 4, we will implement classic ways of optimizing a web application: cache control headers and Gzipping.
We will also use Spring’s cache abstraction and ETags.
More threads, please You will learn how to create asynchronous services with Spring Async.
Spring Async is a nice part of Spring, if you want to dig deeper see [this article]({% post_url 2015-06-12-completable-futures-with-spring-async %}) where we use Java 8 CompletableFutures to create a multithreaded application.
...
In this chapter of Mastering Spring MVC 4, you will deploy your application on the cloud and invite the whole world to see!
We will see how to deploy our application on two popular PaaS: Cloud Foundry and Heroku.
A big thank you to Wayne Lund at Pivotal who wrote the Pivotal Web Services part!
Know your options We will have a look at the different PaaS providers, then I will guide you through the steps of deploying your application on Cloud Foundry and Heroku.
...
Good news everyone!
After reviewing the awesome Learning Spring Boot by Greg Lee Turnquist, Packt Publishing asked me to write a book of my own on Spring MVC 4.
Of course I said! I just signed the contract and I’m getting ready for five months of intense writing with a publishing date somewhere around the last quarter of 2015.
I’m glad to seize this opportunity to answer the questions you guys have been asking me after the publication of [my article on spring MVC]({% post_url 2013-01-23-complete-example-of-a-spring-mvc-3-2-project %}) last year.
...