Spring's basic application (overview of the advantages and disadvantages)

Spring is to address the complexity of enterprise application development and produce, and its core is based on a complete inversion of control (IoC) lightweight containers.

Spring is a hierarchical frame stop lightweight, it IoC (Inversion of Control reverse control) and AoP (Aspect Oriented Programming, aspect-oriented programming) to the core.

In Spring, Java classes are all considered resources, and resources are class instance object (Bean), accommodate and manage Bean Spring IoC container is provided, so Spring is a programming Bean-based, it profoundly changing the Java development world.

Spring is committed to JavaEE application layers of solutions, rather than just focus on a particular layer of the program. It provides the presentation layer and the SpringMVC Struts2 framework of integration; in the business logic to manage the transaction, logging and so on; the persistence layer can integrate Hibernate, MyBatis, JdbcTemplate technology.

 

Spring advantages:

(1) non-invasive: Spring Framework API will not appear on the business logic, that should be a pure business logic code independent of the business logic can not appear.

(2) a container. Spring provides container function, the container can manage the life cycle of objects, as well as the dependencies between objects and objects. You can write a configuration file (usually XML files), as defined above in the name of the object, whether it is a single case, and set dependencies on other objects. So when the vessel started, these objects are instantiated, and can be used directly, but also on the relationship established good.

(3) IoC. Inversion of Control, that is dependent on the transfer relationship, if past is implementation-dependent, then the reverse is now dependent on the abstract, the core idea is oriented programming interface.

(4) dependency injection: dependency relationship between the object and achieve the object, comprising an interface injection, implantation configuration, injection property methods.

(5) AOP: Aspect Oriented Programming, log, security, transaction management, and other services or functions understood as a "aspect", before these services are usually written directly in the business logic code that has two drawbacks: first, business logic is not pure, followed by a lot of these services are reusable business logic, do not reuse. AOP solve the above problem, these services stripped out to form a "aspect", may be implemented multiplexing; then, the "aspect" dynamically inserted into the business logic, so that business logic can conveniently use the service "aspect" to provide.

 

Guess you like

Origin www.cnblogs.com/kjitboy/p/12049017.html