Java -- Spring introduction, tracing Pring
Spring is an open-source framework designed for enterprise application development.
Functions:
1. Objective: To solve the complexity of enterprise application development.
2. function: Use Basic JavaBean instead of EJB, and provide more enterprise application functions.
3. Scope: any Java application.
In short, Spring is a lightweight container framework for IoC and AOP.
A. Lightweight-Spring is lightweight in terms of size and overhead. The complete Spring framework can be published in a JAR file with a size of more than 1 MB. In addition, the processing overhead required by Spring is negligible.
In addition, Spring is non-intrusive: Typically, objects in Spring applications do not depend on specific classes of Spring.
B. Control reversal-Spring promotes loose coupling through a technology called control inversion (IoC. When IoC is applied, other objects that an object depends on will be passed in passively, instead of creating or searching for dependent objects.
You can think that IoC is the opposite of JNDI. Instead of looking for Dependencies from the container, the container actively passes the dependency to the container without waiting for the object request during object initialization.
C. Aspect-Oriented -- Spring provides rich support for Aspect-Oriented Programming, which allows you to manage the business logic and system-level services (such as auditing and transaction) of applications) for cohesion development.
Application objects only implement the business logic they should do. They are not responsible for other system-level concerns, such as log or transaction support.
D. Container -- Spring contains and manages the configuration and lifecycle of application objects. In this sense, Spring is a container, you can configure how each of your beans is created-based on a configurable prototype ),
Your bean can create a separate instance or generate a new instance every time you need it and how they are associated. However, Spring should not be mixed with traditional heavyweight EJB containers, which are often large and bulky and difficult to use.
E. Framework-Spring can configure and combine simple components into complex applications. In Spring, application objects are declared and combined, typically in an XML file.
Spring also provides many basic functions (such as transaction management and persistent framework integration), leaving the development of application logic to you.
These features of Spring allow you to write code that is cleaner, manageable, and easier to test. They also provide basic support for various modules in Spring.
Spring's two core AOP and IOC can be used independently for any application, including integration with Struts, MVC, Hibernate, and other ORM frameworks, currently, many companies use Spring + Struts (2) + Hibernate for lightweight development.