Annotations Blog Posts

Difference between @Component, @Repository & @Service annotations in Spring

@Component:
What’s special about @Component ?
 only scans @Component and does not look for @Controller, @Service and @Repository in general. They are scanned because they themselves are annotated with @Component. picks them up and registers their following classes as beans, just as if they were annotated with @Component.
@Service :
@Component
public @interface Service {
//some logic

0 Likes 825 Views