https://kotlinlang.org logo
#spring
Title
# spring
i

igor.wojda

02/22/2023, 11:46 AM
Hey I am new to Spring and coming from Android I wonder if Spring
Service
is equivalent of
UseCase
(Clean Architecture)?
a

Arjan van Wieringen

02/22/2023, 5:53 PM
A spring service is just a semantic alias for a DI artifact. So in essence it is just a “thing” (bean) that can be injected in other services.
i

igor.wojda

02/22/2023, 5:54 PM
Isn't it intended to hold buisness logic (Like the UseCase)?
a

Arjan van Wieringen

02/23/2023, 6:05 AM
Sure. But a Service isn’t a UseCase, so I’d suggest making another annotation that is called UseCase. Service is nothing more than just another name for Bean, so the same can be done with UseCase. UseCases and Services are different. A UseCase is specific to a use case (doh) and can call different services to achieve this. A service is a class that bundles behavior of a specific group. E.g a ShoppingCartService. So keep the naming different
5 Views