HTTP 入站终结点 Mule 的动态地址



我正在尝试为 SOAP 服务的 http 入站端点获取动态地址。

<http:inbound-endpoint exchange-pattern="request-response" address="#[app.registry.appversion.getNewAddress()]" doc:name="HTTP"/>

Spring 上下文有 bean 定义:

<bean id="appversion" class="com.visit.util.Application">

应用程序类中的 getNewAddress() 返回一个字符串。

但是,它会引发异常,如下所示:

Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '#[app.registry.appversion.getNewAddress()]' for protocol 'http' should start with http://
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
... 38 more

看起来 MEL 未被计算,并被视为文本字符串。我错过了什么吗?任何帮助表示赞赏。提前谢谢。

改用 Spring 表达式 (SPeL):

<http:inbound-endpoint exchange-pattern="request-response"
      address="#{appversion.getNewAddress()}" doc:name="HTTP"/>

最新更新