哪个 Spring Cloud AWS 版本应该与 Spring Boot 3 一起使用?

问题描述 投票:0回答:2

我正在尝试使

SqsListener
工作,但我不能使用Spring Boot 3,它根本没有收到任何东西。当我将 Spring Boot 版本更改回 2.X 时,一切正常。 我使用的是 2.4.2 版本的 Spring Cloud:

...
    <dependency>
            <groupId>io.awspring.cloud</groupId>
            <artifactId>spring-cloud-starter-aws-messaging</artifactId>
        </dependency>
</dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.awspring.cloud</groupId>
                <artifactId>spring-cloud-aws-dependencies</artifactId>
                <version>2.4.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

你能给我指出正确版本的 spring cloud 吗? 我需要为此使用里程碑版本吗?

java spring-boot spring-cloud amazon-sqs spring-cloud-aws
2个回答
5
投票

它不起作用,因为 spring-cloud-starter-aws-messaging 的 2.4.2 版本依赖于

spring.factories
进行 Spring Boot 自动配置,但是在 Spring Boot 3.0.0 中已经删除了对它的支持。请参阅https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#auto-configuration-files.

您可以通过创建以下文件来启用自动配置

src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

# content
io.awspring.cloud.autoconfigure.messaging.SqsAutoConfiguration

但是,它可能无论如何都行不通,因为 spring-cloud-aws 还依赖于 Spring Messaging 中的类,这些类在 Spring 6(在 Spring Boot 3 中使用)中被弃用和删除,特别是

org.springframework.messaging.handler.annotation.support.PayloadArgumentResolver
.

你必须等待 Spring Cloud AWS 支持 Spring Boot 3。他们正在开发 Spring Cloud AWS 3.0.0,但我认为它还没有发布日期。 https://github.com/awspring/spring-cloud-aws


0
投票

我让它工作(Spring Boot 3.0.4 和 AWS SqsListener)。我拼凑了一堆不同的帖子和文章。我认为这真的是解决方案:

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-messaging</artifactId>
        <version>5.3.25</version>
    </dependency>

我真的很沮丧地找到一个端到端的解决方案,所以我把它放在了 GitHub 上。希望它能帮助别人,但这似乎同时在十个不同的方向上快速移动。

https://github.com/thomashcampbell/SpringBootSQSExample

© www.soinside.com 2019 - 2024. All rights reserved.