Understanding Spring Framework Modules and Maven Dependencies (Spring 3.2.17 and 4)
This article explains how to correctly configure Maven dependencies for Spring 3 (and briefly for Spring 4), detailing the framework’s five module groups, their individual jars, dependency relationships, and providing ready‑to‑use XML snippets for both core and web projects.
Many developers use Spring to build Java projects, but configuring Maven dependencies often becomes chaotic because the required JARs are not obvious. This guide shows exactly which Spring JARs are needed for a plain Java project and for a web project, using Spring 3.2.17.RELEASE as the reference version.
For a basic Java application you only need the
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.17.RELEASE</version>
</dependency>snippet.
To add Spring MVC in a web project, a single dependency is sufficient:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.17.RELEASE</version>
</dependency>The reason these minimal configurations work is that Spring’s JARs are organized into five logical parts: core, AOP, data access, web, and test. The official Spring 3 diagram (shown below) illustrates this structure.
core
The core part consists of four modules:
spring-core – basic IoC and DI implementation
spring-beans – bean factory and bean wiring
spring-context – the IoC container
spring-expression – Spring Expression Language
All core modules depend on spring-core, which in turn depends on commons-logging. If you provide your own logging implementation (e.g., Log4j), you can exclude the default commons-logging dependency as shown:
<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 part contains four modules:
spring-aop – aspect‑oriented programming support
spring-aspects – integration with AspectJ
spring-instrument – class‑level utilities and ClassLoader support
spring-instrument-tomcat – Tomcat‑specific instrumentation
data access
The data‑access part includes five modules:
spring-jdbc – JDBC support
spring-tx – transaction management
spring-orm – ORM integration
spring-oxm – object‑XML mapping
spring-jms – Java Message Service support
web
The web part consists of four modules:
spring-web – basic web utilities (e.g., file upload)
spring-webmvc – MVC implementation
spring-webmvc-portlet – Portlet‑based MVC
spring-struts – integration with Struts (deprecated in Spring 4)
test
The test part contains two modules, with spring-context-support also placed here:
spring-test – JUnit and mock testing support
spring-context-support – additional utilities such as mail service and view resolvers
With these diagrams, configuring Spring dependencies in Maven should no longer be confusing.
Spring 4 retains the same overall structure but removes the Struts integration and adds two new modules: spring-websocket (efficient communication for web apps) and spring-messaging (message‑driven applications). The Spring 4 diagram and its dependency graph are shown below.
Original source: www.cnblogs.com/ywlaker/p/6136625.html
--- Promotional footer (Java Captain) omitted from the academic summary.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
