Spring is an open-source framework created to solve the complexity of enterprise application development. One of the main advantages of the Framework is its layered architecture, which allows you to choose which component to use and provides an integrated framework for J2EE application development.
Personal Understanding: the Sping container is used as a bean factory to manage beans through configuration files (all components in the application are treated as beans)
Composition: beanfactory --------> applicationcontext (sub-interface) --------> classpathxmlapplicationcontext (Implementation class )········
The basic concept of IOC control inversion mode (also called dependency intervention) is to inject values to classes through the configuration file without the need for new objects. Benefit: low coupling. When the class changes, you do not need to modify it in the class. You only need to modify it in the configuration file.
For example:
- <Bean id = "bean2" class = "Yeah. Developers. Spring. bean2">
- <Property name = "bean3" ref = "bean3"> </property>
- </Bean>
- <Bean id = "bean3" class = "Yeah. Developers. Spring. bean3">
AOP for Aspect-Oriented Programming: defines a face-cutting class. There are many methods in it. Each method has its own starting point (where to use it) and enhancement processing (front and back)
For example:
Face Cutting
@ Aspectpublic class logprint {@ pointcut ("execution (* CN. itcast. service .. *. *(..)) ") // declare a start point private void anymethod (){}
@ Before ("anymethod () & ARGs (username)") // defines the pre-notification public void doaccesscheck (string username) {}@ afterreturning (pointcut = "anymethod ()", returning = "revalue") // defines the post-Notification public void doreturncheck (string revalue) {}@ afterthrowing (pointcut = "anymethod ()", throwing = "ex ") // define the exception notification public void doexceptionaction (exception ex) {}@ after ("anymethod ()") // define the final notification public void doreleaseaction () {}@ around ("anymethod ()") // public object dobasicprofiling (proceedingjoinpoint pjp) throws throwable {return pjp. proceed ();}}