Spring Integration AbstractMessageSourceAdvice 已弃用

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

我正在使用

AbstractMessageSourceAdvice
在轮询文件夹后实现一项操作,但它已被弃用,这个类的替换类是什么,您有教程吗?

这是我的代码:

public class EmptyFolderAdvice extends AbstractMessageSourceAdvice {

    private static final Logger LOGGER = LoggerFactory.getLogger(EmptyFolderAdvice.class);


    @Override
    public Message<?> afterReceive(Message<?> message, MessageSource<?> source) {
        if (message == null) {
            LOGGER.info("Empty folder , the process will stop");
            System.exit(0);
        }
        return message;
} 
spring-integration
1个回答
1
投票

我认为从那个已弃用的类的 JavaDocs 中应该非常清楚:

 * @deprecated since 5.3 in favor of {@link MessageSourceMutator}.
 */
@Deprecated
public abstract class AbstractMessageSourceAdvice implements MessageSourceMutator {

我不记得我推荐过你在某个地方使用该抽象类:当目录中没有文件时,Spring 集成会正常停止应用程序

您甚至绝对不需要那个“变异器”变体:您实际上不需要改变消息源,而是改变整个应用程序以使其停止。

它还表示您使用了一些旧的 Spring Integration 版本。考虑升级到最新版本:https://spring.io/projects/spring-integration#learn

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