SSM framework learning and finishing

1. Spring principle:

1: Core technology

Spring's two major technical points are, an AOP (Aspect Oriented Programming), an IOC (Inversion of Control), and what is AOP, just like process-oriented programming from the C language —> Java object-oriented programming—>Spring aspect-oriented programming, step by step from abstract to image, it can supervise and control a certain type of object (that is, call the module you specify before and after calling the specific method of this type of object) So as to achieve the function of expanding a module. These can be achieved through the configuration class. IOC plays the role of giving the power of object creation to the container, so that we can use the reflection mechanism to dynamically create objects through the configuration file without new.

2:

Static proxy:

Write a proxy class for each specific class, and write a proxy class for an interface. Normally, the proxy class and the delegate class in the static proxy will implement the same interface or be derived from the same parent class.

Dynamic proxy:

write an InvocationHandler for an aspect, and then use the Proxy class in the JDK reflection package to dynamically generate corresponding proxy classes for various interfaces. In this case, the proxy class is not defined in Java code, but is running It is dynamically generated according to our "instructions" in the Java code. Compared with static proxy, the advantage of dynamic proxy is that it can conveniently process the functions of the proxy class in a unified manner without modifying the functions of each proxy class.

Second, the principle of SpringMVC:
Write picture description here
1. The user sends a request to the front controller DispatcherServlet.
2. DispatcherServlet receives the request to call the HandlerMapping processor mapper.
3. The HandlerMapping processor mapper finds the specific processor (you can find it according to the xml configuration and annotations), generates the processor object and the processor interceptor (if there is one), and returns it to the DispatcherServlet.
4. DispatcherServlet calls the HandlerAdapter processor adapter.
5. HandlerAdapter calls a specific processor (Controller, also called back-end controller) through adaptation.
6. After the Controller is executed, it returns to ModelAndView.
7, HandlerAdapter returns the controller execution result ModelAndView to DispatcherServlet.
8. DispatcherServlet passes ModelAndView to ViewReslover view resolver.
9. ViewReslover returns to the specific View after parsing.
10. DispatcherServlet renders the view according to the View (that is, fills the model data into the view).
11. DispatcherServlet responds to users.

3. The working principle of MyBatis:
Write picture description here
1: The main function of MyBatis is to encapsulate JDBC, making it more convenient for users to perform database operations. One of the most powerful features of MyBatis is its dynamic statement function, which perfectly solves JDBC Tedious sql statement writing

Reprinted: https://blog.csdn.net/qq_35273452/article/details/82156423

Guess you like

Origin blog.csdn.net/publicstaticfinal/article/details/95500167