Posts

Showing posts with the label DTO Validation with Custom Annotation

Spring Boot - DTO Validation with a Custom Annotation

Image
In this section, we will learn how to create our own custom validator annotation in a simple Spring Boot application. * Note: This is solely a demonstration of DTO Validation with a Custom Annotation.   Creating a spring boot application First, open the Spring initializr  https://start.spring.io Then, Provide the Group and Artifact name. We have provided Group name  com.knf.dev.demo  and Artifact spring-boot-dto-validation-custom-annotation . Here I selected the Maven project - language  Java 17  -  Spring Boot 3.3.0 ,   Spring Web,  and  Validation . Then, click on the Generate button. When we click on the Generate button, it starts packing the project in a .zip( spring-boot-dto-validation-custom-annotation ) file and downloads the project. Then, Extract the Zip file.  Then, import the project on your favourite IDE.  Final Project Directory Complete pom.xml <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4.0.0&