Important Interview Question of Spring annotation : @Component, @Controller, @Repository & @Service

preview_player
Показать описание
#Component #Controller #Repository #Service

► SUBSCRIBE & LIKE!!

► Important Information and code guide available bottom of the Description section

► Download the sample java microservice application :

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
► Here is our amazing playlist for Core Java, Spring MVC/Boot, Git and Microservice
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Watch my "Most Watched Videos"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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.

Instagram: techtalk_debu

if you like my video, please subscribe to my channel and share the video

Thanks & Regards,
Debu Paul
Рекомендации по теме
Комментарии
Автор

Thank you sir, i have been looking this topic for 10 days,

But you lecture is so clear to get this difficulty with easy way.😊

shamimahamed
Автор

such a clear explanation. Cleared my long pending doubt. thanks so much.

sowmyal
Автор

very clear..one doubt.."exception will be thrown by @repository u plz explain this line as exception is thrown by piece of code

kiranmete
Автор

Thanks for the video. May i know what is the source of your knowledge? I mean how did you clear your concepts? I want to go through that along with your videos. Thanks again. Keep up the good work.

GMIqbalMahmud
Автор

Thanks for your explanation ...I have one doubt that Can we use other stereotype annotations instead of @Repository?

bachelortadka
Автор

Great yr..why don't I found it earlier

Lifeinmumbai
Автор

It's worth of watching this video....👌👏👏

imamhusen
Автор

Great way of explanation .. love from Pakistan

saeedahmedsheikh
Автор

@RequestMapping would not work with @component ?

puneetsaneja
Автор

hello sir, can we use @service in place of @repository, what will happen.

gyanverma
Автор

your explanation is so clear... but there is problem with how you speak

aniruddhachunne
Автор

good explanation, i always confuse but now clear thanks
can u plz @SpringBootApplication Annotation

bhushanbhamare
Автор

Is it manday to annotate the class with @Component to use it with @Autowired annotation...?

RahulThakur-jlpm