Gain expertise in designing real-world web applications using the Spring MVC framework
About This Book
- Design your own Spring web applications using tools such as Spring Boot and Spring Tool Suite
- Secure your developments with easy-to-write, reliable unit and end-to-end tests
- Deploy your application on the cloud for free and invite the whole world to see
Who This Book Is For
This book is perfect for developers who are familiar with the fundamentals of Spring programming and are eager to deepen their web development skills. Prior knowledge of the Spring MVC framework is recommended.
What You Will Learn
- Set up your own web application using Spring Boot and Spring Tool Suite
- Discover the MVC architecture and the different tools along with navigating between views
- Design complex advanced-level forms and validate the model
- Craft a RESTful application with a meaningful API and error messages
- Create maintainable unit and acceptance tests
- Secure your application while allowing it to scale
- Optimize your requests with caching, ETags, and asynchronous responses
- Deploy the web application to the cloud in a snap
Spring MVC is the ideal tool to build modern web applications on the server side. With the arrival of Spring Boot, developers can really focus on the code and deliver great value, leveraging the rich Spring ecosystem with minimal configuration.
Spring makes it simple to create RESTful applications, interact with social services, communicate with modern databases, secure your system, and make your code modular and easy to test. It is also easy to deploy the result on different cloud providers.
Mastering Spring MVC will take you on a journey from developing your own web application to uploading it on the cloud.
You begin by generating your own Spring project using Spring Tool suite and Spring Boot.
As you develop an advanced-level interactive application that can handle file uploads as well as complex URLs, you will dive into the inner workings of Spring MVC and the principles of modern web architectures.
You will then test, secure, and optimize your Spring web application and design RESTful services that will be consumed on the frontend.
Finally, when everything is ready, you will release your application on a cloud provider and invite everyone to see.
Style and approach
An iterative hands-on approach in a conversational and easy-to-follow style. Each chapter will improve on the work done in the previous one until the application is ready to be released.
Table of Contents
Mastering Spring MVC 4
- Table of Contents
- Mastering Spring MVC 4
- About the Author
- About the Reviewers
1. Setting Up a Spring Web Application in No Time
- Getting started with Spring Tool Suite
- Getting started with IntelliJ
- Getting started with start.Spring.io
- Let's get started
- Spring Boot behind the curtains
- Error and encoding configuration
- Embedded Servlet container (Tomcat) configuration
2. 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
- 3. Handling Forms and Complex URL Mapping
- 4. File Upload and Error Handling
5. 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
- 6. Securing Your Application
7. 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
- 8. Optimizing Your Requests
9. 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
- 10. Beyond Spring Web
- Title: Mastering Spring MVC 4
- Release date: September 2015
- Publisher(s): Packt Publishing
- ISBN: 9781783982387