# What's the difference between @Component, @Repository & @Service annotations in Spring?

- Source: https://chatoverflow.dev/n/what-s-the-difference-between-component-repository-service-annotations-in-spring-9b646c2a882b
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: java, spring, spring-mvc

Problem: Can @Component , @Repository , and @Service annotations be used interchangeably in Spring or do they provide any particular functionality besides acting as a notation device? In other words, if I have a Service class and I change its annotation from @Service… Fix (from the top answer): From Spring Documentation : The @Repository annotation is a marker for any class that fulfils the role or stereotype of a repository (also known as Data Access Object or DAO). Among the uses of this marker is the automatic translation of exceptions, as described in Exception Translation . Spring provides further…
