Top 10 Spring Annotations to know in 2024

Top 10 Must-Know Spring Annotations for Developers in 2024
Join this channel to get access to exclusive courses all taught by Koushik:
/ @java.brains
In this video, I delve deep into the world of Spring annotations, breaking down the top 10 must-knows for developers. Starting with @Component, @Service, @Repository to @Controller and more, I explain their importance and usage inside a Spring application. The video aims to equip developers with the know-how of annotations like @Autowired, @Value, @Configuration, @Bean, and @Transactional that enhance the development process. Also ranked are the @RestController, Request Mapping Family, and most importantly the @SpringBootApplication. Join me as we explore these critical elements of Spring and unravel how they impact your code, development process, and overall application performance making your coding cleaner, easier to read, and maintain.
00:00 Introduction to Spring Annotations
00:00 Understanding the Importance of Spring Annotations
01:25 Top 10 Essential Spring Annotations
01:48 Exploring the @Component Annotation
04:24 Diving into @Service, @Repository, and @Controller Annotations
09:16 Unveiling the Power of @Autowired Annotation
10:52 Injecting Values with @Value Annotation
15:01 Configuring Spring with @Configuration and @Bean Annotations
19:58 Managing Transactions with @Transactional Annotation
23:53 Mapping HTTP Requests with @RequestMapping and Related Annotations
23:53 Building RESTful Services with @RestController Annotation
25:47 Bootstrapping Spring Application with @SpringBootApplication Annotation
27:25 Conclusion and Feedback

Пікірлер: 112

  • @Java.Brains
    @Java.Brains6 ай бұрын

    A note on @Autowired since this is coming up a lot. Yes, constructor injection (and NOT using annotation-based wiring) is the recommended approach if it works for you. But @Autowired is still an important annotation to learn about because of two things - First, it gives you more control with things like qualifiers in scenarios where construction injection doesn't work. Second, there is a good chance you WILL see it in the code and you should know what it does.

  • @aamirakhtar3911

    @aamirakhtar3911

    6 ай бұрын

    Thank you so much sir

  • @ChooliYip

    @ChooliYip

    6 ай бұрын

    Very well presenting for these annotations. One quick question. If I use @Autowired on the field of a class while it has construtor with this field to be injected the value, does spring inject value twice to the field?

  • @forinterview2two417

    @forinterview2two417

    3 ай бұрын

    i think you will face error @@ChooliYip

  • @shridhar_rao
    @shridhar_rao3 ай бұрын

    I have around 10 years of experience in The IT Industry - mostly as a Software Web Developer. Many years ago - I guess around 2010 or 2011 approx. - I decided to learn Spring Framework. And yours was the first channel I subscribed to and watched ALL of your videos on Spring framework. You introduced me to the world of Spring Framework, And I will always be thankful to you for that! I still follow your channel - mainly to revise my concepts. Thank you for the awesome work you have been doing since more than a decade! 🙌🙏💫

  • @leithold315
    @leithold3153 ай бұрын

    Knew all these, but hearing you explain it solidifies it and fills in gaps in my knowledge. Thanks so much!

  • @abdulashiq2173
    @abdulashiq2173Ай бұрын

    Quality content, as usual. Here are a few annotations in my opinion that could be frequently used: @Qualifier - Specifies the bean to be injected when multiple beans of the same type are present @Primary - Indicates that a bean should be given precedence when multiple beans of the same type are present @EnableCaching - Enables Spring's annotation-driven caching capability (Application.java) @Cacheable - Indicates that a method's result should be cached @EnableAsync - Enables Spring's asynchronous method execution capability (Application.java) @Async - Indicates that a method should be executed asynchronously @Scheduled - Specifies methods to be executed on a regular schedule for cron jobs

  • @tanjinpeng279
    @tanjinpeng2796 ай бұрын

    Appreciate this tutorial. Is very helpful. Hope to see more Spring boot related video in the future !

  • @CaliBeast824
    @CaliBeast8245 ай бұрын

    Thank you for this video. I need to learn Spring for my job and this was a great starting point.

  • @er.sahilmd
    @er.sahilmd6 ай бұрын

    Wow i am so happy to see Koushik being back with some knowledge sharing again

  • @venkatasandeepgurram9276
    @venkatasandeepgurram92766 ай бұрын

    Greatly explained koushik . Even though i used all these annotations before i got to know more about them . Thanks for the videos .

  • @Vikashkumar-js8hb
    @Vikashkumar-js8hb5 ай бұрын

    Another conscise and informational content. Short, crisp and To the point... Keep up the good work. 😃

  • @jaime4066
    @jaime40666 ай бұрын

    Love the quality improvements of the videos!

  • @aabhasjain96
    @aabhasjain965 ай бұрын

    Thank you so much sir, keep posting and sharing your valuable knowledge with us.

  • @pmorah
    @pmorah5 ай бұрын

    The best teacher ever. Thank you a ton

  • @mariselvamdheivasigamani578
    @mariselvamdheivasigamani5786 ай бұрын

    explanations on important spring annotations are very clear and useful.

  • @svalyavasvalyava9867
    @svalyavasvalyava98675 ай бұрын

    Amazing video and a great refresher for me. Thank you infinitely ☺️

  • @fenixisalive
    @fenixisalive6 ай бұрын

    Thanks, the list was well synthesized and very well explained. The autowired one is still relevant despite the comments bellow, if you are only a spring entry level user sure it has no use, but if you want to create some things out of the box in runtime is still very appreciated.

  • @beth8able
    @beth8able3 ай бұрын

    Thank you so much for this video, loved it. It's very useful and concise explanation. Great job!!!

  • @asjjain191183
    @asjjain1911835 ай бұрын

    I leart the spring from you long back in 2011. You have been the only teacher for me for a long time. I love you.

  • @ahmedjaad4940

    @ahmedjaad4940

    4 ай бұрын

    I've been here for along time as well, I think I found him when I was a student around the same time, I still have his spring playlist videos on my machine.he is a great teacher indeed

  • @ramonwest3684
    @ramonwest36846 ай бұрын

    Great video! I’m back in the job market and taking time to audit my knowledge base, this was very affirming and helped clarify a few unknowns.

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Glad it was helpful!

  • @ShivaKumarSatakuri
    @ShivaKumarSatakuri6 ай бұрын

    Wow this is great. This is what I was telling you last week. Thank you so much for getting this done. Please do consider doing KZread shorts for most used annotations in the spring framework which you couldn't cover in this video.

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Great minds think alike! 😉 Like I said, I had this in the works. Your shorts idea is great btw. I will try to plan something.

  • @virajsh
    @virajsh6 ай бұрын

    Excellent video. I love how you can express your self so clearly.

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Glad you enjoyed it!

  • @rajkumarvb2602
    @rajkumarvb26026 ай бұрын

    Hi Koushik, thanks a lot for all your contents. Waiting for your updated Spring Boot tutorials/bootcamp! ❤

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Will upload soon

  • @tharvik1
    @tharvik16 ай бұрын

    Thanks! Very useful and appreciate the sample code snippets shown for each

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Wow thanks! Glad you found it useful ☺️

  • @venkatduvvuru8369
    @venkatduvvuru83693 ай бұрын

    I am a fan of you since 2019. Thanks for the valuable content❤

  • @LetsGetCertified
    @LetsGetCertifiedКүн бұрын

    Great video - thanks for making it!

  • @rgablejr
    @rgablejr6 ай бұрын

    Great overview!

  • @alamaiii
    @alamaiii6 ай бұрын

    THANK YOU FOR THE CLEAR AND CONCISE EXPLANATION!!!

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Glad it was helpful!

  • @funshots6499
    @funshots64996 ай бұрын

    I really like the way you teach, please do spring boot and it’s related videos more often

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Yup, thanks!

  • @hyperborean72
    @hyperborean722 ай бұрын

    awesome as always

  • @sharmarahul17
    @sharmarahul176 ай бұрын

    Excellent video! Thanks

  • @anthonydifede4510
    @anthonydifede45103 ай бұрын

    Love this channel

  • @raamch
    @raamch2 ай бұрын

    Great video on annotations in Spring. 6:10 great explanation here.

  • @shashankdesai819
    @shashankdesai8195 ай бұрын

    Nice video. It would be nice if you can come up with important annotations for each project such as spring security, spring data jpa etc

  • @ArjunKumar-zu2kl
    @ArjunKumar-zu2kl3 ай бұрын

    Very nice explanation, thanks for this video....👍👍

  • @abhishekkumarroy2815
    @abhishekkumarroy28156 ай бұрын

    always wait for your video😍😍

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Thank you so much 😀

  • @uniquestreetfood8391
    @uniquestreetfood8391Ай бұрын

    Very Useful. Please upload videos for Spring 3.0 and above. Spring security also has lot of changes. So something with all of them will be very helpful

  • @botane7538
    @botane75384 ай бұрын

    Thank you for the video

  • @gowthambhat1498
    @gowthambhat14985 ай бұрын

    Dhanyavadagalu Gurugale, love from Bengaluru🫀

  • @pankajarora5514
    @pankajarora55146 ай бұрын

    Always waiting for a next vedio.thanku fo suc a content

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    More to come!

  • @sami_yanezcarbonell
    @sami_yanezcarbonell3 ай бұрын

    very usefull ! thank you

  • @tabrezshaikh7705
    @tabrezshaikh77056 ай бұрын

    My excitement level everytime this guy uploads a video 📈📈 We need more content from you buddy 🤌

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    More to come! Thanks! ☺️

  • @anadivyas4841
    @anadivyas48416 ай бұрын

    Thank you for this informative video

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Glad it was helpful!

  • @danieljoseph1122
    @danieljoseph11224 ай бұрын

    Thank u sir

  • @victorlangat856
    @victorlangat8565 ай бұрын

    A good explanation.

  • @RobertPodosek
    @RobertPodosek6 ай бұрын

    Koushik is the man

  • @aamirakhtar3911
    @aamirakhtar39116 ай бұрын

    Wonderful video. Superb explanation

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Glad it was helpful!

  • @PR-nb4rb
    @PR-nb4rb6 ай бұрын

    Awesome work 😍

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Thank you! Cheers!

  • @prajwaltirpude8582
    @prajwaltirpude85822 ай бұрын

    Helpful summary. Ignore the haters as they will always shout at anything

  • @lucasteixeira1631
    @lucasteixeira16315 ай бұрын

    on point!

  • @Java.Brains

    @Java.Brains

    5 ай бұрын

    Thank you! 😊

  • @leithold315
    @leithold3153 ай бұрын

    Can you do a similar video for Spring Batch please? There’s a lot of confusion about what the annotations especially with the differences between Springbatch 5 and previous versions.

  • @vigneshj.m.7969
    @vigneshj.m.79696 ай бұрын

    Great Video.. I have one question.. we can use @Bean annotation in @configuration and @component class... basically is there any difference in use them in configuration and component. Could you please explain with example it would be really useful

  • @lucasteixeira1631

    @lucasteixeira1631

    5 ай бұрын

    it is more like stereotyping the class, same as using @Service and @Repository instead of only @Component, in order to tell us which is which, you know? So you could use @Component in a config file, but if you use @Configuration, you're also telling the ones who read the code, that is it a config file.

  • @robertwhite3503
    @robertwhite35036 ай бұрын

    I never use @Autowired. If you use the consructor to wire up variables, those variables are automatically wired.

  • @cool-aquarian

    @cool-aquarian

    6 ай бұрын

    🙏

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Yes, I have a pinned comment to clarify. Thanks for your comment!

  • @tschalky

    @tschalky

    6 ай бұрын

    And use the annotation for constructor injection if possible

  • @alanmangroo3656
    @alanmangroo36566 ай бұрын

    Great video!

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Glad you enjoyed it

  • @10SURA
    @10SURA6 ай бұрын

    Very informative! can you please also touch upon the below annotations ? 1.@Profile 2.@ControllerAdvice 3.@Required

  • @JamesStansell

    @JamesStansell

    5 ай бұрын

    @Profile marks a bean conditional on the value of the spring.profiles.active property. Use it sparingly because it can make it difficult to reason about the behaviour of your application in different scenarios. In particular do not scatter it throughout your entire codebase.

  • @tyler13923
    @tyler139232 ай бұрын

    excellent

  • @rajatpandey4979
    @rajatpandey49796 ай бұрын

    Excellent content

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Glad you enjoyed it

  • @aravindk4608
    @aravindk46083 ай бұрын

    What about using only configuration classes to create beans vs using annotations to register the beans. What are the pros and cons?

  • @mils3318
    @mils33186 ай бұрын

    Is there anything related to the continuation of the started JavaBrains bootcamp?

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Yes! I have Spring Core coming in a week. I'm working on an updated Spring Boot course after that.

  • @mils3318

    @mils3318

    6 ай бұрын

    @@Java.Brains Ok, thank you very much Koushik !

  • @iam_kundan
    @iam_kundan6 ай бұрын

    It is really very informative video. Thanks for the video. Just a suggestion please don't add the background music, it distracts from the content audio.

  • @DasariPrasad-jy3yz
    @DasariPrasad-jy3yz6 ай бұрын

    Could please make one Real time project by using spring boot.

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    I have a couple of playlists "Code With Me" series already. I will plan to make more!

  • @MutantBikers
    @MutantBikers6 ай бұрын

    As everyone appreciating content is very good, But audio & video are not synced...However quality is 720p but audio & video should be in a sync. Thanks for listening.

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Everything looks good to me. Can you please check again?

  • @MutantBikers

    @MutantBikers

    6 ай бұрын

    Sorry It was my Bluetooth headphones I was wearing. Because of that I felt that lag.....Now without that it's perfectly synced. Really sorry 😐

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    All good ☺️ Glad it's working fine now

  • @pushpendranamdev8920
    @pushpendranamdev89206 ай бұрын

    Why have you added this background music, it's not required in your videos sir. You are already awesome 👍

  • @exploreraadi9376
    @exploreraadi93765 ай бұрын

    Great video sir, but one request , if it's possible then do not add background music in videos , your voice doesn't seems clear some time.

  • @basavaraj2065
    @basavaraj20656 ай бұрын

    Could you please check if Quarkas is gaining attention and consider starting a series on the same please 😀👍

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Quarkus is a good alternative. But Spring Boot is pretty much monopolizing the Java backend space tbh

  • @amitpadgaonkar8830

    @amitpadgaonkar8830

    6 ай бұрын

    Quarkus would fade away as Spring native becomes mature

  • @ahmedmk534
    @ahmedmk5343 ай бұрын

    isnt Autowired deprecated ?

  • @thecreativelife7795
    @thecreativelife77956 ай бұрын

    It's better to remove the background music as it disturbs.

  • @thesilentkiller3882
    @thesilentkiller38826 ай бұрын

    @Autowired is recommended as not be used

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Yes, I have a pinned comment to clarify. Thanks for your comment!

  • @JPBelanger
    @JPBelanger6 ай бұрын

    Seems to me that having the application tell spring about itself breaks encapsulation.

  • @Java.Brains

    @Java.Brains

    6 ай бұрын

    Not so much with an annotation. Annotations are like "tags" or markers. It's not ideal but it's still way better than a compile time dependency.

  • @JPBelanger

    @JPBelanger

    6 ай бұрын

    @@Java.Brains you application still has a dependency to spring. Wiring should happen in @Configuration classes, that encapsulate the wiring. Spring does not promote this, but it's the right way to do it.

  • @prasantsaurabh4086
    @prasantsaurabh40866 ай бұрын

    He looks like satya nadella a bit except the hair

  • @Ambesh171
    @Ambesh1715 ай бұрын

    every imp annotations is cover

  • @binaramani3249
    @binaramani32493 ай бұрын

    Hotshot you are not as good as you think in Spring. There is no difference in @Service and @Component so far. Though it can be useful for pointcuts and tools. There are addtional properties for @Controller and @Repository. When Spring sees these 2 annotations then it do extra processing which is not done for @Service.

  • @nooruddinraotiwala353
    @nooruddinraotiwala3536 ай бұрын

    dont add the background music not useful!

  • @VadimChes

    @VadimChes

    5 ай бұрын

    For me it's more easy to understand with light music. So it's not the same for everybody)