Back to course

Using @Component, @Service, and @Repository

Spring Boot 0 to Hero: The Complete Java Backend Masterclass

Stereotype Annotations

Spring provides specialized annotations for different roles:

  • @Component: Generic stereotype for any Spring-managed component.
  • @Service: Used for classes that hold business logic.
  • @Repository: Used for the Data Access Layer (handles database interactions).