Travelport interview question

What are the differences between @Component, @Service, and @Repository annotations in Spring? When should you use each one?

Interview Answer

Anonymous

Feb 25, 2025

@Component: A generic stereotype for a Spring-managed bean. @Service: A specialization of @Component used for service layer logic. @Repository: A specialization of @Component used for DAO (Data Access Object) classes, providing exception translation.