Chapter 1 - Setting up a Spring web application in no time

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! ...

March 1, 2015 · 2 min · Geoffroy Warin

Chapter 2 - Mastering the MVC Architecture

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. ...

March 27, 2015 · 2 min · Geoffroy Warin

Chapter 3 - Handling forms and complex URL mapping

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? ...

March 27, 2015 · 1 min · Geoffroy Warin

Chapter 4 - File Upload and Error Handling

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. ...

March 27, 2015 · 1 min · Geoffroy Warin

Chapter 5 - Crafting a RESTful application

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. ...

June 13, 2015 · 1 min · Geoffroy Warin

Chapter 6 - Securing your application

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 ...

June 13, 2015 · 2 min · Geoffroy Warin

Chapter 7 - Leaving nothing to luck with unit and acceptance tests

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. ...

June 13, 2015 · 2 min · Geoffroy Warin

Chapter 8 - Optimizing your requests

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. ...

June 13, 2015 · 1 min · Geoffroy Warin

Chapter 9 - Deploying to the cloud

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. ...

June 13, 2015 · 1 min · Geoffroy Warin

Writing a book on Spring MVC 4

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. ...

February 2, 2015 · 1 min · Geoffroy Warin