Home > Back-end >  Questions about spingboot call service
Questions about spingboot call service

Time:12-01

,
I want to ask is usually development might require a controller to invoke the business layer to handle business
But recently watched a mall in making project
I found him to be only wrote a controller
He is not through the path to invoke the logic of the business layer
But by the request parameter to invoke the service
Such as request parameters, there are two
API: user
Type: login
Is called userService login method
Through the controller/API to through these two parameters decides to call which business


A little confused is I want to know the way and usually the configure multiple paths to invoke the business logic way what benefits and disadvantages
And I want to find some on the Internet, the interpretation of the also don't know what to what,,,
Thank you for your bosses

CodePudding user response:

Call not recommended parameters corresponding to the service, if the parameter is increasing, you won't change your original code, design patterns, pay attention to open for extension closed for modification, so suggest to follow the common way to write logic, and you say oneself circumstance belongs to combat confusion, you should do more several projects will clear the way they want

CodePudding user response:

Itself a place in the whole MVC controller layer, how to become a controller object, or don't believe this usage

CodePudding user response:

Our previous projects are also exposed a Controller interface, only through parameter to specify the service and the method of calls, no big problem; For small projects, development soon,
But there are also some problems need to be aware of, through the parameters to invoke the corresponding service and method, is actually use of reflection mechanism, the method name cannot overload; Exposure to a third party will be very unsafe; So our approach is that the service is used only for background management calls, public service interface separate processing,



  • Related