728x90 Ad Space

@Component vs @Service vs @Repository vs @Controller

By : Unknown
On : 10:15 PM
SpringComponentAnnotations 
Difference between Spring @Component, @Service, @Repository, @Controller annotations are used for automatic bean detection using classpath scan in Spring framework. @Component is a generic annotation. Difference of @Service, @Repository, @Controller with @Component is they are special cases of @Component and used for particular purposes. The difference is just classification only.
For all these annotations (stereotypes), technically the core purpose is same. Spring automatically scans and identifies all these classes that are annotated with “ @Component, @Service, @Repository, @Controller”  and registers BeanDefinition with ApplicationContext. We read about @Controller in a previous Spring tutorial on annotation based controllers.

0 comments:

Post a Comment