gpt4 book ai didi

spring - spring aws 云 SNS 端点参数解析器的 Java 配置

转载 作者:行者123 更新时间:2023-12-03 16:19:21 25 4
gpt4 key购买 nike

我正在努力为我的 spring aws 云 SNS http 端点找到相当于以下 xml 配置的 spring boot java 配置。有人可以帮忙吗?

<mvc:annotation-driven>
<mvc:argument-resolvers>
<ref bean="notificationResolver" />
</mvc:argument-resolvers>
</mvc:annotation-driven>
<aws-messaging:notification-argument-resolver id="notificationResolver" />

最佳答案

Java 配置在 spring-cloud-aws 中项目here on GitHub

import com.amazonaws.services.sns.AmazonSNS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.aws.context.annotation.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;

import static org.springframework.cloud.aws.messaging.endpoint.config.NotificationHandlerMethodArgumentResolverConfigurationUtils.getNotificationHandlerMethodArgumentResolver;

/**
* @author Agim Emruli
*/
@Configuration
@ConditionalOnClass("org.springframework.web.servlet.config.annotation.WebMvcConfigurer")
public class SnsWebConfiguration extends WebMvcConfigurerAdapter {

@Autowired
private AmazonSNS amazonSns;

@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(getNotificationHandlerMethodArgumentResolver(this.amazonSns));
}
}

关于spring - spring aws 云 SNS 端点参数解析器的 Java 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36051381/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com