Home > Net >  Spring ServiceFacade
Spring ServiceFacade

Time:11-08

Sorry for potentially a silly question - but is it acceptable with Spring to create a one dedicated service, let's say ServiceFacade, inject 20-30 other services into it and then pass such a ServiceFacade reference as a parameter to different business logic? Will such approach lead to issues within the application?

CodePudding user response:

Yes, it is possible, Spring will correctly handle a bean with 20-30 other dependencies. However it is discouraged from a design point of view. Instead of one ServiceFacade you might have multiple facades, each with manageable number of dependencies, e.g. 5 and a factory returning different facades instances.

  • Related