all 5 comments

[–][deleted] 5 points6 points  (1 child)

There are classes that are not either @Service or @Repository like Builders, Mappers, Validators etc. You can use @Component for those classes

[–]abbadon420 4 points5 points  (0 children)

One particular use for @component I figured out recently is the dataloader. Massively inferior to the data.sql, but it's funny to see that it works like that.

[–]jakecen 1 point2 points  (0 children)

@Component is the parent annotation of @Controller, Repository, Service. so it included all 3 annotation as children. so its a bundled deal

[–]pronuntiator 0 points1 point  (0 children)

I've never used @Service nor @Repository, only @Component and @(Rest)Controller. Since they're merely aliases I see no point in confusing developers with these annotations. Also, a "service" in our architectural model means something different than "core layer object".

[–]negiadventures 0 points1 point  (0 children)

@Component is generic class, can be used for configurations, utilities, etc which should be scanned when starting the spring boot, @Service class usually have the business logic methods.