Vậy trong Service luôn gọi qua Service khác. hay gọi qua repo khác thì ổn hơn ạ.
Ví dụ: Service A có repo A, service B, repo C, D.. vì chỉ gọi những câu jpa đơn giản.
Best practice thì sẽ như nào ạ
We want to connect the people who have knowledge to the people who need it, to bring together people with different perspectives so they can understand each other better, and to empower everyone to share their knowledge.
Vậy trong Service luôn gọi qua Service khác. hay gọi qua repo khác thì ổn hơn ạ.
Ví dụ: Service A có repo A, service B, repo C, D.. vì chỉ gọi những câu jpa đơn giản.
Best practice thì sẽ như nào ạ
Controller -> Service -> Repo
Bởi vì khi service này gọi service kia rất dễ gây ra tình trạng phụ thuộc vòng tròn và code phụ thuộc chồng chéo hỗn loạn.
Nếu có quá nhiều service phụ thuộc lẫn nhau em nên sinh ra 1 tầng nữa:
Controller -> Controller Service -> Service -> Repo
.Trong mô hình này Controller Service đóng vai trò như một Mediator để điều phối các phụ thuộc.
Input your email to receive reset password link, or if you remember your password, you can click