Generic JavaBeans Validation: Difference between revisions
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
This article documents a runnable Java example uses JavaBeans Validation annotations to externalize validation logic to a JavaBeans [[Bean_Validation#Validation_Provider|validation provider]]. The example depends on [[Spring Boot]], but this is only because we use Spring Boot's machinery to pull starter dependencies, including Hibernate Validator, and get our runtime running. There is nothing Spring-specific that would prevent the same example working in a generic Java environment with JSR-303 support. | This article documents a runnable Java example uses JavaBeans Validation annotations to externalize validation logic to a JavaBeans [[Bean_Validation#Validation_Provider|validation provider]]. The example depends on [[Spring Boot]], but this is only because we use Spring Boot's machinery to pull starter dependencies, including Hibernate Validator, and get our runtime running. There is nothing Spring-specific that would prevent the same example working in a generic Java environment with JSR-303 support. | ||
=Approach= | =Approach= |
Revision as of 17:00, 16 October 2018
External
Internal
Overview
This article documents a runnable Java example uses JavaBeans Validation annotations to externalize validation logic to a JavaBeans validation provider. The example depends on Spring Boot, but this is only because we use Spring Boot's machinery to pull starter dependencies, including Hibernate Validator, and get our runtime running. There is nothing Spring-specific that would prevent the same example working in a generic Java environment with JSR-303 support.
Approach
Spring Boot Starter Dependencies
The simplest way to get the project started is to use Spring Initializr and select "Validation":
dependencies {
implementation('org.springframework.boot:spring-boot-starter-validation')
}