Spring modules are simply JAR files that package the required code for that module. After you understand the purpose of each module, you can select the modules required in your project and include them in your code. As of Spring version 5.0.0.RELEASE, Spring comes with 21 modules, packaged into 21 JAR files.
The actual JAR file name is, for example, spring-aop-5.0.0.RELEASE.jar, though we have included only the specific module portion for simplicity (as in spring-aop, for example).
Learn the spring framework at https://www.javaguides.net/p/spring-tutorial-beginners-to-expert.html.
The actual JAR file name is, for example, spring-aop-5.0.0.RELEASE.jar, though we have included only the specific module portion for simplicity (as in spring-aop, for example).
Spring Modules (JAR Files)
Let's discuss these JAR files and their corresponding modules in detail.
1. spring-aop
This module contains all the classes you need to use Spring’s AOP features within your application. You also need to include this JAR in your application if you plan to use other features in Spring that use AOP, such as declarative transaction management. Moreover, classes that support integration with AspectJ are packed in this module.
For example, below is the maven dependency of aop module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-aop -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
Learn about Spring AOP at https://www.javaguides.net/p/spring-aop-tutorial.html.
2. spring-aspects
This module contains all the classes for advanced integration with the AspectJ AOP library. For example, if you are using Java classes for your Spring configuration and need AspectJ-style annotation-driven transaction management, you will need this module.
For example, below is the maven dependency of spring aspects module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-aspects -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
Learn about Spring AOP at https://www.javaguides.net/p/spring-aop-tutorial.html.
3. spring-beans
This module contains all the classes for supporting Spring’s manipulation of Spring beans. Most of the classes here support Spring’s bean factory implementation. For example, the classes required for processing the Spring XML configuration file and Java annotations are packed into this module.
For example, below is the maven dependency of spring beans module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
4. spring-beans-groovy
This module contains Groovy classes for supporting Spring’s manipulation of Spring beans. For example, below is the maven dependency of spring beans-groovy module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
5. spring-context
This module contains classes that provide many extensions to Spring Core. You will find that all classes need to use Spring’s ApplicationContext feature, along with classes for Enterprise JavaBeans (EJB), Java Naming and Directory Interface (JNDI), and Java Management Extensions (JMX) integration. Also contained in this module are the Spring remoting classes, classes for integration with dynamic scripting languages (for example, JRuby, Groovy, and BeanShell), JSR-303 (Bean Validation), scheduling and task execution, and so on.
For example, below is the maven dependency of the spring-context module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
6. spring-context-indexer
This module contains an indexer implementation that provides access to the candidates that are defined in META-INF/spring.components. The core class CandidateComponentsIndex is not meant to be used externally.
For example, below is the maven dependency of the spring-context-indexed module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-indexer -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-indexer</artifactId>
<version>5.0.0.M5</version>
<scope>optional</scope>
</dependency>
7. spring-context-support
This module contains further extensions to the spring-context module. On the user-interface side, there are classes for mail support and integration with templating engines such as Velocity, FreeMarker, and JasperReports. Also, integration with various task execution and scheduling libraries including CommonJ and Quartz are packaged here.
For example, below is the maven dependency of the spring-context-support module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
8. spring-core
This is the main module that you will need for every Spring application. In this JAR file, you will find all the classes that are shared among all other Spring modules (for example, classes for accessing configuration files). Also, in this JAR, you will find selections of extremely useful utility classes that are used throughout the Spring codebase and that you can use in your own application.
For example, below is the maven dependency of the spring-core module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
Learn spring core at https://www.javaguides.net/p/spring-core-tutorial.html.
9. spring-expression
This module contains all support classes for Spring Expression Language (SpEL).
For example, below is the maven dependency of the spring-expression module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-expression -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
10. spring-instrument
This module includes Spring’s instrumentation agent for JVM bootstrapping. This JAR file is required for using load-time weaving with AspectJ in a Spring application.
For example, below is the maven dependency of the spring-instrument module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-instrument -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
11. spring-jdbc
This module includes all classes for JDBC support. You will need this module for all applications that require database access. Classes for supporting data sources, JDBC data types, JDBC templates, native JDBC connections, and so on, are packed in this module.
For example, below is the maven dependency of the spring-jdbc module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
12. spring-jms
This module includes all classes for JMS support.
For example, below is the maven dependency of the spring-jms module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jms -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
13. spring-messaging
This module contains key abstractions taken from the Spring Integration project to serve as a foundation for message-based applications and adds support for STOMP messages.
For example, below is the maven dependency of the spring-messaging module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-messaging -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
14. spring-orm
This module extends Spring’s standard JDBC feature set with support for popular ORM tools including Hibernate, JDO, JPA, and the data mapper iBATIS. Many of the classes in this JAR depend on classes contained in the spring-jdbc JAR file, so you definitely need to include that in your application as well.
For example, below is the maven dependency of the spring-orm module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
15. spring-oxm
This module provides support for Object/XML Mapping (OXM). Classes for the abstraction of XML marshalling and unmarshalling and support for popular tools such as Castor, JAXB, XMLBeans, and XStream are packed into this module.
For example, below is the maven dependency of the spring-oxm module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-oxm -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
16. spring-test
Spring provides a set of mock classes to aid in testing your applications, and many of these mock classes are used within the Spring test suite, so they are well tested and make testing your applications much simpler. Certainly, we have found a great use for the mock HttpServletRequest and HttpServletResponse classes in unit tests for our web applications.
On the other hand, Spring provides tight integration with the JUnit unit-testing framework, and many classes that support the development of JUnit test cases are provided in this module; for example, SpringJUnit4ClassRunner provides a simple way to bootstrap the Spring ApplicationContext in a unit test environment.
For example, below is the maven dependency of the spring-test module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.2.0.RELEASE</version>
<scope>test</scope>
</dependency>
17. spring-tx
This module provides all classes for supporting Spring’s transaction infrastructure. You will find classes from the transaction abstraction layer to support the Java Transaction API (JTA) and integration with application servers from major vendors.
For example, below is the maven dependency of the spring-tx module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
18. spring-web
This module contains the core classes for using Spring in your web applications, including classes for loading an ApplicationContext feature automatically, file upload support classes, and a bunch of useful classes for performing repetitive tasks such as parsing integer values from the query string.
For example, below is the maven dependency of the spring-web module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
19. spring-web-reactive
This module contains core interfaces and classes for Spring Web Reactive model.
For example, below is the maven dependency of the spring-web-reactive module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web-reactive -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web-reactive</artifactId>
<version>5.0.0.M4</version>
</dependency>
20. spring-webmvc
This module contains all the classes for Spring’s own MVC framework. If you are using a separate MVC framework for your application, you won’t need any of the classes from this JAR file.
For example, below is the maven dependency of the spring-webmvc module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
21. spring-websocket
This module provides support for JSR-356 (Java API for WebSocket).
For example, below is the maven dependency of the spring-websocket module:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-websocket -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>5.2.0.RELEASE</version>
</dependency>
Comments
Post a Comment