为什么 SpEL 在 Spring Boot 和 Spring Cloud Stream @SendTo 中不起作用

Why does SpEL not work in Spring Boot and Spring Cloud Stream @SendTo

我创建了以下代码和匹配的配置。消息的摄取效果很好,但根本没有评估 SpEL,因此创建了一个以表达式作为名称的新 Exchange...

查看我的依赖版本 @SendTo 注释应该支持这种表达式...

我做错了什么?

我正在使用 RabbitMQSpring Boot 1.4.3

@EnableBinding(CommandChannel.class)
public class CommandSink {

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

    @StreamListener(CommandChannel.INPUT)
    @SendTo("!{request.messageProperties.headers['reply_to']}")
    public String processCommand(@Payload String cmd, @Header("reply_to") String replyToQueue){
        LOGGER.info("Got a {} command and I'll reply to {}", cmd, replyToQueue);
        String result = "geil: " + cmd;
        return result;
    }
}

What am I doing wrong?

没有; bean post 处理器中根本没有代码来计算那里的 SpEL 表达式;该值是目的地(频道名称)的简单字符串值。

是什么让您相信那里支持 SpEL?我在解析这个时遇到问题...

Looking at my dependencies versions the @SendTo annotation SHOULD support this kind of expression...