Spring MVC Framework Package analysis, function, benefits

Source: Internet
Author: User
Tags to domain

Having just built an MVC framework, I decided to share some of the things I learned during my build. I think whether you are a junior programmer or a senior programmer or a software architect, the first thing you should know when learning and understanding a framework is the principle of the framework and its role and relationship with the jar. This article summarizes the relevant knowledge of the spring framework.

I.introduction of SPIRNG ( master can skip )

Spring is an open source framework that is created by Rod Johnson. 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.

Second, how spring Works (MVC)

1.SPRINGMVC Please submit all requests to Dispatcherservlet, which will delegate the other modules of the application system responsible for the actual processing of the request.

2.DispatcherServlet queries one or more handlermapping to find the controller that handles the request.
3.DispatcherServlet request Submit to target Controller
4.Controller after the business logic is processed, it returns a Modelandview
5.Dispathcher querying one or more viewresolver view resolvers, locating the View object specified by the Modelandview object
6. The View object is responsible for rendering back to the client.

Third, the role of spring

AOP allows developers to create non-behavioral concerns, called crosscutting concerns, and insert them into application code. With AOP, public services (such as logs, persistence, transactions, and so on) can be decomposed into facets and applied to domain objects without increasing the complexity of the object model of the domain object.

IOC allows you to create an application environment where objects can be constructed, and then pass their collaboration objects to those objects. As the word inversion shows, the IOC is like the reverse jndi. Not using a bunch of abstract factories, service locators, single elements (singleton), and direct constructs (straightconstruction), each object is constructed with its collaboration objects. Therefore, the collaboration object (collaborator) is managed by the container.
Spring even an AOP framework, is also an IOC container. The best part of Spring is that it helps you replace objects. With spring, you simply add dependencies (collaboration objects) with the JavaBean property and configuration file. You can then easily replace collaboration objects with similar interfaces when you need them.
The Spring framework is a layered architecture consisting of 7 well-defined modules. The spring modules are built on top of the core container, and the core container defines how the beans are created, configured, and managed, as shown in 1.
Each module (or component) that makes up the Spring framework can exist separately or be implemented in conjunction with one or more other modules. The functions of each module are as follows:
Core container: The core container provides the basic functionality of the spring framework. The main component of the core container is Beanfactory, which is the implementation of the factory pattern. The beanfactory uses the inversion of control (IOC) pattern to separate the application's configuration and dependency specifications from the actual application code.
Spring Context: The spring context is a configuration file that provides contextual information to the spring framework. The spring context includes enterprise services such as JNDI, EJB, e-mail, internationalization, checksum scheduling.
Spring AOP: With the configuration management feature, the Spring AOP module directly integrates aspect-oriented programming capabilities into the spring framework. Therefore, it is easy to enable any object managed by the Spring framework to support AOP. The spring AOP module provides transaction management services for objects in spring-based applications. By using Spring AOP, you can integrate declarative transaction management into your application without relying on EJB components.
The Spring Dao:jdbcdao abstraction layer provides a meaningful exception hierarchy that can be used to manage exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the number of exception codes that need to be written (such as opening and closing connections). Springdao's JDBC-oriented exception conforms to the common DAO exception hierarchy.
The Spring orm:spring Framework inserts several ORM frameworks, providing ORM object-relational tools, including JDO, Hibernate, and IBatis SQL Map. All of these conform to Spring's common transaction and DAO exception hierarchies.
Spring Web module: The Web context module is built on top of the application context module and provides the context for Web-based applications. Therefore, the Spring framework supports integration with Jakarta struts. The Web module also simplifies the process of working with multipart requests and binding request parameters to domain objects.
Spring MVC framework: The MVC Framework is a full-featured MVC implementation of building WEB applications. With the policy interface, the MVC framework becomes highly configurable, and MVC accommodates a large number of view technologies, including JSP, Velocity, Tiles, IText, and POI.
The functionality of the Spring framework can be used in any Java EE server, and most features are also available in an out-of-management environment. The core point of spring is to support reusable business and data access objects that are not tied to a particular Java EE service. There is no doubt that such objects can be reused across different Java EE environments (web or EJB), standalone applications, and test environments.

Iv. Description of Spring Rack Package catalogue

Aspectj directory is the source code and test program files for using ASPECTJ under the spring framework.

     ASPECTJ is the earliest Java application framework to provide AOP.  
   The   dist directory is the spring release package, which is described in more detail below in the release package.  
   The   docs directory is related to the documentation, including the Spring API Javadoc, reference Reference Guide, and Spring's tag library using   parts and           Spring MVC mvc-step-by-step Tutorials and examples. is a very good document, it is worth a good study.  

   lib The directory is the third-party open source package that spring relies on.  

   The   mock directory is the mock source of the spring-assisted application test.  
   The   samples directory is a sample configuration of Spring's sample source program and a simple WebApp example framework, which is worth studying Jpetstore and petclinic, and of course other countries, imagedb, Tiles-example can also be a good reference.  
     src directory is the source program for spring.  
     test directory.  
   The   tiger directory is for source programs and test programs that use Java 1.5 in the spring framework. Tiger is the development code for JDK version 1.5.  

Five, Spring rack package work role

Spring.jar is a single jar package that contains a complete release module. But not including Mock.jar, Aspects.jar, Spring-portlet.jar, and Spring-hibernate2.jar.

Spring-src.zip is all the source code compression package.
In addition to the Spring.jar file, Spring includes 21 other separate jar packages, each containing a corresponding Spring component, which allows the user to choose to assemble their own jar packages, rather than having to introduce all of the Spring.jar's class files.
Spring-core.jar (required)
This jar file contains the basic core tool classes of the spring framework. The other components of Spring use the classes in this package, which is the basic core of the others, and of course you can use them in your own application system.
Externally dependent Commons Logging, (log4j).
Spring-beans.jar (required)
This jar file is used by all applications and contains all classes that access the configuration file, create and manage beans, and perform inversion of control/dependency injection (IOC/DI) operations. If the application requires only basic Ioc/di support, the introduction of Spring-core.jar and Spring-beans.jar files is possible.
Externally dependent Spring-core, (CGLIB).

Spring-aop.jar (required)
This jar file contains the class and source-level metadata support required to use spring's AOP features in your app. Using the spring features based on AOP, such as declarative transaction management (declarative Transaction Management), also include this jar package in your application.
Externally dependent Spring-core, (Spring-beans,aop Alliance, Cglib,commons Attributes).

Spring-context.jar (required)
This jar file provides a number of extensions to the spring core. You can find all the classes you need to use the Spring ApplicationContext feature, Jdni all the classes you need, instrumentation components, and related classes for validating validation.
Externally dependent Spring-beans, (SPRING-AOP).

Spring-dao.jar (required)
This jar file contains all the classes of Spring DAO, spring Transaction for data access. In order to use declarative transaction support, you also need to include Spring-aop.jar in your own application.
Externally dependent Spring-core, (SPRING-AOP, Spring-context, JTA API).

Spring-jdbc.jar (required)
This jar file contains all the classes that encapsulate spring's JDBC data access.
Externally dependent Spring-beans,spring-dao.

Spring-support.jar (required)
This jar file contains classes that support UI templates (Velocity,freemarker,jasperreports), mail services, scripting Services (JRuby), cache caches (EHCache), Task Scheduler scheduling (Uartz).
Externally dependent Spring-context, (SPRING-JDBC, Velocity, Freemarker, JasperReports, BSH, Groovy, JRuby, Quartz, EHCache)

Spring-web.jar (required)
This jar file contains the core classes required to use the spring framework when developing Web applications, including classes that automatically load Web application Context features, Struts and JSF integration classes, File upload support classes, Filter classes, and a large number of tool helper classes.
Externally dependent Spring-context, Servlet API, (JSP API, JSTL, Commons FileUpload, COS).

Spring-webmvc.jar
This jar file contains all the classes related to the Spring MVC framework. Includes framework for SERVLETS,WEB MVC Framework, controller and view support. Of course, if your app uses a stand-alone MVC framework, you don't need any classes in this jar file.
Externally dependent Spring-web, (spring-support,tiles,itext,poi).

Spring-portlet.jar
Spring's own implementation of a framework similar to spring MVC. Includes an MVC framework and controller.
External dependent spring-web, Portlet API, (SPRING-WEBMVC).

Spring-struts.jar
Struts framework support makes it easier and easier to integrate the struts framework.
Externally dependent spring-web,struts.

Spring-remoting.jar
This jar file contains classes that support EJBS, remotely invoke remoting (RMI, Hessian, Burlap, Http Invoker, Jax-RPC).
External dependent SPRING-AOP, (SPRING-CONTEXT,SPRING-WEB,HESSIAN,BURLAP,JAX-RPC,EJB API).

Spring-jmx.jar
This jar package provides support classes for JMX 1.0/1.2.
Externally dependent SPRING-BEANS,SPRING-AOP, JMX API.

Spring-jms.jar
This jar package provides support classes for JMS 1.0.2/1.1.
Externally dependent SPRING-BEANS,SPRING-DAO,JMS API.

Spring-jca.jar
Support for JCA 1.0.
Externally dependent Spring-beans,spring-dao, JCA API.

Spring-jdo.jar
Support for the JDO 1.0/2.0.
Externally dependent SPRING-JDBC, JDO API, (spring-web).

Spring-jpa.jar
Support for JPA 1.0.
Externally dependent SPRING-JDBC, JPA API, (spring-web).

Spring-hibernate2.jar
Support for Hibernate 2.1 is not recommended for use.
Externally dependent Spring-jdbc,hibernate2, (spring-web).

Spring-hibernate3.jar
Support for Hibernate 3.0/3.1/3.2.
Externally dependent spring-jdbc,hibernate3, (spring-web).

Spring-toplink.jar
Support for the TopLink framework.
Externally dependent Spring-jdbc,toplink.

Spring-ibatis.jar
Support for Ibatis SQL maps.
Externally dependent Spring-jdbc,ibatis SQL Maps.

The other two packages.

Spring-mock.jar
This jar file contains the spring set of mock classes to aid in the testing of the application. The Spring test suite uses a large number of these mock classes, which makes testing easier. Simulating the HttpServletRequest and HttpServletResponse classes is convenient for Web application unit testing. And it provides support for JUnit.
Externally dependent Spring-core.

Spring-aspects.jar
Provides support for ASPECTJ so that aspect-oriented features can be easily integrated into the IDE, such as Eclipse AJDT.
External dependencies.

WEAVER JARS (dist/weavers) description.

Spring-agent.jar
Spring's instrumentationsavingagent (for Instrumentationloadtimeweaver), a device agent package, can refer to JDK1.5 's instrumentation features for more information.
External dependent none (for use at JVM Startup: "-javaagent:spring-agent.jar").

Spring-tomcat-weaver.jar
Extend the ClassLoader of Tomcat so that it can use the instrumentation (device) class.
External dependent none (for deployment into Tomcat ' s "server/lib" directory).

Spring MVC Framework Package analysis, function, benefits

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.