Let's learn to create ANNOTATIONS to validate web forms. In this video, We will develop our custom validators.
We must aware of these concepts as there is no real-world application exists which doesn't use custom validators.
There are different ways to build custom validators. Today we will develop custom validators using the JSR 303/ 349/ 380. We will use the hibernate validators / Java bean validation API as the dependency.
Our goal is here to create some annotations like @Size, @NotNull, @NotBlank. In this video, we will create an annotation called @Age to validate the age field of our project.
Below are the contents we will be covering in this tutorial.
Video Map:
⏱️TIMESTAMPS⏱️
Introduction 00:00
Bean Validation API [remaining] : 06:09
Create Custom Annotation[Theory] : 15:05
Java Retention Policy : 21:10
Custom Validation constraint[Theory] : 29:27
The 20 Minutes Challenge: 32:56
Looking into Hibernate Validator source code
@Size/ @NotBlank Source code Analysis: 34:53
Understanding the Resource bundle: 45:16
Developing @Age annotation: 55:50
Writing a validation constraint class: 01:03:27
Implementing the logic: 01:11:24
Let's Debug: 01:30:35
An important scinario : 01:36:14
Configuring properties file with our app(Analysis) 01:39:07
Adding a properties file : 01:45:35
Implementing the MessageSource bean/ResourceBundleMessageSource : 01:48:19
Implementing LocalValidatorFactoryBean :02:01:47
Wrapping up with assignment: 02:08:35