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

Source: Internet
Author: User

Reprint: http://www.cnblogs.com/ywlaker/p/6136625.html

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

<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

 <dependency> <groupid>org.</groupid> < artifactid>spring-webmvc< Span class= "o" ></artifactid> <version< Span class= "o" >>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

spring-core:依赖注入IoC与DI的最基本实现spring-beans:Bean工厂与bean的装配spring-context:spring的context上下文即IoC容器spring-expression:spring表达式语言

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:面向切面编程spring-aspects:集成AspectJspring-instrument:提供一些类级的工具支持和ClassLoader级的实现,用于服务器spring-instrument-tomcat:针对tomcat的instrument实现

They depend on the relationship

Data access

The data Access section consists of 5 modules

spring-jdbc:jdbc的支持spring-tx:事务控制spring-orm:对象关系映射,集成orm框架spring-oxm:对象xml映射spring-jms:java消息服务

They depend on the relationship

Web

The Web section contains 4 modules

spring-web:基础web功能,如文件上传spring-webmvc:mvc实现spring-webmvc-portlet:基于portlet的mvc实现spring-struts:与struts的集成,不推荐,spring4不再提供

They depend on the relationship

Test

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

spring-test:spring测试,提供junit与mock测试功能 spring-context-support:spring额外支持包,比如邮件服务、视图解析等

They depend on the relationship

The structure of the spring3 here is finished, looking at these diagrams I believe you will not be confused when you configure spring dependencies in Maven, and the detailed configuration of the integration of other technologies in spring and spring MVC can refer to my side article spring and spring MVC integrates multiple technologies to build complex projects

The following describes the structure of Spring4, Spring4 and Spring3 basically the same, the following is the official website of the structure of the chart

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

spring-websocket:为web应用提供的高效通信工具spring-messaging:用于构建基于消息的应用程序

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.