Creating the service layer

Our repository is ready to use, now we can create our service layer. This layer is responsible for orchestrating our repository calls. In our case, it is pretty simple but in some complex scenarios, it can help us to encapsulate the repository calls.

Our service will be called  TrackedHashTagService, which will be responsible for interacting with our repository created previously. The implementation should look like the following:

package springfive.twittertracked.domain.service import org.springframework.stereotype.Serviceimport springfive.twitterconsumer.domain.TrackedHashTagimport springfive.twitterconsumer.domain.repository.TrackedHashTagRepository @Serviceclass TrackedHashTagService(private val repository: ...

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.