From Spring 2.5 annotation-based dependency injection was introduced, which automatically scans and registers classes as Spring bean which is annotated using @Component annotation.
This means you don't declare that bean using the bean tag and inject the dependency, it will be done automatically by Spring. This functionality was enabled and disabled using context:component-scan tag.
Now that you know what does @Component annotation does let's see what does @Service, @Controller, and @Repository annotation do.
They are nothing but the specialized form of @Component annotation for certain situations. Instead of using @Component on a controller class in Spring MVC, we use @Controller, which is more readable and appropriate.
GitHub Account for Free Code download:
Follow me on FaceBook:
Instagram: techtalk_debu
LinkedIn :
if you like my video, please subscribe to my channel and share the video
Thanks & Regards,
Debu Paul
0 Comments