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

升级Spring Boot 3.3.1后缺失AwsParameterStoreEnvironmentRepositoryFactory Bean

Spring Boot 3.3.1升级后AWS参数存储Bean找不到问题解决

你遇到的NoSuchBeanDefinitionException核心原因是:当前使用的spring-cloud-aws 2.4.4版本仅适配Spring Boot 2.x,与Spring Boot 3.3.1的自动配置机制、类结构不兼容,导致无法自动创建AwsParameterStoreEnvironmentRepositoryFactory等所需Bean。

解决方案步骤

1. 替换兼容的awspring cloud依赖

将pom中旧的spring-cloud-aws相关依赖替换为适配Spring Boot 3.x的3.x版本(推荐使用与Spring Boot 3.3.x匹配的3.1.2版本):

修改后的POM依赖部分:

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server</artifactId>
    </dependency>
    <!-- 替换为Spring Boot 3.x兼容的awspring版本 -->
    <dependency>
        <groupId>io.awspring.cloud</groupId>
        <artifactId>spring-cloud-aws-parameter-store-config</artifactId>
        <version>3.1.2</version>
    </dependency>
    <dependency>
        <groupId>io.awspring.cloud</groupId>
        <artifactId>spring-cloud-starter-aws-core</artifactId>
        <version>3.1.2</version>
    </dependency>
</dependencies>

注:3.x版本中spring-cloud-starter-aws已拆分为多个细分starter,spring-cloud-starter-aws-core包含AWS客户端核心配置,满足参数存储访问需求。

2. 调整AWS配置前缀

awspring 3.x版本中,AWS相关配置的前缀从cloud.aws改为spring.cloud.aws,修改application.yml中的配置:

server:
  port : 9002
spring:
  application:
    name: spring-config-test
  profiles:
    active: awsparamstore
  cloud:
    config:
      server:
        awsparamstore:
          region: us-west-2
          prefix: /config
          profile-separator: _
          recursive: true
          decrypt-values: true
          max-results: 5
    # 调整AWS配置前缀到spring.cloud.aws下
    aws:
      stack:
        auto: false
      region:
        static: us-west-2

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:9072/eureka
  instance:
    preferIpAddress: true

mca:
  config:
    issuer: MCA
    subject: MCA
    privateKey: /etc/configPrivateKey

3. 移除无效的手动Bean配置

如果之前手动创建了AwsParameterStoreEnvironmentRepositoryFactory Bean,请将其删除——新版本的awspring会自动完成该Bean的初始化,手动创建可能导致冲突。

验证

完成上述修改后,重新启动应用,@EnableConfigServer注解将能正常触发AWS参数存储的自动配置,不再出现Bean找不到的异常。

内容的提问来源于stack exchange,提问作者Sumit Sood

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 21:32:33