Wu Yuxiong - natural born JAVA development framework SPRING study notes: The basic idea of the Spring framework

EJB learning costs are high, development efficiency is not high, you need to write a lot of duplicate code, these problems prevented the continued development of EJB. Just EJB technology stalled when, Spring Framework appeared at the right time, the Spring Framework and EJB different, the cost of learning the Spring framework is very low, it is a lightweight development framework, more emphasis on object-oriented design , rather than the existing technology becomes more sophisticated, it uses JavaBean replaces the complex EJB, and provides an easy-to-use application configuration framework for JavaBean.
A public class is a JavaBean, which can be used as other classes JavaBean components, and between the group code level JavaBea feature need not implemented, may be implemented entirely in the annotation layer and the layer configuration, Spring adapted to automatically select JavaBean to run with the group. This automatic adaptation mechanism to avoid coupling between the code and the use of class JavaBean, scalability and improved maintenance procedures.
Such as classes A to use Class B, Class B is an attribute of class A, class B if created directly in the class A, class B need to be modified when the result of operations need to be modified A class of codes, such an approach is to couple the code, It can be said to belong to classes A and B coupled codes.
If we create a class B to Spring, Spring to create the class B through a configuration file or through Java annotations, then the example set by the Spring create instances of class B and class A with them, thus avoiding the class A and Code class B coupler. This mechanism is thought to control the Spring Framework is reversed, creating a class corresponding to the class A to B of claim Spring, controlled by the Spring class B created.
Spring framework as well as a more important function, that is the AOP mechanism. Spring Framework AOP mechanism of the system can be extracted some common features, it is used as a JavaBean, while setting an entry point JavaBean call these functions in a business process code of the system, when the entry point to the system when the business process execution, Spring will automatically call the JavaBean transversely cut into the business processes specified location, AOP of this technique is also known as "cross-cutting" technology.
For example, in a business system, when a user needs to enter the operating authority of the page, the system will first enter the login page, requiring users to log into the system before the page. This page will have multiple operating authority, if they are written to log business logic processing code for each page, apparently causes code redundancy, maintenance is also very troublesome. A better approach is to deal with the business user is logged as a separate JavaBean, JavaBean, also known as the AOP's "cut." Then the user needs authority to operate business processes Page Setup "entry point" and the "cut" and "entry point" connected via annotations or configuration file. When the business process execution to the "entry point", Spring Framework will automatically "cut" associated with the entry point to the location of the business process cut into "entry point" where, started "section" of code, code execution until the cut is completed, then determining whether to perform the process behind the results "section" returned. The figure is a schematic diagram of user login feature cut into the business processes.

 

 

Spring Framework is one of the biggest features of the existing development framework and not a competition, instead of using other fusion will come in the framework of an integrated, full use of the technology to other frameworks, to provide the best solutions for system implementation. SSM is a MVC framework Spring Framework integration technology and database MyBatis framework technology.

 

Guess you like

Origin www.cnblogs.com/tszr/p/12128655.html