Annotations In Java Tutorial - How To Create And Use Your Own Custom Annotations

  Рет қаралды 262,066

Coding with John

Coding with John

Күн бұрын

Пікірлер: 320
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Thanks to Mailgun for sponsoring this video! Head to mailgun.com/john to try Mailgun today. As a few commenters have mentioned, I forgot to note that you can also use enums as an annotation parameter. Let me know if you guys have other questions about annotations!
@TakeshySun
@TakeshySun 2 жыл бұрын
Streams and Optional :) And thank you :)
@shlack
@shlack 2 жыл бұрын
I was wondering, can we actually make annotations like in python where you would annotate a method so that something runs before and/or after the method has ran ?
@TakeshySun
@TakeshySun 2 жыл бұрын
@@shlack Did you ask for junit ? If not just read about listeners in java, it could help you
@TakeshySun
@TakeshySun 2 жыл бұрын
@Henryk Zschuppan config reader, good point for tutorial.
@hzlcrpz887
@hzlcrpz887 2 жыл бұрын
Hi John, thank you for your videos, I'm not a programmer, I'm just an enthusiast and I want you to know what your videos are really helpful and worth watching.
@xslicer5779
@xslicer5779 2 жыл бұрын
Would be nice to see a part 2 where you have a preprocessor for the annotation so you won't have to write logic for a specific objcet to process the annotation, but instead to be processed where you apply it.
@leetaeryeo5269
@leetaeryeo5269 2 жыл бұрын
I was just gonna come here to suggest that. It would be cool to see something like an annotation for a field that generates getters/setters (I know this isn’t something you’d actually build, but just an example) or maybe a method timer that logs how long a decorated method takes to execute. Basically, it’d be nice to see an example that shows an executable use, in addition to the flagging and data storing usage.
@ralfiasz
@ralfiasz 2 жыл бұрын
Man I second that! That would be great to learn!
@fenigrini
@fenigrini 2 жыл бұрын
I think a good idea, is to implement a anotaciones to prevent null on getter or setter
@szalaytamas3184
@szalaytamas3184 2 жыл бұрын
Yeah. This way it's just pointless.
@leetaeryeo5269
@leetaeryeo5269 2 жыл бұрын
@@szalaytamas3184 now, let’s not go that far. There is definitely a use to these style of annotations. An actor model driven architecture can use these sorts of annotations to find and track which sorts of things to observe, for example. And a testing framework can use these sorts of annotations to mark which methods to test.
@sadeepaalwis5938
@sadeepaalwis5938 2 жыл бұрын
i always struggled with annotation when creating my custom ones without understanding it completely thank you very much john for this awesome explanation.
@atomiccoding
@atomiccoding 2 жыл бұрын
Although I have been working as a Java Software developer for more than a year, I learn something new from your videos all the time. Thanks for the tutorials. I wish I had such a Team Lead as you or worked in your team.
@codewithenthronekingsley
@codewithenthronekingsley 6 ай бұрын
Dear John, you are something else. All your tutorials are just great. Very well simplified, straight to the point, very educative and really impactful. I have learnt a lot from you. Infact, I always read a minimum of 10 articles on the internet about a particular topic am learning at any time, watch 10 KZbin tutorials on that topic from different tutors. I always use your tutorial to drive that concept deep in my spirit. Each time I watch your tutorial, I get a signal from my spirit saying "Enthrone" you have successfully sink this in. Keep it up man. A big fan from Nigeria West Africa.
@Pierre-wl9gf
@Pierre-wl9gf 2 жыл бұрын
I love the way you explain in your videos. It is always clear and understandable. Most of all I always learn something. Thank you man. Greetings from France.
@doud7072
@doud7072 2 жыл бұрын
Ouais on a pas des tutos comme ça nous...
@Speiger
@Speiger 2 жыл бұрын
I actually have a interesting case for Annotation. I am writing a pretty big mod that is synchronizing fields automatically through networking. So you just have to request the field name to be synchronized. What you have to do is add the "@NetworkField" Annotation to the Field and it will be automatically mapped to the networking manager. Which allows me to compress information down to 1 byte instead of having to write down the fields name, since they are automatically mapped I just write down the Index it was mapped to and send the data over with the index to then use that info to gather the index automatically. Another usecase is for plugins where a Annotation is the Indicator where a class might be a plugin. Which allows you to make modding support super easy for you or other people.
@GhostlyDream
@GhostlyDream Жыл бұрын
I have been reading books and some articles on internet all day, and just watched this video... In 20 minutes I've understood much more then in the whole day Thank you very much!🙏
@elcaballopapi
@elcaballopapi Жыл бұрын
Finally someone who explains this in a clear way. Thank you John
@misaelpereira9679
@misaelpereira9679 2 жыл бұрын
Java is a beatifull language❤️
@pinklemonade8444
@pinklemonade8444 Жыл бұрын
lmfao
@savire.ergheiz
@savire.ergheiz Жыл бұрын
So beautiful it will confuse you with all these annotation bs 😂
@kiyat040
@kiyat040 Жыл бұрын
its fucking awesome. people meme on it too much.
@jameschristenbury2625
@jameschristenbury2625 Жыл бұрын
It's certainly my cup of java, lol
@javapoet
@javapoet Жыл бұрын
❤ Java
@vijaybhadoliya8789
@vijaybhadoliya8789 2 жыл бұрын
I read the title of the video: Start watching after completing 30% of the video: Liked reached the 70% mark: Subscribed. Thanks a ton.
@chtulurr
@chtulurr 2 жыл бұрын
The moment I made the code work, you also showed Stella on the screen and it was the best payoff I have ever had aaw. Thanks for the videos, they have been great help for me for an interview preparation. Very clear explanations and examples.
@ragore7947
@ragore7947 2 жыл бұрын
Hey John, thanks for all [public static final] videos. Please continue doing the good work.
@girirajtomar519
@girirajtomar519 Жыл бұрын
The way you teach any concept is just amazing.
@fc6827
@fc6827 2 жыл бұрын
Thank you so much for this. I was especially surprised at how much reflection was required for processing!
@muhammedahmed3386
@muhammedahmed3386 2 жыл бұрын
The best explanation I have seen covering Java annotations thank you
@LucasBarbosaMusico
@LucasBarbosaMusico 2 жыл бұрын
Even when I watch a video that I already know about, I can learn something new. Thank you John!
@shady5063
@shady5063 2 жыл бұрын
Can you please make a course on Spring boot, possiblty also incorporate databases with it and such. Your way of teaching is just unbeatable tbh...
@CodecrafterArtemis
@CodecrafterArtemis 2 жыл бұрын
Thank you for explaining custom annotations in such a straightforward way.
@user-qg1qg2vi4c
@user-qg1qg2vi4c 2 жыл бұрын
Awesome! I didn't even know that you can handle object methods and object variables this way! Thank you so much!
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
Yeah reflection is something. Like magic methods etc. In python.
@shoaibhasan5620
@shoaibhasan5620 2 жыл бұрын
Please john make a spring boot series. I really like the way you tech. I will love to learn spring boot from you. Specifically if you make a monolithic application from the scratch then move to microservices part. We the followers of yours looking forward to it. So much love and respect for you.
@maheshrphulse
@maheshrphulse 2 жыл бұрын
Hi! John, I love the way you teach difficult topics with a hint of fun and humour, and that makes your videos effortless to understand. Could you please make your next video on regular expressions?
@satyasarma2458
@satyasarma2458 Жыл бұрын
Wow.! its crystal clear explanation..!
@rodNantz
@rodNantz Жыл бұрын
This video is about a not-so-trivial subject and still is so clear that it seems easy ✌ so great
@labochi90
@labochi90 2 жыл бұрын
Never leave me john.
@simonrozendal7542
@simonrozendal7542 2 жыл бұрын
Thank you very much John! I like to develop in Java very much. But today i learned something new. I like learning on a practical way very much, keep on the good work. Because there are not enough people where we can learn good things like this. I'm now a fan of your work.
@theaftermath98
@theaftermath98 Жыл бұрын
best teacher for beginners and advanced.......even better than mosh
@prathapdudvat8635
@prathapdudvat8635 2 жыл бұрын
So Simple , Crisp and Clear Explanation - with extra flavour of where to use it and where not to use. thank you very much
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
I'm just amazed about how much more there is to learn and then apply it.
@superman5810
@superman5810 2 жыл бұрын
Hands down the best Java guru here on KZbin!! 👌
@DominikGuzowski
@DominikGuzowski 2 жыл бұрын
I was literally in the shower thinking about what you could do as the next topic, and then an older video of yours about arrays popped up in my recommendations, and I wanted to check if you posted a video which I might've missed, and bam.
@Pilosofia
@Pilosofia 2 жыл бұрын
I'm not a java developer but I enjoyed your content.
@libertymedicalcommunicatio4908
@libertymedicalcommunicatio4908 2 жыл бұрын
Good stuff. Congratulations on the sponsorship
@shiz4849
@shiz4849 2 жыл бұрын
I need a complete regular expressions tutorial to create "IP filters". The way you teach us is amazing
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Not sure when exactly I'll be able to get to it, but it's on the list!
@suwatchainanchai6637
@suwatchainanchai6637 Жыл бұрын
here again thanks alot for clarifying thing in the simplest term with an example. when using annotation alot in work. It really fascinating how the background thinggy work. Best Basic Java instructor in YT.
@mohammadobeidat5685
@mohammadobeidat5685 Жыл бұрын
You're legend in explaining things, many thanks man.
@Felipe-yr5gm
@Felipe-yr5gm 2 жыл бұрын
John, I need to say... Your videos are freaking awesome! Excellent explanation. Could you bring more content about collections and how they work in deep, please?
@rewrose2838
@rewrose2838 2 жыл бұрын
Man am I glad I found your channel, I was going crazy tying to learn Java from other videos. (I was actually about to give up and switch to Js lol)
@flexerfadrigalan
@flexerfadrigalan Жыл бұрын
John! You have amazing presentations and I am all for it. I went to subscribe right away, only to figure out I already am! Thank you for pumping out these videos. They are so helpful!
@fabriziodefelice8330
@fabriziodefelice8330 2 жыл бұрын
I love the trick of "instance of"
@takony1994
@takony1994 2 жыл бұрын
Stella is such a beautiful cat
@Teddy0611
@Teddy0611 2 жыл бұрын
Hi John ! Thanks for all your videos. Your explanations are very precise, crystal clear and whenever I have a question, you answer it a few seconds later. Thanks a lot ! I was looking for a video on java Streams which is a totally new subject for me. Your explanations on this would be really helpful. Thanks again for your work !
@cjamith
@cjamith 2 жыл бұрын
Thanks John. It was short yet comprehensive.
@michaelfaraday2657
@michaelfaraday2657 5 ай бұрын
Best video about this topic I've ever seen!
@mahoneg
@mahoneg 2 жыл бұрын
John - I know it is said a lot in here but I love your explanations. Even if I know the topic it is still great to watch
@elvenpath7
@elvenpath7 2 жыл бұрын
Nice.. very clear explanation. Thanks !
@andtif
@andtif Жыл бұрын
John you're an absolute LEGEND for the way you explain complex things in a simple way. Please continue being you and do what you're doing. Would love to see some more advanced Java topics as others has mentioned with annotations and reflection! What you've described in this video is also, what I assume, closely related to Aspect Oriented Programming or IS in all practical sense, AOT?
@shankar7435
@shankar7435 2 жыл бұрын
Thanks for such a quality explanation of Annotations.
@abdullohmaraimov2022
@abdullohmaraimov2022 Жыл бұрын
The best explanation ever. Thanks
@spoomer94
@spoomer94 Жыл бұрын
1:37 beginning
@nikosdapergolas9430
@nikosdapergolas9430 2 жыл бұрын
Great video man! I would love to see a tutorial on reflection one day!! It seems very interesting
@annarozou4821
@annarozou4821 2 жыл бұрын
Thanks, John! Would love to see a lesson on Stream API for processing collections of objects.
@helk00
@helk00 2 жыл бұрын
Thanks John! Would love to see a lesson on regular expressions (patterns)
@gurudatt-shahane
@gurudatt-shahane 2 жыл бұрын
Thank you for making this video. Your content is really provides a great value for those who are not privileged to afford high pricey courses and even they will not teach you this way. Love from my heart for your dedication ❤️❤️
@ganeshbodduaddasuryanitinb7811
@ganeshbodduaddasuryanitinb7811 2 жыл бұрын
Excepting part 2 with real time example scenarios. 😊
2 жыл бұрын
Thank you, John!
@KMJMusic
@KMJMusic 2 жыл бұрын
Heyo, you forgot to say, for parameters, you can use also Enums (without that Retention and Target Annotations would not work). Btw i love your videos, you have nice way to explain complicated things in few minutes understandable and then it seems pretty easy. Please dont stop with vids
@aminesafi7261
@aminesafi7261 2 жыл бұрын
Excellent video about implementing a custom annotation, great content, keep going!
@indel0425
@indel0425 2 жыл бұрын
Great video! Can you do separate video on getClass and Reflection? Also, can you do series on dependency injection.
@Devivl
@Devivl Жыл бұрын
Thank you, John! Your videos are very helpful.
@AmitCodes
@AmitCodes 8 ай бұрын
mast explain kiya John bhai
@vaclavvlcek4527
@vaclavvlcek4527 2 жыл бұрын
Hi John, this is a great tutorial, thank you for that!
@konstantinkotsev
@konstantinkotsev Жыл бұрын
Thank you for the clear explanation. Can you explain why we can't use our own Type in the Annotation, but instead we can define them as enum or Class?
@ManosSef
@ManosSef Жыл бұрын
Because if you were able to use your own type, you would have no way to specify a value for that element in an annotation, since you can't run methods or instantiate objects in an annotation. So for example, if you could have an annotation called Anno that takes in a value of type Cat, annotating something with it would require you to write @Anno(value = new Cat()), which is impossible, since element values aren't supposed to run logic, but can only use constant values.
@AnatolyLeonov
@AnatolyLeonov Жыл бұрын
Nice and simple explanation. Thanks!
@annagre4804
@annagre4804 2 жыл бұрын
awesome as always, your presention is so nice, thanks for sharing!
@yfidalv
@yfidalv 2 жыл бұрын
Been really enjoying the videos! Could you please do a video on the “static” keyword? :)
@powertester5596
@powertester5596 Жыл бұрын
Your videos are gold! You are a very gifted teacher :-).
@DarKodama
@DarKodama Жыл бұрын
Thank you very much for this explanation!
@huseyinkadioglu
@huseyinkadioglu 2 жыл бұрын
Great video and you explain the consepts very well! Now, you have one more subscriber. Greetings from Turkey!
@maiscarlos
@maiscarlos Жыл бұрын
Awesome as always! Thanks for sharing!
@wayneinteressierts9973
@wayneinteressierts9973 Жыл бұрын
Hey John! As always, very nice video. I always enjoy to watch your videos. Thanks for each and every one of them. In general, even if only briefly, could you talk about what books you would recommend, especially for beginners, on one subject or another. I know it is very individual. I would still be happy about your recommendation. I’m a beguines to programming and totally a fan of your way of explaining things. Thanks again for all your work.
@__-zv4qn
@__-zv4qn 2 жыл бұрын
Thank you so much! Finally i figured it out...
@PavelBader
@PavelBader 2 жыл бұрын
Thanks a lot, John! Very useful tutorial.
@alessioantinoro5713
@alessioantinoro5713 2 жыл бұрын
It would be awesome if you did a video about annotation processors! There are not much tutorial online, and the one there are mostly use external libraries
@manojpal8337
@manojpal8337 2 жыл бұрын
What probably be production Use case for Custom Annotations. I can think of Initialisation and closing of connection
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
We have found them useful particularly for annotating controller methods, to make it easy to accomplish things like validations that can be common to many, but not all of our endpoints. For example authorization, validation for particular header values, etc.
@abdelkaderkaouane1944
@abdelkaderkaouane1944 2 жыл бұрын
It is a pleasure to watch your videos
@deopping
@deopping Жыл бұрын
I'm mostly curious about how you'd implement custom annotations into your projects. Such as, why would you use them specifically, or how would you use them? Would you only use them on a specific class object? Because you'd have to loop through it using reflection? Or what if you have a class annotation, how would you check if a specific class is annotated without already knowing which class you add the annotation to? And if you already know that class is going to be annotated, why annotate it?
@pradeep1198
@pradeep1198 2 жыл бұрын
you are awesome ❤️ Best teacher 😘 I like your teaching very much ❤️❤️❤️❤️❤️❤️❤️❤️
@labochi90
@labochi90 2 жыл бұрын
How can we specify behavior in annotations? I have seen this before but I have no idea how to apply it! Thank you John for your videos!
@jannickvieluf
@jannickvieluf 2 жыл бұрын
Hey, thank you for this video. I was always interested in annotations but never had the motivation to look at them. I also would like to have a video about the Factory Design Pattern.
@MikairuEichdy
@MikairuEichdy 2 жыл бұрын
Thanx! Great and simple tutorial
@nathanwang9363
@nathanwang9363 2 жыл бұрын
what a great video! i think i've learned a lot from it!
@Shraddhasree-w7b
@Shraddhasree-w7b Жыл бұрын
Hi John, Loved the way you teach. Please add a Java full stack or Spring boot series as well
@saadmansakib6612
@saadmansakib6612 11 ай бұрын
Excellent video John!
@siavashnourmohammadi9189
@siavashnourmohammadi9189 Жыл бұрын
thank you alot dear John
@prashantbalotra
@prashantbalotra 2 жыл бұрын
Amazing, Nice and easy explanation!
@karankondhia3963
@karankondhia3963 Жыл бұрын
John is the flipping MVP
@quadrarilific
@quadrarilific 2 жыл бұрын
I really enjoy your videos!!! I learn something new everyday with your videos all the time :) Also can I request on how to do method referencing? I really confuses and there's not good tutorials on youtube. Thanks!!!
@techknowgemes7860
@techknowgemes7860 Жыл бұрын
tiniest sweetest little cat😄😍
@matimozg
@matimozg Жыл бұрын
I don't knew this syntatic sugar after instanceof, thanks!
@hunelysium
@hunelysium 2 жыл бұрын
Hello John Thank you for making this great video!! I always enjoyed your video, and learnt a lot from them. I watched this video, and not sure if this knowledge point is supposed to be pretty complicated, didn’t fully grasp like I did with all of your previous videos. I guess this annotation is supposed to be kind of hard! Thank you for sharing your knowledge with us!! :-)
@innocentomoyibo6312
@innocentomoyibo6312 Жыл бұрын
Thank you so much for this video honestly!!
@francksgenlecroyant
@francksgenlecroyant 2 жыл бұрын
Thanks John, it's helpful
@giuzp95
@giuzp95 Жыл бұрын
This will be handy when I write my own ORM.
@hamdamboy4398
@hamdamboy4398 Жыл бұрын
Nice explanation John.
@ocgjlm
@ocgjlm 9 ай бұрын
thank you for this great explaination
@johnkeck
@johnkeck 2 жыл бұрын
Very good, John: thanks!
@dominikajasinska2744
@dominikajasinska2744 3 ай бұрын
Love your video's 😊 Thanks a lot! 💯
@mohammed-usama
@mohammed-usama 2 жыл бұрын
Hi John, your video are very helpful. Can you please make a video about JRE, JDK and JVM
@nightscrape3670
@nightscrape3670 2 жыл бұрын
Every video i watched from your channel has been easy to follow along and understandable. Is there going to be Spring tutorials in the future? Keep up the amazing work!!
@TheWalace10
@TheWalace10 10 ай бұрын
Thank you for this!!
Optionals In Java - Simple Tutorial
15:53
Coding with John
Рет қаралды 220 М.
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,6 МЛН
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 13 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 34 МЛН
Java Unit Testing with JUnit - Tutorial - How to Create And Use Unit Tests
21:35
5 Signs of an Inexperienced Self-Taught Developer (and how to fix)
8:40
The Full Guide to ANNOTATIONS In Kotlin
21:32
Philipp Lackner
Рет қаралды 32 М.
Top 10 Spring Annotations to know in 2024
26:41
Java Brains
Рет қаралды 90 М.
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1,1 МЛН
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 836 М.
Java Reflection Explained - bɘniɒlqxƎ noiɟɔɘlʇɘЯ ɒvɒᒐ
20:07
Coding with John
Рет қаралды 190 М.
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 555 М.
Checked vs. Unchecked Exceptions in Java Tutorial - What's The Difference?
10:14
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,6 МЛН