Spring集成規劃環境地政司的問題,我有我fileMessageProvider()作爲與註釋
@InboundChannelAdapter(value = "files" , poller = @Poller( fixedDelay = "${my.poller.interval}", maxMessagesPerPoll = "1" ))
public Message<File> fileMessageProvider() {
...
}
給人NumberFormatException的部署後
Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myPoller' defined in "../MyPoller.class": Initialization of bean failed; nested exception is java.lang.NumberFormatException: For input string: "{#my.poller.interval}"
而是規劃環境地政司的如果我使用FIXEDDELAY = 「10000」,它的工作好。
我的Spring集成版 '4.0.0.RELEASE'
更新:1
我使用註釋和XML配置的混合
Batch.properties
my.poller.interval=20000
integration-context.xml
<context:property-placeholder location="classpath:Batch.properties"/>
<context:component-scan base-package="com.org.reader" />
<int:transformer input-channel="files" output-channel="requests">
<bean class="com.org.reader.MyMessageToJobRequest">
<property name="job" ref="addMessages"/>
</bean>
</int:transformer>
嘗試使用#{} insted {#} –
Fincio
嘗試fixedDelay =「#{my.poller.interval}」 給出類似的異常java.lang.NumberFormatException:對於輸入字符串:「# {my.poller.interval}「 – Sam
將#更改爲$。它應該看起來像'$ {my.poller.interval}'。當然,如果你有'my'對象具有具有'interval'屬性的'pooler'屬性,它就會起作用。 – wawek