MVC Design Pattern

Architecture

Architecture


---------------------------------------------------

Tiered Architectures

  • Separation of concerns
  • Reusable layers
  • Maintenance

Architecture


-----------------------------------------------

Application Layers

Architecture


------------------------------------------

Components

Architecture


-------------------------------------------------

Controller

  • Handles incoming requests and building the response
  • Business logic should not be handled here
  • Works with the Service and Repository tier for business logic and data gathering
  • Annotated with @Controller
  • Handles Exceptions and routes the view accordingly


----------------------------------------------------

Service

  • Annotated with @Service
  • The Service tier describes the verbs (actions) of a system
  • Where the business logic resides
  • Ensures that the business object is in a valid state
  • Where transactions often begin (two phase commits)
  • Often has the same methods as the Repository, but different focus

----------------------------------------------------

Repository

  • Annotated with @Repository
  • The Repository tier describes the nouns (data) of a system
  • Focused on persisting and interacting with the database
  • One-to-one mapping with an Object
  • Often a one-to-one mapping with a database table

---------------------------------------------------

Summary

  • Software Architecture
  • MVC
  • N-Tier
  • Components
  • Controller
  • Service
  • Repository


----------------------------------------------------

Controller
https://blog.csdn.net/u012596785/article/details/79922232

相关文章: