java - What is the best approach to use multiple services inside a resource controller? -


i have controller call 3 services :

public class productcontroller(){ @autowired private accountservice accountservice; @autowired private processservice processservice; @autowired private releaseservice releaseservice;  @requestmapping("/process")     public product process(@requestparam(value="name", defaultvalue="docs")     productprocessed process) {      accountservice.notify();     releaseservice.sendrelease(process);       return processservice.process(process); } 

}

what best approach encapsulate service calls??

what looking possibly design patterns. approach create coarse-grained facade on fine-grained services (account, process , release). (see coarse-grained vs fine-grained)

the facade have these 3 services injected in them , encapsulate behavior making controller perform currently. way minimize business logic invoking coarse grained service in controller further encapsulating guts of system.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -