What's the difference between @Component, @Repository & @Service annotations in Spring?
@lebyy▲ 0 net votes
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…