You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot 3.2.4启动报错:ConfigurationPropertiesRebinderAutoConfiguration相关类缺失

Spring Boot 3.2.4 集成AWS KMS解密配置启动报错解决方案

问题背景

开发Spring Boot 3.2.4应用时,为解密application.properties中的密文,在pom.xml中添加了以下依赖:

<groupId>org.zalando</groupId>
<artifactId>spring-cloud-config-aws-kms</artifactId>
<version>4.5</version>
</dependency>

启动应用时触发如下错误:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Failed to instantiate [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans]: Factory method 'configurationPropertiesBeans' threw exception with message: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
...
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata

错误原因

核心问题是版本不兼容:

  • Spring Boot 3.x已移除org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata类;
  • spring-cloud-config-aws-kms 4.5依赖适配Spring Boot 2.x的旧版Spring Cloud组件,导致运行时无法找到已被移除的类;
  • 报错栈中出现的spring-cloud-context-2.1.5.RELEASE是依赖传递引入的旧版本,与Spring Boot 3.2.4不兼容。

解决步骤

1. 升级AWS KMS依赖版本

spring-cloud-config-aws-kms的5.x版本开始支持Spring Boot 3.x,替换为兼容版本(例如5.1.0,可选用最新稳定版):

<dependency>
    <groupId>org.zalando</groupId>
    <artifactId>spring-cloud-config-aws-kms</artifactId>
    <version>5.1.0</version>
</dependency>

2. 统一Spring Cloud版本(推荐)

Spring Boot 3.2.4对应Spring Cloud 2022.0.x(Kilburn系列),通过BOM管理依赖版本可避免冲突:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>2022.0.4</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

3. 清理并重建项目

执行Maven命令清除缓存并重新构建:

mvn clean install

验证

重新启动应用,确认类找不到的错误消失,同时测试密文解密功能是否正常工作。

内容的提问来源于stack exchange,提问作者Gaurav Takte

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 00:58:09