Maven dependencies between the Spring framework architecture and the internal module jars

Source: Internet
Author: User

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 a project of the same type, 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, Which jars do you need? As long as a

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

What about the introduction of Spring MVC in Web engineering? Also, just configure a dependency

12345 <dependency>    <groupId>org.springframework</groupId>    <artifactId>spring-webmvc</artifactId>    <version>3.2.17.RELEASE</version></dependency>

Why can I configure this? 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 dependencies

Core

Core section contains 4 modules

    1. Spring-core: The most basic implementation of dependency injection IOC and DI
    2. Spring-beans:bean Factory and Bean Assembly
    3. Spring-context:spring context is the IOC container
    4. 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

1234567891011 <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

    1. SPRING-AOP: Plane-oriented programming
    2. Spring-aspects: Integrated ASPECTJ
    3. Spring-instrument: Provides class-level tooling support and ClassLoader-level implementations for server
    4. SPRING-INSTRUMENT-TOMCAT: Instrument implementation for Tomcat

They depend on the relationship

Data access

The data Access section consists of 5 modules

    1. SPRING-JDBC:JDBC's support
    2. SPRING-TX: Transaction control
    3. Spring-orm: Object Relational mapping, integrated ORM Framework
    4. SPRING-OXM: Object XML mappings
    5. Spring-jms:java Messaging Service

They depend on the relationship

Web

The Web section contains 4 modules

    1. Spring-web: Basic Web features, such as file uploads
    2. SPRING-WEBMVC:MVC implementation
    3. Spring-webmvc-portlet: A portlet-based MVC implementation
    4. Spring-struts: Integration with struts, not recommended, Spring4 no longer available

They depend on the relationship

Test

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

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

They depend on the relationship

Here, Spring3 's introduction is over, look at these diagrams I believe you will not be confused when you configure spring dependencies in Maven

The following is the introduction of Spring4, and the SPRING3 structure is basically the same, the following is the official website of the structure diagram

As you can see, the spring3 struts are removed, the messaging and WebSocket are added, the other modules remain the same, so the Spring4 jar has 20

    1. Spring-websocket: An efficient communication tool for Web applications
    2. Spring-messaging: Used to build message-based applications

They depend on the relationship

Maven dependencies between the Spring framework architecture and the internal module jars

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.