In my actual project we are in a conundrum, in the teams I've been in other companies we always did API calls to retrieve data on the Repository layer with @Repository from SpringBoot even if they were a simple RestTemplate getForEntity. But here I did as always did and we started debating about if it should be on the repository layer, called repository and if it needs the @Repository annotation at all and could just go with @Service or @Component.
Personally it makes sense that all data access layer operations should be on the repository layer even if its an API or a database as long as it retrieves data it should be there, the only thing I have doubts is about using @Repository since that is more for Spring Data own repositories.
What do you think should API calls be on the repository layer or on the service layer?
Aucun commentaire:
Enregistrer un commentaire