Spring Boot - Creating Custom Annotation For Validation | InterviewQA | JavaTechie
Vložit
- čas přidán 15. 09. 2022
- In this tutorial We will understand how to create custom annotation for bean validation in spring boot
Spring boot microservice Live course Just started (Recordings available)
Hurry-up & Register today itself!
COURSE LINK : javatechie5246.ongraphy.com/
PROMO CODE : Java40
Bean validation & exception handling video link :
• Spring Boot | REST API...
GitHub:
github.com/Java-Techie-jt/cus...
Blogs:
/ javatechie
Facebook:
/ javatechie
guys if you like this video please do subscribe now and press the bell icon to not miss any update from Java Techie
Disclaimer/Policy:
--------------------------------
Note : All uploaded content in this channel is mine and its not copied from any community ,
you are free to use source code from above mentioned GitHub account - Věda a technologie
Thanks for posting. Very informative.
Owsem content & explanation, thank for you Basant your all the efforts 😍❣
Great tutorial, very helpful :)
Good content 👍helpful. Thanks sir
Followed and liked. Thank you so much.
Great content.thanks Basant..
Yor are doing a good job to pick very interesting and useful topic.
Hi
Thanks 🙏👍
Can u make a video on following list
1. How to validate a list or a map of objects
2. How to pass a validated list of allowed strings during entity creation itself.
Great and clear content
Nice lesson!
Was Helpful❤
Great , Thank you
Great content
You are a good tutor. Very clear.
Thanks you!
We are only 3K subscriber for the century let's make all quickly by sharing this content everybody will subscribe after seeing this clear eplanation
Great
thnx for this video
Good topic....nicely explained 👏 👌 👍
Thank you so much for creating such great real world example. Very very helpful for me.
I just want to request you that if you can create a video on how we can find performance issues in our application? That would be great help. I will appreciate it. Thanks again. 😊😊😊
Okay I will try that
@@Javatechie thank you so much 😊
Thanks!
Nice & simple to understand
thanks
1st like and comment ❤️
🙏👍
hello teacher, i am new to spring validation and i have encountered a problem that one of my data fields has type double and now i want to check when i enter a string or a character it will give an error format, but I have tried many times and failed, can you help me?
can anyone help me to validate xml request body against xsd
Hello basanth...the exception you are getting MethodArgumentNotValidException....i am getting that
Is the any way to to disable scripts (java script ) requesting to server or disable json (use xml configuration instead) , similarly disable JS files in rendering to client . I am assuming environment is springboot application with pure java
can you make one more video on how to use group() and payload() method by example ,it would be great help ,i searched on internet but hard time to understanding proper usecases ,if anybody knows let me know.
Please explain how to handle request reject exception.I need to handle //(doubleslashes) in url when calling the api. I don't find any solution for this please explain.
Can you tell me what is the use of @Documented? Also can you tell me what exactly those two lines you copied are doing?
Java’s is no longer included I think it the latest version of spring. If we add Java’s manually will it still work ?
Same way one to many relationships, can you try once.. it will help
Hi vinodh already i uploaded this please check czcams.com/video/8qhaDBCJh6I/video.html
@@Javatechie sorry may be not understood.. I'm asking one to many relationships using validator. Many relationships not working validation. Can you try once
Ohh okay got you
Awesome content sir. Can we validate response body also?
Yes we validate but the approach is not the same we need to use aop advice
@@Javatechie thank you sir for giving me direction.
Sir if it is possible, please upload one video for response validation also. In my current project I am dealing with lot of third party apis response and I need to validate them. It will be great help if you upload one video.
Can we use @Pattern(regexp=“^[EMPLOYEE|VENDOR|CONTRACTOR]”)? It will be simple and one line instead of creating custom validation?
We can use pattern but it's not recommended you can use enum for fixed values and you can check
You can, but will you add this every time you need to perform this validation ?
If in future you need to add 1 more value to the pattern, you will have to change this pattern in every single place you have used this.
@@ShinAkuma Thanks for good example
Great video, just one question. Is the Javax bean validation and Jakarta bean validation same dependencies? The annotation is working with javax but not with jakarta. I checked maven repository and there it was mentioned that "Note Javax artifact was moved to Jakarta.validation ".
Not sure buddy needs to check.
yeah they moved all the classes of javax to jakrata now
Javax validation doesnt work now......To discover this I almost spent my whole day today
It should work . Will check and update
Can we use property file to read messages
Yes you can use
Hi Sir we have Employee class in dto we are using @notnull and @not empty ...it's working fine for all fields ...but my scenario is suppose if the user send pay load to controller based on user dept type I want to check only first and last name and for second user i dont need to check names but I need to check only email and password....is it possible here to validate like that or we need to write logics separately ?
In this case always it will check the values for entire Employee class
Can u plz advise ...thanks for the video
I know this is old but you can put your logic in the validator itself, you’ll have access to the object so you can check however you like
have you got any solution for this?
@@samirpanda1147 there’s a way to validate using code, and annotation. I forgot what it’s called but basically you get access to the fields using this validator so you can check for nulls or do whatever you need to do.
Let me see if I can find out the proper term.
Cant we simply make the field as enum itself, it will do the work
Yes you can but user might give wrong value
create a video for validating List of object in springboot.
List of objects means you are talking about List employees or List
@@Javatechie Employee
Approach is the same only you need to pass an argument as a list of employees in the controller class that's it .
@@Javatechie i got a list of json request from client and if i have a controller for handling list of (suppose employee) object but my validation is for bean . when i validate it does not give the expected output . the response i am getting is also in the list of object.
THE Approach you told does not work i have tried .
@javatechie is this validation included in your springboot course
Yes I believe
@@Javatechie under which section
Bean validation
@@Javatechie thank you
hi please add subtitle
It will auto enabled