I am currently studying Spring Boot, and I have seen people create a controller, implement a service class and implement a repository in a service class.
Why do we need a service class as an intermediary and why can't we just enter the repository into the controller?
Here's a lesson that confused me: https://www.youtube.com/watch?v=lpcOSXWPXTk&list=PLqq-6Pq4lTTbx8p2oCgcAQGQyqN8XeA1x
You do not always need a level of service. Especially if your APIs are just simple CRUD operations, for example, without real logic or computation.
, API, , . , .
https://en.wikipedia.org/wiki/Single_responsibility_principle
:
, , .
, - - () () .
, (, ), , , .
, ( ), , . , ...
... , .
, ...
, , (SOLID), ( ), HTTP/REST AMQP.
.
Spring - , . , , -. , , API. , , .
, .
Source: https://habr.com/ru/post/1686459/More articles:Unexpected nil index path in _shouldShowMenuForCell - iosHow to get a storage key from my 3D plan scene id? - archilogicHow to set this button to the center of the x axis using css? - htmlНаблюдаемый против обещания для одиночных значений - javascriptPosting to the web api path as a string via swagger / postman - asp.net-coredefine: is there a way to expand the arguments? - c ++Ionic conditionally add service provider - dependency-injectionhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1686462/merging-two-different-string-lists-to-a-class-list&usg=ALkJrhjH5XURKFsCRPR72_Aetw1TALT_kAAlternative to override extension method - iosConfiguring babel-plugin-react-css modules with webpack 3.5.1 - webpackAll Articles