Spring Validation Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 9: Line 9:


=Bean Validation in Spring MVC=
=Bean Validation in Spring MVC=
Applying bean validation in Spring MVC consists of:
# Declaring validation rules on the domain model data class that is to be validated.
# Designate [[Spring MVC Concepts#Controller|controller]] methods for which validation should be performed.
# Configuring the form views to display validation errors.


=TODO=
=TODO=

Revision as of 04:47, 12 October 2018

Internal

Overview

Spring supports Bean Validation API (JSR-303) which allows to declare validation rules as annotations, as opposed to explicitly writing validation logic in the application code. The Bean Validation API and the Hibernate implementation of the Validation API are automatically added to the project as transient dependencies of the Spring Boot web starter.

Bean Validation in Spring MVC

Applying bean validation in Spring MVC consists of:

  1. Declaring validation rules on the domain model data class that is to be validated.
  2. Designate controller methods for which validation should be performed.
  3. Configuring the form views to display validation errors.

TODO

TODO: