Difference between @Component, @Service, @Controller, and @Repository in Spring
Before you learn the difference between @Component, @Service, @Controller, and @Repository annotations in Spring framework, it's important to understand the role of @Component annotation in Spring. During initial release of Spring, all beans are used to be declared in an XML file. For a large project, this quickly becomes a massive task and Spring guys recognize the problem rather quickly. In later versions, they provide annotation-based dependency injection and Java-based configuration. From Spring 2.5 annotation-based dependency injection was introduced, which automatically scans and register 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, @Controlle...