SSM framework integration and running process SSM framework integration and running process

SSM framework integration and operation process

Original August 22, 2017 22:21:41

The projects developed in my recent work are developed using the Spring-springMVC-Mybatis framework. Today, I will summarize my understanding of the SSM framework during this period of writing. Before integrating the SSM framework, a brief introduction to the role of each layer of the framework and the relationship between them is made.

1. The role and relationship between levels in the SSM framework

  • Presentation layer (springMVC): Controller layer (Handler layer)

    • Responsible for the control of specific business module processes
    • The Controller layer controls the business process by calling the interface of the Service layer, and the
      configuration also in the Spring configuration file.
  • Business layer (Spring): Service layer

    • Service layer: responsible for the logic application design of business modules.
    • Design its interface first, and then implement his implementation class.
    • By configuring the association of its implementation in the Spring configuration file, and completing this step,
      we can perform business processing by calling the interface of the Service.
    • Finally, by calling the interface defined by the DAO layer, the specific implementation class of the Service is implemented.
  • Persistence layer (Mybatis): Dao layer (Mapper layer)

    • Dao layer: responsible for the interaction design with the database to handle the persistence of data.
    • The design of the DAO layer is first to design the interface of the DAO,
    • Then define the implementation class of this interface in Spring's configuration file, you can
      call to process data services, and you don't need to care about the specific implementation class of the interface.
      The reflection mechanism is used here. The data source configuration of the DAO layer and the parameters
      related to the database connection are configured in the Spring configuration file.
  • View layer: View layer

    • Responsible for the display of front-end jsp pages.
    • This layer needs to be developed in conjunction with the Controller layer.
  • Links between layers:

    • Originally, the Controller layer and the View layer can be developed together in the .jsp file, but in order to reduce the complexity of the code and improve its maintainability, it is divided into two layers, which also reflects the characteristics of the MVC framework, namely Clear structure and low coupling.
    • The Service layer is built on the DAO layer. After the DAO layer is established, the Service layer can be established, and the Service layer is under the Controller layer. Therefore, the Service layer should not only call the interface of the DAO layer, but also provide an interface to The class of the Controller layer is called, which happens to be in a middle layer. Each model has a Service interface, and each interface encapsulates its own business processing methods.

2. SSM framework integration description

Here is a summary of the detailed blog post, you can refer to this blogger to understand.
Blog post link

Three, three-tier architecture operation process

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324851750&siteId=291194637