Spring Framework Bill of Materials (BOM) that provides centralized dependency management for all Spring Framework modules and third-party dependencies
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
The Spring Framework Bill of Materials (BOM) provides centralized dependency management for all Spring Framework modules and their third-party dependencies. It serves as a platform BOM that allows developers to import consistent versions of Spring Framework dependencies without specifying individual version numbers.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>6.2.8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>dependencies {
implementation platform('org.springframework:spring-framework-bom:6.2.8')
}dependencies {
// Import the BOM for dependency management
implementation platform('org.springframework:spring-framework-bom:6.2.8')
// Use Spring modules without version numbers
implementation 'org.springframework:spring-context'
implementation 'org.springframework:spring-web'
implementation 'org.springframework:spring-webmvc'
implementation 'org.springframework:spring-jdbc'
implementation 'org.springframework:spring-test'
}<dependencies>
<!-- Import the BOM -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>6.2.8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Use Spring modules without version numbers -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
</dependencies>The Spring Framework BOM operates as a Gradle/Maven platform dependency that:
Provides dependency management for all Spring Framework modules, ensuring version consistency across the framework.
// All Spring Framework modules managed at version 6.2.8
// Core Framework Modules:
'org.springframework:spring-aop:6.2.8'
'org.springframework:spring-aspects:6.2.8'
'org.springframework:spring-beans:6.2.8'
'org.springframework:spring-context:6.2.8'
'org.springframework:spring-context-indexer:6.2.8'
'org.springframework:spring-context-support:6.2.8'
'org.springframework:spring-core:6.2.8'
'org.springframework:spring-core-test:6.2.8'
'org.springframework:spring-expression:6.2.8'
'org.springframework:spring-instrument:6.2.8'
'org.springframework:spring-jcl:6.2.8'
// Data Access Modules:
'org.springframework:spring-jdbc:6.2.8'
'org.springframework:spring-orm:6.2.8'
'org.springframework:spring-oxm:6.2.8'
'org.springframework:spring-r2dbc:6.2.8'
'org.springframework:spring-tx:6.2.8'
// Web Framework Modules:
'org.springframework:spring-web:6.2.8'
'org.springframework:spring-webflux:6.2.8'
'org.springframework:spring-webmvc:6.2.8'
'org.springframework:spring-websocket:6.2.8'
// Messaging and Integration:
'org.springframework:spring-jms:6.2.8'
'org.springframework:spring-messaging:6.2.8'
// Testing:
'org.springframework:spring-test:6.2.8'Imports and manages platform BOMs for consistent third-party dependency versioning.
// Platform BOMs imported by the Spring Framework BOM:
platform('com.fasterxml.jackson:jackson-bom:2.18.4')
platform('io.micrometer:micrometer-bom:1.14.8')
platform('io.netty:netty-bom:4.1.121.Final')
platform('io.netty:netty5-bom:5.0.0.Alpha5')
platform('io.projectreactor:reactor-bom:2024.0.7')
platform('io.rsocket:rsocket-bom:1.1.5')
platform('org.apache.groovy:groovy-bom:4.0.27')
platform('org.apache.logging.log4j:log4j-bom:2.21.1')
platform('org.assertj:assertj-bom:3.27.3')
platform('org.eclipse.jetty:jetty-bom:12.0.21')
platform('org.eclipse.jetty.ee10:jetty-ee10-bom:12.0.21')
platform('org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.8.1')
platform('org.jetbrains.kotlinx:kotlinx-serialization-bom:1.6.3')
platform('org.junit:junit-bom:5.13.1')
platform('org.mockito:mockito-bom:5.18.0')Provides version constraints for 120+ commonly used third-party libraries to ensure compatibility with Spring Framework.
// Selected third-party library constraints:
// Jakarta EE APIs
'jakarta.servlet:jakarta.servlet-api:6.0.0'
'jakarta.annotation:jakarta.annotation-api:2.0.0'
'jakarta.inject:jakarta.inject-api:2.0.1'
'jakarta.persistence:jakarta.persistence-api:3.0.0'
'jakarta.transaction:jakarta.transaction-api:2.0.1'
'jakarta.validation:jakarta.validation-api:3.0.2'
'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1'
// Database and Data Access
'com.h2database:h2:2.3.232'
'com.oracle.database.jdbc:ojdbc11:21.9.0.0'
'org.hsqldb:hsqldb:2.7.4'
'io.r2dbc:r2dbc-spi:1.0.0.RELEASE'
// Web and HTTP
'org.apache.httpcomponents.client5:httpclient5:5.5'
'com.squareup.okhttp3:okhttp:3.14.9'
'io.undertow:undertow-core:2.3.18.Final'
// Application Servers
'org.apache.tomcat.embed:tomcat-embed-core:10.1.28'
'org.eclipse.jetty:jetty-reactive-httpclient:4.0.9'
// Aspect-Oriented Programming
'org.aspectj:aspectjrt:1.9.22.1'
'org.aspectj:aspectjweaver:1.9.22.1'
// Template Engines
'org.freemarker:freemarker:2.3.34'
// Testing Frameworks
'junit:junit:4.13.2'
'org.hamcrest:hamcrest:2.2'
'org.mockito:mockito-core:5.18.0'
// And many more...<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>spring-app</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>6.2.8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
</project>// Root build.gradle
plugins {
id 'java-platform'
}
dependencies {
api platform('org.springframework:spring-framework-bom:6.2.8')
}
// Module build.gradle
dependencies {
implementation platform(project(':platform'))
implementation 'org.springframework:spring-context'
implementation 'org.springframework:spring-webmvc'
implementation 'org.springframework:spring-jdbc'
testImplementation 'org.springframework:spring-test'
testImplementation 'org.junit.jupiter:junit-jupiter'
}Spring Boot automatically manages Spring Framework versions, but you can override with the BOM:
dependencies {
implementation platform('org.springframework:spring-framework-bom:6.2.8')
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
}The BOM ensures consistent versioning across all Spring dependencies at runtime:
// All these imports use the same Spring Framework version (6.2.8)
// managed by the BOM
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;
@RestController
public class ExampleController {
@Autowired
private JdbcTemplate jdbcTemplate; // spring-jdbc:6.2.8
@GetMapping("/data")
@Transactional // spring-tx:6.2.8
public String getData() {
// spring-web:6.2.8 and spring-context:6.2.8 working together
return jdbcTemplate.queryForObject("SELECT 'Hello World'", String.class);
}
}The BOM also manages third-party dependencies that Spring Framework depends on:
// Jackson dependency version managed by BOM
import com.fasterxml.jackson.databind.ObjectMapper; // 2.18.4
import com.fasterxml.jackson.core.JsonProcessingException;
// AspectJ version managed by BOM
import org.aspectj.lang.annotation.Aspect; // 1.9.22.1
import org.aspectj.lang.annotation.Around;
// Jakarta EE APIs version managed by BOM
import jakarta.servlet.http.HttpServletRequest; // 6.0.0
import jakarta.persistence.Entity; // 3.0.0The Spring Framework BOM 6.2.8 provides compatibility constraints for:
// Platform dependency import format for Maven
dependency {
groupId: "org.springframework"
artifactId: "spring-framework-bom"
version: "6.2.8"
type: "pom"
scope: "import"
}
// Platform dependency import format for Gradle
platform('org.springframework:spring-framework-bom:6.2.8')