我正在尝试获取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">
Application类中的getNewAddress()返回一个String。
然而,它会抛出异常:
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未被评估,并被视为文字字符串。我错过了什么吗?任何帮助赞赏。提前谢谢。
答案 0 :(得分:2)
使用Spring Expression(SPeL)代替:
<http:inbound-endpoint exchange-pattern="request-response"
address="#{appversion.getNewAddress()}" doc:name="HTTP"/>