spring-cloud-alibaba-dependencies compatible with spring boot and cloud

The spring-cloud-alibaba-dependencies BOM (Bill of Materials) simplifies managing compatible versions of Spring Cloud Alibaba dependencies in your project. Here's how you can use it effectively:


1. What is spring-cloud-alibaba-dependencies?

  • It is a dependency management BOM provided by Spring Cloud Alibaba to ensure compatibility between its components and Spring Boot/Spring Cloud versions.
  • It defines specific versions for Spring Cloud Alibaba modules like nacos-config, nacos-discovery, and others.

2. How to Use spring-cloud-alibaba-dependencies?

Maven Configuration

Add it to your <dependencyManagement> section for managing dependencies:

<dependencyManagement> <dependencies> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>2021.0.1.0</version> <!-- Use the appropriate version --> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> </dependencies>

Gradle Configuration

In Gradle, you can use the BOM like this:

dependencies { implementation platform('com.alibaba.cloud:spring-cloud-alibaba-dependencies:2021.0.1.0') implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config' }


3. Choosing the Right Version

The version of spring-cloud-alibaba-dependencies you select depends on the Spring Boot and Spring Cloud versions you're using. Here's a compatibility guide:

Spring Cloud Alibaba Version Spring Boot Version Spring Cloud Version
2.2.5.RELEASE 2.3.x Hoxton.SR8
2021.0.1.0 2.5.x 2020.0.x
2022.0.1.0 2.7.x or 3.x 2021.x

Refer to the official Spring Cloud Alibaba compatibility documentation for updates.


4. Why Use spring-cloud-alibaba-dependencies?

  • It simplifies version management by ensuring all Spring Cloud Alibaba modules are compatible with each other.
  • Reduces conflicts and errors caused by mismatched versions of dependencies.

5. Example Project Setup

Maven Full Example
复制代码

<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.15</version> </parent> <dependencyManagement> <dependencies> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>2021.0.1.0</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> </dependencies>

相关推荐
王八八。5 小时前
linux后台java、postSQL部署命令
java·linux·运维
月落归舟5 小时前
MyBatis缓存机制
java·缓存·mybatis
鹿导的通天塔5 小时前
99%的人都不知道Codex 的 goal 神技!完整设置及提示词模板教学
后端
huipeng9266 小时前
企业级微服务开发实战(一):项目启动与工程化设计
java·开发语言·spring boot·spring cloud·微服务·云原生·架构
爱吃土豆的马铃薯ㅤㅤㅤㅤㅤㅤㅤㅤㅤ6 小时前
java实现excel导入、下载模板方法
java·开发语言·excel
段ヤシ.7 小时前
回顾Java知识点,面试题汇总Day12(持续更新)
java·mybatis
ltl7 小时前
Transformer 原论文怎么训出来的:8 张 P100、12 小时、warmup 4000 步
后端
why技术7 小时前
AI Coding开始进入第四个时代,我还没上车呢!
前端·人工智能·后端
java1234_小锋7 小时前
Spring AI 2.0 开发Java Agent智能体 - MCP(模型上下文协议)
java·人工智能·spring·spring ai
seven97_top7 小时前
两小时入门Sentinel
java·sentinel