Book Image

Spring 5 Design Patterns

By : Dinesh Rajput
Book Image

Spring 5 Design Patterns

By: Dinesh Rajput

Overview of this book

Design patterns help speed up the development process by offering well tested and proven solutions to common problems. These patterns coupled with the Spring framework offer tremendous improvements in the development process. The book begins with an overview of Spring Framework 5.0 and design patterns. You will understand the Dependency Injection pattern, which is the main principle behind the decoupling process that Spring performs, thus making it easier to manage your code. You will learn how GoF patterns can be used in Application Design. You will then learn to use Proxy patterns in Aspect Oriented Programming and remoting. Moving on, you will understand the JDBC template patterns and their use in abstracting database access. Then, you will be introduced to MVC patterns to build Reactive web applications. Finally, you will move on to more advanced topics such as Reactive streams and Concurrency. At the end of this book, you will be well equipped to develop efficient enterprise applications using Spring 5 with common design patterns
Table of Contents (20 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface

Validating forms input parameters


In a web application, validation of the web form data is very important, because end users can submit any thing. Suppose in an application, a user submits the account form by filling in the account name, then it could create the new account in the bank with account holder name. So, we have to ensure the validity of the form data before creating the new record in the database. You do not need to handle the validation logic in the handler method. Spring provides support for the JSR-303 API. As of Spring 3.0, Spring MVC supports this Java Validation API. There isn't much configuration required to configure the Java Validation API in your Spring web application-you just add the implementation of this API in your application class path such as Hibernate Validator.

The Java Validation API has several annotations to validate the properties of the Command object. We can place constraints on the value of the properties of the Command object. In this chapter, I have...