Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

validator-example

A Spring Boot 2 application that demonstrates how to customize the Hibernate Validator.

Specifically, this example configures a ClockProvider, and sets the hibernate.validator.temporal_validation_tolerance global property.

This allows for a margin of error, due to out of sync clocks for example, when validating temporal constraints such as:

javax.validation.constraints.Past
javax.validation.constraints.PastOrPresent
javax.validation.constraints.Future
javax.validation.constraints.FutureOrPresent

Running the tests

This example also demonstrates how to mock a ClockProvider during unit testing. Use the following command line to execute the tests:

./gradlew clean test 

References

  1. Hibernate Validator: 9.2.5. ClockProvider and temporal validation tolerance

  2. Spring Framework Reference: Configuring a Bean Validation Provider

  3. Spring Framework LocalValidatorFactoryBean Javadoc

About

A Spring Boot 2 application that demonstrates how to customize the Hibernate Validator.

Resources

License

Releases

No releases published

Packages

No packages published

Languages