first, the concept.
Spring is an open source framework, and spring is a lightweight Java development framework that emerged in 2003 by Rod Johnson in his book expert One-on-one development and Des Some of the ideas and prototypes elaborated in IGN derive. It is created to address the complexities of enterprise application development. Spring uses basic JavaBean to accomplish things that were previously only possible by EJBS. However, the use of spring is not limited to server-side development. From the standpoint of simplicity, testability, and loose coupling, any Java application can benefit from spring.
objective: To solve the complexity of enterprise application development
function: Use basic JavaBean instead of EJB, and provide more enterprise application function
Scope: Any Java application
in short, spring is a lightweight control inversion (IoC) and aspect-oriented (AOP) container framework.
Lightweight-Spring is lightweight, both in terms of size and overhead. The full spring framework can be published in a jar file with a size of more than 1MB. and the processing overhead required by spring is negligible. In addition, spring is non-intrusive: Typically, objects in spring applications do not depend on a particular class of spring.
control reversal--spring facilitates loose coupling through a technique called inversion of Control (IoC). When an IOC is applied, other objects that an object relies on are passed in passively, rather than the object itself creating or locating dependent objects. You can think of the IOC as opposed to Jndi--not the object looking for dependencies from the container, but the container actively passing the dependency to it when the object is initialized without waiting for the object to be requested.
facet-oriented--spring provides rich support for aspect-oriented programming, allowing for the development of cohesion through the separation of application business logic with system-level services such as auditing (auditing) and transaction (transaction) management. The Application object only implements what they should do-complete the business logic-that's all. They are not responsible (or even conscious) for other system-level concerns, such as log or transaction support.
The
container--spring contains and manages the configuration and lifecycle of the Application object, in this sense it is a container, and you can configure how each of your beans is created-based on a configurable prototype (prototype), Your bean can create a separate instance or generate a new instance each time it is needed-and how they relate to each other. However, spring should not be confused with traditional heavyweight ejb containers, which are often bulky and cumbersome and difficult to use.
Framework--spring can be used to configure and assemble simple components into complex applications. In spring, application objects are combined declaratively, typically in an XML file. Spring also provides a number of basic functions (transaction management, persistence framework integration, etc.), leaving the development of application logic to you.
The role of mvc--spring is to integrate, but not just to integrate, the Spring framework can be seen as an enterprise solution-level framework. The client sends the request, the server controller (implemented by Dispatcherservlet) completes the forwarding of the request, and the controller invokes a class handlermapping for the mapping, which is used to map the request to the corresponding processor to process the request. Handlermapping maps the request to the corresponding processor controller (equivalent to action) in spring if you write some processor components, generally implement the Controller interface, in the controller can call some service or DAO for data manipulation Modelandview is used to hold data taken from the DAO, and it can hold some data from the response view. If you want to return the processing results to the user, a view component, Viewresolver, is provided in the spring framework, which finds the corresponding view based on the indicator returned by the controller, and returns the response response to the user.
all of these features of spring enable you to write cleaner, more manageable, and easier-to-test code. They also provide basic support for the various modules in spring.
second, Spring core
Spring consists of 7 modules, such as:
The features of these modules include the following:
The core package is a fundamental part of the framework that provides management capabilities for injection-dependent and bean containers. Its beanfactory eliminates the application's reliance on Singleton and factory.
The AOP package provides an AOP implementation that is compatible with AOP Federation, allowing you to define methods, interceptors, pointcuts, and so on. Through AOP, the crosscutting separation of concerns is achieved in application logic.
The context package builds on the bean package, which provides a framework for bean access, similar to the JNDI mechanism, which provides a function extension on top of the bean package.
The DAO package provides the JDBC abstraction, eliminates the lengthy JDBC encoding, and translates the database vendor-specific error code. The package also provides programmatic and declarative transaction management.
ORM packages provide an integrated pretext for popular relational/object mapping scenarios.
The WEBMVC package provides a Web-based application-oriented MVC implementation that provides greater flexibility for the integration of Spring MVC and IOC containers
Web packages provide comprehensive web-oriented features such as context initialization using servlet listeners, file uploads, and so on. It is also used in integration with other web frameworks.
Three, a summary.
Spring has made it easier for us to access the underlying Java EE Container service, and with spring our development efficiency will be greatly improved.
Beginners Learn spring--Spring