@Component: It is a basic auto component scan annotation, it indicates the annotated class is an auto scan component.
@Controller: Annotated class indicates that it is a controller component, and mainly used at the presentation layer.
@Service: It indicates the annotated class is a Service component in the business layer.
@Repository: You need to use this annotation within the persistence layer, this acts like database repository.
I hope the above snippet works fine, please try..!!