简体   繁体   English

用于应用程序上下文的Bean引用的Spring集成表达式

[英]Spring Integration Expression For Bean References on Application Context

I have a doubt that if is possible to resolve a bean reference for a JMS destination to config a JMS Adapter. 我怀疑是否有可能解析JMS目标的Bean引用以配置JMS适配器。

I have several destination configured as follows on Spring: 我在Spring上配置了以下几个目标:

<jee:jndi-lookup id="BeanID" jndi-name="jms/QUEUE" lazy-init="false"/>

Then i put a value on the Message Headers with the value like : 然后我在消息标题上放一个值,如:

@ServiceActivator
public Message<?> sendToJms(Message<?> messageInput){ 
    String queueName = solveQueueName(refToSolveBeanID); 
    return MessageBuilder.withPayload(messageInput.getPayLoad()).setHeader("beanIdHeaderRef, queueName ).builder();
}

Now my problem is how to construct the expression to solve the bean reference on Spring Context for the following configuration works. 现在,我的问题是如何构造表达式以解决以下配置在Spring Context上的bean引用。

<int:chain input-channel="jmsChannel">
        <jms:outbound-channel-adapter  
            connection-factory="solicitacaoConnFactory"   destination-expression="headers.beanIdHeaderRef">
        </jms:outbound-channel-adapter>
    </int:chain>

as you notice the JMS Destination is configured using the jndi-lookup i tried some variations but all failed. 如您所见,JMS Destination是使用jndi-lookup配置的,我尝试了一些更改,但都失败了。 I thought that is have to pass to the BeanFactory the header value, but have no idea how to create the expression, does anyone know how the expression should look like? 我以为必须将标头值传递给BeanFactory,但不知道如何创建表达式,有人知道表达式应该是什么样子吗?

Regards. 问候。

Looking to your code I don't see reason to have some access to the BeanFactory from the SpEL. 查看您的代码,我看不到有理由从SpEL访问BeanFactory的原因。 You can just resolve your refToSolveBeanID to the target Destination and place that object to the headers directly. 您可以将refToSolveBeanID解析为目标Destination并将该对象直接放置在headers

Your SpEL will be the same though. 但是您的SpEL相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM