4

I wanna to know the best approach to use Controller, Facade, Service, Repository in Spring MVC.

The structure in my current project is:

AController -> AService(business logic in here) -> ARepository

BController -> BService(business logic in here) -> BRepository

and other CDE... Controller, Service, Repository

But when business logic get complicated, I don't know which design is correct:

1. AController -> AService & BService & ...CDE Service

2. AController -> AService -> BCD Service

3. AController -> AFacade -> ABCD... Service

And if I choose the answer 3, can I still use its own Service as below?

AController -> AFacade -> ABCD... Service

AController -> AService

Or I can't invoke the AService from AController anymore but invoke by AFacade only?

Thanks for answer.

hkutluay
  • 6,794
  • 2
  • 33
  • 53
William
  • 51
  • 3

0 Answers0