Spring Modules

There are different Spring modules of Spring Framework, each with specific functionalities that enable the developing of various enterprise applications.

Digital Delivery
-
8 min
Digital Delivery
/
Spring Modules

The Spring Framework gives developers infrastructure support so they can focus on building applications. We appreciate Spring because it helps developers focus on functionality instead of backend operations.

For example, you could build a message handler from POJO (plain old Java objects) without dealing with JMS API. You just build the app and start using it.

We also like that the Spring Framework comes with about 20 modules that support Java development projects. While Spring modules provide infrastructure support for development projects, they can also guide you through the steps of building apps.

Whether you plan to make a constrained applet or a server-side enterprise application, Spring modules give you a step-by-step approach to reaching goals.

Don't worry if you don't need some of the modules within the framework. It adjusts to meet your needs.

After reviewing the Spring Framework's modules, we'll cover some key differences between the generic Spring Framework and Spring Boot.

Modules in the Spring Framework runtime

Working with nearly 20 Spring modules might sound a little burdensome. We find it helpful to group the modules by layer:

  • Data access/Integration
  • Web (MVC/Remoting)
  • AOP (Aspect-oriented programming)
  • Aspects
  • Instrumentation
  • Core container
  • Test

Data access/Integration

The data access/integration layer manipulates data coming into and leaving your Spring app. It does this with five modules.

JDBC (Java database connectivity)

The JDBC-abstraction layer eliminates JDBC coding, a rather tedious task when done manually. If your product needs to interact with JDBC, this module handles the specifics and saves you a lot of time.

ORM (object relation mapping)

The ORM module handles interactions with most of the object-relational mapping APIs you might encounter, including iBatis, Hibernate, JDO, and JPA. The Spring ORM module also lets you use a combination of ORM APIs so your app can interact with multiple data sources.

OXM (object SML mapper)

The OXM module gives your app a data abstraction layer for any Object/XML mapping frameworks you might encounter. Supported mapping frameworks include Xstream, JiBX, JAXB, Castor, and XMLBeans.

JMS (Java Message Server)

The JMS module handles all incoming and outgoing Java messages without forcing you to use the JMS API.

Transactions

The transactions module is responsible for declarative transaction management. It becomes essential when your product interacts with POJOs and special interfaces.

Spring Web-MVC module (Web layer)

The Web layer includes all of the web-oriented integration features you need to make your product interact with assets in today’s online environment.

Web module

The Web module contains several basic-but-essential parts for interacting with servlets and IoC containers. It also plays a role in remote support.

Servlet module

The servlet module contains the MVC (model-view-controller) you need for web apps. It also separates code and web forms.

Portlet module

The web-portlet module moves your MVC implementation to a portlet environment and behaves like a web-servlet.

Struts module

You probably won’t need to use the Web-struts module because recent versions of the Spring Framework prefer MVC solutions. If you do want to use struts, consider adopting Struts 2.0.

Spring AOP module

The AOP module lets you add behavioral information to your code in way that's similar to how you would add .NET attributes and other metadata. You can use it to build features that operate independently instead of conflicting with each other.

Aspects module

The aspects module integrates with AspectJ. Some experts group it with AOP.

Instrumentation module

The instrumentation module also gets grouped with AOP in some cases. It simply supports class instrumentation and classloader implementations some application servers use.

The Spring Core Container

The Spring Core Container Level contains the most critical modules within the Spring Framework. It’s the foundation you build applications on.

Core module

The core module provides features for IoC and dependency injection.

Beans module

The beans module uses BeanFactory so you can implement factory patterns that create objects without forcing you to specify an object’s class. Adding beans to your app gives you an easy, straightforward way to include generic features without writing fresh code.

Context module

The context module works like a JNDI registry. It accesses the objects from the code and beans to ensure proper loading. It’s a flexible module that can work with JMX, EJB, and other Java EE features.

Expression language module

The expression language module uses the Spring Expression Language (SpEL) to receive input and display output. It’s critical to communicate between the user and the application.

Spring testing module

The testing module recruits TestNG and JUnit so you can test code in isolation before deploying.

There are other modules that you can potentially use within the Spring Framework. The web-socket module comes to mind.

For the most part, you only need to use the modules in this list. As you become more familiar with them, you can branch out to explore more options.

Many of them are helpful, but they’re not essential to the types of applications you will build when you first start using the Spring Framework.

You can learn more about making Spring applications by reading tutorials on the Spring.io site. Overall, the site has two to three hours of content to help you understand modules within the Spring context.

You can learn a lot within a pretty short time. We recommend checking it out so you can see the numerous benefits of adopting Spring projects.

Spring Framework vs. Spring Boot

Spring Boot has evolved from the Spring Framework. Because of this, they have a lot in common. There are some differences you should know before deciding whether to use Spring Boot or a generic version of the Spring Framework.

In our experience, some of the most important differences between the two is that, unlike Spring modules, Spring Boot offers:

  • Opinionated starter dependencies that make basic builds easy and quick.
  • Externalized configuration.
  • Automating configuration (when possible).
  • An embedded server that makes deployment more straightforward.

Some other Spring projects we recommend learning about include:

We find that learning to use these projects together gives developers opportunities to build a wider range of products that work well together.

If you use Spring Boot, you can auto-configure many aspects of your application, eliminating several tedious tasks. Instead of spending time on configuration, you can go straight to creating, testing, and optimizing your product.

How Adservio can help

We’ve worked with all of the Spring modules and have ample experience with what they offer. Years of experience also means that we have used the generic Spring Framework and Spring Boot. We tend to prefer Spring Boot, but it isn’t always the right option for every project.

If you need help using any aspect of Spring, feel free to reach out to learn more. We’re always happy to talk about app development tools and their best uses!

That should help you decide which approach you want to take the next time you build an app with Spring.

Published on
October 11, 2022

Industry insights you won’t delete. Delivered to your inbox weekly.

Other posts