Spring Framework Frame Composition overview

Source: Internet
Author: User
Tags aop file upload tomcat

Many people are using spring to develop Java projects, but when configuring Maven dependencies, it is not clear which spring jars to configure, often adding a bunch of random, compiling or running an error to continue configuring Jar dependencies, causing spring to rely on confusion, Even the next time you create the same type of project, you don't know which spring dependencies to configure, only the copy, in fact, that's what I did.

Spring's jar package is only about 20, each with a corresponding function, a jar may also rely on a number of other jars, so to understand the relationship between them, configuration maven dependency can be concise, for example, to use the spring framework in a common Java project, What jars are needed? As long as a

<dependency>
    <groupId>org.springframework</groupId>
    <artifactid>spring-context </artifactId>
    <version>3.2.17.RELEASE</version>
</dependency>

That's the introduction of Spring MVC in Web engineering. Also, just configure a dependency

<dependency>
    <groupId>org.springframework</groupId>
    <ARTIFACTID>SPRING-WEBMVC </artifactId>
    <version>3.2.17.RELEASE</version>
</dependency>

Why this can be configured. Next we take the spring 3.2.17.RELEASE version as an example of the spring framework structure, Spring 4 slightly different, will be introduced in the last

The spring website gives a picture of the SPRING3 structure.



The diagram divides spring into 5 parts: core, AOP, data access, Web, test, each fillet rectangle in the diagram corresponds to a jar, and if configured in Maven, all of these jar "groupId" are " Org.springframework ", each jar has a different" artifactid ", in addition," instrumentation "has two jars, and a" spring-context-support "graph is not listed, So Spring3 's Jar pack is 19.

The following is a description of the 5-part jar and the dependencies core

Core section contains 4 modules

Spring-core: The most basic implementation of dependency injection IOC and DI Spring-beans:bean the context
context of the factory and bean Assembly
spring-context:spring the IOC container
Spring-expression:spring Expression Language

Their complete dependencies

Because Spring-core relies on commons-logging, and other modules rely on Spring-core, the entire spring framework relies on commons-logging, if it has its own log implementations such as LOG4J, Can exclude the dependency on commons-logging, no log implementation and exclude the commons-logging dependency, compile error

<dependency>
    <groupId>org.springframework</groupId>
    <artifactid>spring-context </artifactId>
    <version>3.2.17.RELEASE</version>
    <exclusions>
        <exclusion >
            <groupId>commons-logging</groupId>
            <artifactid>commons-logging</artifactid >
        </exclusion>
    </exclusions>
</dependency>

AOP

The AOP section consists of 4 modules

SPRING-AOP: Aspect-oriented programming
Spring-aspects: Integrated ASPECTJ
Spring-instrument: Provides class-level tool support and ClassLoader-level implementations for server
SPRING-INSTRUMENT-TOMCAT: Instrument implementation for Tomcat

Their dependencies data access

The data Access section consists of 5 modules

SPRING-JDBC:JDBC support
spring-tx: Transaction control
Spring-orm: Object Relational mapping, integrated ORM Framework
SPRING-OXM: Object XML Mapping
Spring-jms:java Messaging Service

Their dependency Web

The Web section contains 4 modules

Spring-web: Basic Web functionality, such as file upload
SPRING-WEBMVC:MVC implementation
Spring-webmvc-portlet: Portlet-based MVC implementation
Spring-struts: Integration with struts, not recommended, Spring4 no longer available

Their dependencies test

The test section has only one module, and I'll put the spring-context-support here.

Spring-test:spring test, provides junit and mock test functions
 
spring-context-support:spring additional support packages such as mail service, view parsing, etc.

They depend on the relationship


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.